3

How to create custom price line in the tradingview widget? Example; as in the picture below.

i used vue3js and electronjs. My widget code;

window.tradingView = new window.TradingView.widget({
            autosize: true,
            symbol: 'BINANCE:' + this.symbolData.symbol,
            interval: '15',
            timezone: this.local,
            theme: 'light',
            style: '1',
            locale: 'tr',
            toolbar_bg: '#f1f3f6',
            enable_publishing: false,
            save_image: false,
            container_id: this.id,
        });
Haydar C.
  • 742
  • 12
  • 24
  • 1
    it's a graph, some software is behind. You can create your own graph with excel. If you want to implement one by yourself, you can try python together with matplot. https://www.geeksforgeeks.org/graph-plotting-in-python-set-1/ – Kektuto Oct 25 '21 at 14:36
  • Update my question. Thank you!. – Haydar C. Oct 25 '21 at 15:44
  • 1
    so you made the graph with javascript? and which line do you want to display in your graph? – Kektuto Oct 26 '21 at 09:41
  • Yeah. It made js. I want show certain price with certain color as in the picture. Example green color took, red color sold ... – Haydar C. Oct 26 '21 at 13:44
  • 1
    Its not possible with TradingView Widget, it does not have that option. – flakerimi Nov 04 '21 at 20:38

1 Answers1

-1

You can use the Trading View Online Configurator to conveniently configure the chart to your needs.

For example using the following configuration you get the price line with OHLC information (in Turkish AYDK)

EDIT (after comment): This response assumed the question is about the line with OHLC information. As pointed out by the author in the comment, this is not the case. If OP asked for the horizontal line within the chart, I am afraid this is not officially supported within the JS widget.

From FAQ on TradeView Widget:

I'd like to add a custom pine script to the widget.

It is not possible to add pine scripts to widgets at this time. > > You can publish an idea with your script and embed it.

There might be an unofficial (undocumented) way do it, but I would strongly suggest against relying on it. As always with undocumented features they might stop working at any time. If that is an acceptable risk there are some more ways in addition to SO to contact people that might know about such an option.

Settings

enter image description here

Code

<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container">
  <div id="tradingview_3a5dc"></div>
  <div class="tradingview-widget-copyright">TradingView'den <a href="https://tr.tradingview.com/symbols/SHIBUSDT/?exchange=BINANCE" rel="noopener" target="_blank"><span class="blue-text">SHIBUSDT Grafiği</span></a></div>
  <script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
  <script type="text/javascript">
  new TradingView.widget(
  {
  "autosize": true,
  "symbol": "BINANCE:SHIBUSDT",
  "interval": "15",
  "timezone": "Etc/UTC",
  "theme": "light",
  "style": "1",
  "locale": "tr",
  "toolbar_bg": "#f1f3f6",
  "enable_publishing": false,
  "save_image": false,
  "container_id": "tradingview_3a5dc"
}
  );
  </script>
</div>
<!-- TradingView Widget END -->

Result

enter image description here

jan.vogt
  • 1,801
  • 10
  • 27
  • 3
    This is not the answer I was expecting. There is no special price marking setting on the configuration page. Please see sample picture. – Haydar C. Nov 04 '21 at 16:05
  • @HaydarC. do you mean the line that says "limit" in your screenshot? – jan.vogt Nov 04 '21 at 20:56
  • @HaydarC. I updated the answer. I think what you want is not possible... – jan.vogt Nov 04 '21 at 21:37
  • The screenshot that appears is of a web page. Adding the line with the limit in it. – Haydar C. Nov 06 '21 at 03:35
  • Can you link to this webpage? – jan.vogt Nov 07 '21 at 23:57
  • https://www.binance.com/en/trade/BTC_USDT?layout=basic click "TradingView" link. When you signin and place a sell order, it creates a price line as seen in the picture above. – Haydar C. Nov 08 '21 at 04:55
  • 1
    Unfortunately, I can't perform the necessary steps to reproduce. I hope s.o. else with binance will be able to investigate how they do it. I am not too hopeful though, most likely it will be custom developed or at least a paid feature of TradingView. – jan.vogt Nov 10 '21 at 08:22