How to Creating dynamic JSON message in pine script to place automatic orders in equity using Webhooks

Hi I am trying to create a dynamic Jason code in trading view Pine script where I can automatically place orders using web hook in tradingview

Hi @ABHISHEK1990 Welcome to Dhan community.

We have explained in details about using Webhooks here: https://community.dhan.co/t/introducing-now-execute-your-basket-orders-via-webhooks-on-tradingview/1140

More details on how to use also on this YouTube video: https://www.youtube.com/watch?v=xgWVmIad-cY

Im getting then alert triggered but no actual buy sell is happening

Im getting the alert triggered but no actual buy or sell signal being generated i have connect the app to thr broker using dhan

Some preliminary quick checks :point_down:

  • Webhook URL correct and active ?
  • JSON generated for the corresponding Webhook URL ?
  • FnO segment activated for you ?

1.Webhook URL CORRECT AND ACTIVE
2. JSON COPED FORM WEBSITE
3. Why fno segment activated I’m placing a DELIVER ORDER

As per your JSON string u r placing order for SBI Option Contract SBI 560 CE.

Thanks it worked.
But is there any way to place After MARKET Order.

Can you please share the working json, I am facing the issue now. I am trying to generate Banknifty option buy order (single) and sell. Alert is getting generated successfully but the order is not getting placed on dhan.

image

@Prithvi @PravinJ Can I please get the response to my query?

You seem to have specified quantity as 30. In Dhan’s webhook JSON, this field represents the number of lots, not the number of contracts. So, if your intention was to buy 1 lot, the quantity should be 1.

With quantity set to 30, Dhan will attempt to place an order for 30 lots. If you don’t have sufficient margin, the order will be rejected.

If that’s not the issue, make sure you generated the JSON after creating the webhook URL, and verify that the webhook is still active.