Hi FYERS team and community.
I have a code which works as follows. I need to apply trailing stop loss to my strategy and I can get live price for option I entered. Can someone please help to build a tsl function which I can call inside while condition which will track the price of option and modify the stop loss as price of option moves?
sl =-1000
tsl=15 #points to trail
strategy_condition(option_atm):
abc
main_strategy():
condition a:
strategy_condition()
abc
function_for_tsl(option_atm, tsl)
While True():
main_strategy()
if live_pnl< sl:
exit all positions