API to trail SL

Hi @communications_team 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

Hi @115302495764442058667,

Currently, Trailing Stop Loss (SL) is not directly available on the FYERS API. We appreciate your feature request and will evaluate it for inclusion in our upcoming releases.

Hi @115302495764442058667

Here is a workaround:

  1. Get the live price of the symbol you want to trail.

  2. Lets say you are in LONG position. So we will trail when the price goes up by say every 1 point. So you can check if price moves up by 1 point.

  3. MODIFY your Stoploss order, by changing the price to previous price + 1.

Hope that works for you.