Autotrade with our own strategy at trading view


I have my own strategy at trading viw and i want auto trade on buy-sell signals generated …
I want to trade in equity futuers and commodity futures…

Please help and tell me complete process…

Kamal Gupta

Hi @Kamal1711

Welcome to Dhan community. Firstly request you to remove your mobile number from here, its public forum and we would prefer users keeping personal information private.

You can Trade based on your TradingView strategy by executing it using free web hooks that Dhan provides.

To execute single orders: Introducing Webhook Alerts : Direct Order Placements on TradingView from Dhan

To execute multiple orders in a basket: Introducing: Now execute your Basket Orders via webhooks on TradingView

Hi Pravin!

After going thru the mentioned 2 videos I was able to generate trades in Dhan using the manually created alerts by copying the JSON code generated from the My Profile in the Alert message box. Webhook was generated and used. This part is OK.

But, I have my own custom pine script strategy which triggers buy or sell alerts as per the strategy on BANKNIFTYF2023. In the Pine script, I have written code that generates syntax in the same format as JSON code generated from the My profile. I have created the alert and placed {{strategy.order.alert_message}} in the message. The alert is getting triggered on the BANKNIFTY FUTURES CHART as per the strategy, but the order is not sent to Dhan.

If would be of great help if you can provide or publish a sample pine script strategy with JSON syntax and generate automatic alerts for BANKNIFTY AND NIFTY FUTURES, and BANK NIFTY OPTION . This is the most required feature for all.

Awaiting a positive actional reponse.


Hey @gurukontham where did you learn to code in pine script strategy? I have zero knowledge about coding and I want to get started with it. Can you guide me from where to get started?

Hi @gurukontham Welcome to Dhan community.

Noted. We are actually working to re-build the webhook based trading for Options Trading via TradingView in a much simpler way from what we have now. Give us some time - we are figuring out things on our side and also with TV to get this flow simplified, specially for trading in Options, or any other segment as well.

Hi Akhil! If you already know basics of any software programming language, then learning Pine script will become easy. If you know Data types, variable declaration, constructs and loops and using of available std functions, then you can start right away coding in Pine script after going thru some examples.

If not, then you have to start from scratch and best way is to go thru the Pine script User manual at

1 Like

Hi Pravin! Thanks for your prompt response.
You may be aware that the feature of orders placement from charts (stocks, futures, indices and even options) is already available in some of the other broker platforms. Most of the indicators available with trading View (TV) are also available in those charting platforms.

The special feature of TV is custom indicators, pine script based strategies and auto alerts generated thru pine scripts. Most of the traders, be it Intraday or positional, trade in index options and lion share of the NSE volumes are from index options. Some of them are already trading uisng TV via 3rd party API bridges.

If dhan brings in the feature of trading in index futures and options directly from TV charts based on pine script strategy auto alerts, then Dhan will become MEGA hit and will soon be among TOP 2 brokers in India.

I hope that it will be taken on Top priority and wishing that a postive news comes very soon.