How to buy ce and then sell ce through webhook.
Hello Brother,
I have a question, When we use trail stoploss and trail take profit in strategy conditions. usually trail stoploss exit conditions will moves the exits signals when the market moves in favor of it dynamically.
if we use a scalping strategy, most of the entries and exits will happen in the same bar.
in that case, exits will trigger and dynamically exits positions will change, by then Dhan will exit with the initial trigger and then the exit has shifted its position. so the back testing data will be very deceiving.
How to counter this issue? how about we use a buffer time conditions? i don’t want to use bar close for exit conditions as some trades will enter and exit in the same bar. and i don’t want to omit trail stoploss and trail take profit conditions in the strategy.
This query is applying stoploss viw webhooks.
Suppose I have a buy order of 5 lots which has been executed, now my stoploss has to be executed when the bar close below a horizontal line.
- How to do this via tradingview alerts and webhook.
- I tried this in past and that webhook added a new order of sell 5 lots instead of closing the earlier position of buy 5 lots.
If someone can please share the syntax that will be useful.
DId you find dynamic JSON for Dhan? i tried lot of way but i am not able to fire order. Alerts gets triggers well but ot order.
Hey @t7support @Hardik ,
For Futures trading, webhook order automation asks for Continuous Futures Symbol as visible in the below JSON generator screenshot.
But, when the current month symbol goes into Tender Period due to coming expiry then trader needs to choose the next month expiry.
So, in such case, how to trade next month expiry via webhook automation which expects a continuous futures symbol?
The work around may be to modify the contract name to Silver2! as we approach tender period and move back to Silver1! after the contract expiry in code. We can give a configurable date in script settings to tell the code about the actual expiry day or tender period which the script can then use to do the roll over task.
Hey @t7support @Hardik ,
While observing Continuous Futures on TV, I’m finding that M1 points to next month (July-05) futures but the current month (June-05) is not expired yet.
Is this normal?
Does TV continuous futures not consider actual expiry date before switching over to next month?
Hello @hachiko
The 1! and 2! contracts on TradingView are continuous contracts. The contracts are changed as per the traded volume on a day basis, you can read more about it here: How is the switching date of contracts determined in continuous futures — TradingView India
If you want to keep it for a specific expiry, you can choose the same accordingly.
Dear Dhan Team!
While placing a buy order via TradingView webhook integration, how do we ensure executed buy orders get auto-booked by market closure or 3ish PM same day?
-
On Dhan platform, while generating JSON, will it help if we mark Product = IntraDay?
-
I was reading somewhere that if we generate another JSON/alert for sell, it is considered as an independent order with no linking to the earlier buy order for the same scrip
Thanks,
DM
You will have to place a sell order to close your open position. It won’t be auto closed by the broker if it is a Normal order.
In this case yes the broker will auto square off. But your account will be debited with an intrday square off charge over and above other charges for executing your order.
Yes. Each order fired from Tradingview is independent of other orders at Dhan end.
@Hardik @t7support SENSEX Option orders are not getting placed through webhooks. Please check. URL and all I have checked are OK
The strike price needs to be in the 79000.0 format while posting JSON on webhook.


