Questions regarding “Webhook and JSON”

Question 1
What would be the “time” criteria, which JSON will follow? Will it follow, current script is set to? (example-if script say 5min-trading to follow 5min; or if script say 1min-trading to follow 1min)?

Question 2
Do I need “multiple Pine scripts with same strategy” for different time variation?
(Example-Option Trading – 5 min chart for intraday, Futures trading – 1hr. Chart for 15 days, Stocks Equity- Day chart for 1 year

Question 3
Do I have to use separate script for CE options (buy CE/sell CE) or PE options (buy PE /sell PE)?

Question 4
What would be the “candles**”** criteria, which JSON will follow? Will it follow, current script is set to? (example- Candlestick, Heiken Ashi, or Renko)?

Question 5
Is JSON code applicable only on “price alerts”? Is it applicable on other alerts also such as strategy based entry and exit (SL/TSL)?

Question 6
If strategy conditions are met, will the trade enter or exit automatically? (Or for exit condition script need to have SL/TSL option add into it?)

Question 7
Do Pine script need to be added with “//JSON or //webhook” in order to work, or script can work without it?

Question 8
In webhook, I am not able to see MCX futures in “script to add section”, such as CrudeOil, CrudeOilM, NaturalGas etc.?

Question 9
If intraday finishes at 15:15 hrs. IST; will the trade continue, or will it exit automatically at 15:15 hrs.?

Question 10
If strategy mention “Buy” / “Sell”, so trade get exit based on (SL/TSL) condition? Are these separate buy entry points and sell entry points?

Thanks and Regards

Trading via Webhook and JSON generated from Dhan works at a frequency of alerts generated from your script. The chart time period is immaterial to it.

No. You can fire these from the same script.

Again doesn’t matter which type of candles you use. Only alerts generated will have an effect on placing orders via Webhook and JSON strings.

If your SL/TSL can generate alerts from TV it will work just like it works with price alerts.

Depends on your configuration. U can enter and exit automatically by generating appropriate alerts and using appropriate order string JSONs.

Webhook url is given in the TV alert notification window. It won’t be there in the code. JSON strings need to go to alert message field. If you do this programmtically it will be in the code. If you manually enter in the alert message field it needn’t be there in the code.

Not enabled by Dhan yet. You will have to fill these in basket and trigger it using webhook.

If u have placed an intraday order and if your code doesn’t close it then it will be auto squared off by Dhan at 3:20PM. If you placed a normal order it will carry over to the next day if yor code doesn’t exit it.

You need to generate separate alerts for each signal (Buy, Sell, SL/TSL) and fire appropriate orders for each.

1 Like

Hi @fortu3

Welcome to the Dhan community.

These are some really interesting and insightful queries, thanks to @t7support for answering all of them. Hope your queries have been answered @fortu3

Do keep on contributing to the Dhan community.

1 Like

yes, thank you @t7support and @RahulDeshpande .

1 Like

Automated placing orders on Dhan thru TV Alerts, webhook and JSON. messsage

Other things are clear. is there any detailed explanation on the below JSON format for placing orders. questions are after the JSON code below.

{
“secret”: “V35J3”,
“alertType”: “multi_leg_order”,
“order_legs”: [

{“transactionType”: “{{strategy.order.action}}”,
“orderType”: “MKT”,
“quantity”: “{{strategy.order.contracts}}”,
“exchange”: “{{exchange}}”,
“symbol”: “{{ticker}}”,
“instrument”: “EQ”,
“productType”: “C”,
“sort_order”: “1”,
“price”: “0”
}
]
}

**Questions **
what are the valid values (with description) that we can enter for

  1. transactionType
  2. orderType
  3. quantity fix, % of equity etc
  4. instrument EQ, OPT, FUT etc
  5. productType

6 how to place stop lot and take target price.
7. how to enter a comment while placing an order. this is needed, so we know which strategy, which timeframe, an order was placed. this will be very usefull for us to identify which strategies work on which symbol and timeframe.

What is JSON code for Bracket Order of 1 lot of NIfty current week option CE for 20000 strike price?

@rkmaurya we have explained how to create it here - https://youtu.be/KwOcnzmtXIQ?si=fwe0nfBdBD6VxZed

Hi Everyone,
Need a bit of Help regarding JSON
My bot places say 5 to 10 Buy orders of CE or PE as and when the conditions are met. Now when condition is met to take TP or SL all these orders need to close, now lets say 5 CE Buy orders are placed with each having qty of 10 lots, Now when the exit condition is met it needs to close the entire qty, i.e 50 Lots, how to create JSON for qty which can be variable.
Regards