How to Trade Using Webhook

My Detailed Question is as Below:
I have a Strategy which gives buy-sell signal alert. I just want to reverse my position using webhook feature. When i try to create the Webhook alert and json, what really happens is the buy and sell order both get executed at the same time i.e. on same second and position does not reverse but create buy and sell both hence creating the position closed scenario.
Eg. I want to start trading using webhook on say want to buy nifty futures, and when buy alert is triggered, then instead of just buying and then after selling only when sell alert is triggered; what it does is executing both buy and sell orders simultaneously.

So please kindly help how should i configure the scrip in dhan, webhook and json

Hello @MT2811

Welcome to Dhan Community! Excited to see you explore Dhan Webhooks and integrating with your own strategy.

Over here, the point that you need to take into account is whether your Strategy is generating two different alerts on TradingView.com or not. As per my understanding from your post, you need to ensure that whenever Buy signal is generated, only buy alert is triggered and when Sell Signal is generated, sell alert is triggered.

You can try this first by creating two separate alerts in TradingView with messages: โ€˜Buyโ€™ and โ€˜Sellโ€™ for both scenarios.

Now, if you are getting both these alerts separately only on the signal on chart, then you can create two different Order JSON from Dhan (one for buy and other one for sell) and you can paste these JSON in respective alerts.

Hope this helps!

Ok got it and it started working

1 Like