DocsMigrar do TradingView

Moving from TradingView

An app built on TradingView's charting library (Advanced Charts or Trading Platform) or on Lightweight Charts moves to TradeCanvas without its backend changing. The datafeed stays as it is, behind a bridge. The names that do change, options, featuresets, overrides, studies, drawings and methods, are in tables the MCP server answers from, so a coding agent looks each one up instead of guessing. This page says what carries over, what changes and what does not carry over.

Keep the datafeed

feedFromJsApi turns a datafeed written for the JS API (onReady, resolveSymbol, getBars, subscribeBars, and searchSymbols, getQuotes, subscribeQuotes when it has them) into a DataFeed:

import { feedFromJsApi } from '@tradecanvas/chart'
import { ChartWidget } from '@tradecanvas/chart/widget'

const feed = feedFromJsApi(datafeed)   // the app's datafeed, unchanged
await feed.ready()                      // onReady has answered: the timeframes it serves are known

const widget = new ChartWidget(document.getElementById('chart'), { feed, symbol: 'AAPL', timeframe: '1d' })

What the bridge does for the datafeed:

  • resolves each symbol once and hands its symbol info back to getBars and subscribeBars;
  • turns the chart's timeframes into resolutions ('1h' → '60', '1d' → '1D'), and its countBack and before into from, to and countBack in seconds;
  • asks once more from nextTime when a range had no bars;
  • unsubscribes with the guid it subscribed with, and loads the series again when the datafeed calls onResetCacheNeeded;
  • reads the symbol's pricescale and minmov as its price step, its session as its trading hours, and the timeframes it serves from supported_resolutions.

The chart reads the timeframes a feed serves when it connects, and builds the others from them (a 7-minute chart from 1-minute bars). onReady answers later, so await feed.ready() before making the widget, or give them yourself: feedFromJsApi(datafeed, { supportedTimeframes: ['1m', '1h', '1d'] }).

A UDF server

A server that speaks UDF needs no datafeed code at all:

import { udfFeed } from '@tradecanvas/chart'

const feed = udfFeed({ url: 'https://data.example.com/udf', updateFrequency: 10_000 })
await feed.ready()   // the timeframes of its /config

new ChartWidget(el, { feed, symbol: 'AAPL', timeframe: '1d' })

It reads /config, /symbols, /search, /history and /quotes. UDF has no push, so live bars and quotes are asked for again every updateFrequency ms (10 s by default). headers are sent with every request.

Let an agent map the rest

The MCP server has three tools for a move:

ToolWhat it does
migration_planThe steps in order, what to search the app's code for, and which tool maps what each search finds.
migration_lookupWhat one name becomes: a widget option, featureset, override key, study, drawing shape, widget or chart method, datafeed or broker member, or a resolution. It gives the option, feature switch, style key, indicator id (with its defaults and line keys), drawing type (with its points) or call, and says plainly when there is nothing like it and what to do instead.
convert_widget_optionsThe whole options object of new TradingView.widget({...}), featuresets and overrides included, as ChartWidget options; or Lightweight Charts' createChart options as Chart options. It also lists the calls to make once the chart exists and what has no place, and checks the result as validate_options does.

With the server connected, ask the agent for the move: it calls migration_plan first and works through the app from there. The agent skill has the same steps for an agent without the server.

What changes

TradingViewTradeCanvas
new TradingView.widget({ container: 'id' }), library_pathnew ChartWidget(element, options); nothing to host
onChartReady(cb)The onReady option, or code after the constructor
widget.activeChart().createStudy(...)widget.getChart().addIndicator(id, params); ids are short: 'rsi', 'bb'
createShape({ time, price }, { shape }), time in secondsaddDrawing({ type, anchors: [{ time, price }] }), time in milliseconds
A resolution: '60', '1D', 'W'A timeframe: '1h', '1d', '1w' (resolutionToTimeframe, timeframeToResolution)
disabled_features, enabled_featuresfeatures: every switch is on unless set false
overrides, applyOverridesStyle keys, in chartOptions.overrides or chart.applyOverrides(); line styles by name
save_load_adapterlayouts: { storage } with a LayoutStorage (list, load, save, remove)
Broker API, order and position linesAn ExecutionAdapter, setOrders, setPositions and the order events (Trading)
Lightweight Charts: bars and markers in secondsMilliseconds: time * 1000

What does not carry over

  • Saved charts. Layouts, drawings and studies saved in TradingView's format do not load: users start new layouts.
  • Custom indicators written for custom_indicators_getter are rewritten as an indicator plugin, unless one of the 134 built-in ones does the same.
  • Some drawing tools and featuresets have no equivalent. migration_lookup says which, and names the closest tool.
  • Trading across symbols. An ExecutionAdapter's orders and positions are those of the chart's symbol; an account manager over many symbols and accounts is the app's own.

The tables are written from TradingView's public documentation, read in November 2026, and are checked against TradeCanvas's own names on every build. A name that is missing or wrong is a bug: report it on GitHub.