Introducing: Webhooks as Order Type on Dhan. Now do Options Trading on

Hi Hardik,

I can see the JSON in alert_message worked but the problem is if I am using a strategy that does not repaint, then buying is at the open of the candle and due to premarket opening of NSE, Tradingview places the trade before 9:15 in pre open session (9:00-9:15). Since Dhan do not support AMO through webhook, the trade does not go through. I had already spoken to TV support and they can’t do anything related to trade initiated before 9:15.
I think your api should be modified to accept the request from TV during pre open session, otherwise the complete integration is a failure.

Are u firing the order from strategy file or study file in TV ?

I am using strategy to place the order

Then you can turn on tradingview “calc_on_every_tick” option and use time windows (user defined start and end time when order should fire) to trigger order only after market open. Be careful as “calc_on_every_tick” will fire an order every tick unless you restrict it using strategy.position_size in code to fire just one order per candle.

Can you put a sample code ?


Hi @Hardik @Naman @RahulDeshpande @Dhan @Dhan_Cares ,

May I know how to achieve setting up or modify order to have SL and TP via API, Once I place the Market order using Market price for NIFTY50 Option ?

:slightly_smiling_face: Free community support is limited to what I posted earlier. U should be able to find free code in tv public library on defining a time window, enable calc_on_every_tick and using
strategy.position_size to restrict order flow.

hello when i trying add into alert_message. It shows - Mismatched input ‘secret’ expecting ‘)’.

This is a pine script syntax error. The compiler message is indicative of the problem in hand.

Hi , I want to use option premium chart and trade should be execute by super trend signal. Please help how can i achieve that

@Om.parkash99 Tradingview doesn’t have option data. So not viable.

Tried all the options but still TV is trading in premarket session. I think the only resort is DHAN to accept the premarket order


Try disabling the pre market tick by disabling the tradingview extend hours option.

1 Like

Thats options are not available on Daily timeframe

I can see it at my end. Am not sure why you cannot.

Its only visible on intraday chart. I don’t use intraday, I trade on daily charts. Even on Intraday my setting in RTH.

Then this is ur only option currently

My every strategy has calc_on_every_tick enabled. Still it does not work.

After that you should check bar state before firing order - Bar states. Built-in variables barstate.* — Pine Script User Manual 4 documentation

1 Like

thats too taken care off