Jaspers Hub

jaspers / tradingview

pluginOfficialReviewed★ 0↓ 9

TradingView Chart: Shows TradingView's advanced chart widget in a frame, driven by panel state (symbol, interval, studies), reporting back the last quote.

2.8 KB
1// What the orchestrator is told while a chart element is focused: how to drive the widget by state,
2// and what it cannot tell you, since TradingView draws it on a page the app cannot read.
3
4export const INSTRUCTIONS = [
5 "A TradingView chart: TradingView's own widget, drawn with TradingView's data. state.symbol is EXCHANGE:TICKER (NASDAQ:AAPL, NYSE:JPM, AMEX:SPY, BINANCE:BTCUSDT, FX:EURUSD, TVC:DXY); a bare US ticker works too.",
6 "An index, a future, a commodity, or a coin the user names in words also works, and is resolved to the symbol TradingView charts it under: S&P 500, SPX, or SP500 -> SP:SPX; NASDAQ 100 or NDX -> NASDAQ:NDX; Nasdaq Composite or IXIC -> NASDAQ:IXIC; Dow, DJIA, or DJI -> DJ:DJI; Russell 2000 or RUT -> TVC:RUT; VIX -> CBOE:VIX; DXY -> TVC:DXY; US 10Y -> TVC:US10Y; US 2Y -> TVC:US02Y; gold -> TVC:GOLD; silver -> TVC:SILVER; oil or WTI -> TVC:USOIL; ES or S&P futures -> CME_MINI:ES1!; NQ -> CME_MINI:NQ1!; bitcoin or BTC -> BINANCE:BTCUSDT; ethereum or ETH -> BINANCE:ETHUSDT. A symbol written with an exchange is never rewritten, so NYSE:GOLD is the miner and gold is the metal.",
7 'state.interval is the bar size: 1, 3, 5, 15, 30, 60, 120, 180, or 240 minutes, D, W, or M. state.range is how much history shows: 1D, 5D, 1M, 3M, 6M, YTD, 12M, 60M, or ALL. With a range set the widget picks the bar size for it, so when the user names a bar size, set interval and set range to null.',
8 'state.style is candles, bars, line, area, heikin-ashi, or hollow-candles. state.studies adds up to five indicators, which is all the widget takes: rsi, macd, sma, ema, bollinger-bands, vwap, stochastic, stochastic-rsi, atr, adx, obv, cci, keltner-channels, donchian-channels, parabolic-sar. Volume is already under the price, so there is no study for it.',
9 'state.compare draws up to three other symbols over the main one in its pane, named the way state.symbol is (["SP:SPX"], ["gold", "oil"]); null clears them. Only the main symbol reports a price, so output.quote never covers a compared one. state.extendedHours true adds pre- and post-market bars where the exchange has them; null or false is regular hours.',
10 "To show another symbol or change how it is drawn, set the focused chart's state; place a second chart only when the user wants two at once.",
11 'output.quote is the last price TradingView reported for the symbol on screen (name, exchange, last, change, changePercent, volume), refreshed at most every 15 seconds; read it when the user asks what the chart shows. The bars, the indicator values, and anything drawn on the chart cannot be read.',
12 'The user can pick another symbol in the chart itself, and state does not hear about it: when output.quote.name is not the ticker in state.symbol, the chart is showing output.quote.name, so set symbol to it along with any other change, or the chart goes back to state.symbol.',
13].join('\n')