How to exit with 25% or 1/4th quantities via Trading View Dhan Json

Hi All,

Hope you are doing well.

I am stuck with the .json “Quantity” parameter, could you please help me how I can exit all or half positions from specific Strike price.

Ex. If I am in a position of 45500 PE, I want to exit all or half positions via .json parameter, could you please help to get that particular parameter or script.

{
“secret”: “nDSwa”,
“alertType”: “multi_leg_order”,
“order_legs”: [
{
“transactionType”: “S”,
“orderType”: “MKT”,
“quantity”: “2”,
“exchange”: “NSE”,
“symbol”: “BANKNIFTY”,
“instrument”: “OPT”,
“productType”: “I”,
“sort_order”: “1”,
“price”: “0”,
“option_type”: “PE”,
“strike_price”: “45000.0”,
“expiry_date”: “2024-02-14”
}
]
}

U cannot exit relative quantities. Current Dhan JSON structure doesn’t allow that. U have to specify absolute quantity value to exit.

Any manipulation of the quantity while placing orders will have to happen in TV pine code itself.

Hi, Thank you for your valuable reply, could you please let me know How I can achieve this via Pine script.

@dksagar50 sorry, I cannot provide pine coding support here. You need to refer to pine reference manual or get help from pine coding community to implement the scale out exit strategy that you need.