Help required regarding JSON

HI
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 OR the entire quantity needs to be squared off,
Regards

Hello @asijavk

There is no exit all function live with webhooks. However, if you can keep a count of your triggered alerts in TradingView via PineScript itself and pass Sell JSON for all, then these positions can be closed.

Hi Hardik

The JSON syntax I use for Exit from NEXTLEVELBOT is

[{“OTYPE”:“PE”,“AS”:“NIFTY”,“E”:“NFO”,“P”:“INTRADAY”,“AT”:“DHANHQ”}]

Here I don’t need to define quantity.

now this JSON closes the entire quantity on Dhan, I think there should be a possible way to exit all open position directly on DHAN if I use DHAN API directly.

Regards

V K Asija

Hello @asijavk

Noted. On Dhan APIs as well, there is no exit all option present. But I got the requirement here, will definitely look into the feasibility of building this

Hi Hardik

Just to understand, the syntax used for NEXTLEVELBOT,
[{“OTYPE”:“PE”,“AS”:“NIFTY”,“E”:“NFO”,“P”:“INTRADAY”,“AT”:“DHANHQ”}
this must be sending JSON call through api to Dhan to close all open positions, how come that gets executed., this does not have any quantity defined, I think when it can be done through 3rd party, why not directly with Dhan api ?.

Regards

V K Asija

Hello @asijavk

This is because with Dhan APIs, it is simple to build this by users themselves, with Next Level Bot has built at their end.

You simply need to fetch positions on the basis of ‘OPEN’ or ‘CLOSED’ and then place orders to close the OPEN positions. It is a simple logic built at Next Level Bot’s end.

Dear Hardik,

Thanks for prompt reply, look forward for EXIT ALL option directly from Dhan., which will help the entire set of people who are using my algorithms

Regards

V K Asija

2 Likes