Code to Sell option based on TOTAL PRICE


I need program code to sell option based on Total price.


I bought option CE8000 at Rs.X, if my current position TOTAL AMOUNT(Ex: Rs. Y) reaches certain amount, it need to execute SELL order at market price.

can not be coded based on total amount, you can define if the price reaches to this like …,

and you can use price alert indicator,

Thanks for your kind response, but in zerodha web trade site, there is an option to show our "NET VALUE’ which is ‘Total amount’ of our current position(You can find this option in ‘Admin position book’ in’). Is there any alternative to execute CLOSE call based on it?