Buy and buy exit signal alerts

Hi,
Buy and buy exit signals appear on the tradingview chart as per my own strategy through pinescript code.

Please explain me clearly how do I create alerts for buy and buy exit signals with webhooks and JSON code.

Thank you.

I need the same.
Actually my webhooks are delivering this to telegram channel.
What modification I need to do in the response XML format such that it will be executed through Dhan platform?

@Naman ji please respond

Hello @Sohith0422

Welcome to Dhan Community!
If you are looking to place orders through Webhook and PineScript combined, you will have to use a price alert and JSON message template to be able to successfully place orders.

You can use {{strategy.order.comment}} in the JSON format for parameter transactionType in the price alert. Simultaneously, you will have to define “B” and “S” in your pinescript as comment outputs for Buy and Buy Exit signals.

Hope this helps!

@Suvra

To be able to place orders on Dhan via Webhooks, you will need JSON format for orders. We have added a video on how to set up webhooks which you can refer to : How to Use and Setup Webhook Alerts? - TradingView Webhook Alerts | Dhan - YouTube

Please help me regarding the buy/sell alert on Dhan from trading view pine script. I am new to algo and pine script and don’t have much knowledge.
I have got an ema crossover strategy and want to run it for Nifty future but ended with only order type either buy or sell triggers on Dhan order book not with the both as when buy will trigger sell will also exit and vice versa.
Please suggest any way how to do it.
I can post the pine script if it is needed.
Thanks in advance.
@Hardik @Naman

Hey @arpan.sau

Welcome to Dhan Community!
To place orders from Price alerts based on your custom indicator, you can simply place first alert with your initial quantity and for the subsequent alerts, you can double your quantity to exit your preceding trade.

E.G.: Let’s say your indicator triggers Buy Alert of 10 QTY initially. Then, you can configure your next set of price alert where you double the quantity. When Sell alert is now triggered with 20 QTY, it automatically exits the first position and creates a sell position of 10 QTY.

If you are looking to create a pine script strategy instead, you can use {{strategy.order.comment}} in JSON and define comments on Pine Script for both entry and exit orders.

Hope this helps!