How to add trailing stoploss in this strategy?

I want to add trailing stoploss coding in this strategy…if buy signal is generated in closing price of the candle than my trailing stoploss will be the low of previous candle

And if sell signal is generated at the closing price of candle then my trailing stoploss will be the high of previous candle

Buy

SET A = MACD(3, 6, 5, WEIGHTED)
SET B = MACDSignal(3, 6, 5, WEIGHTED)
CLOSE>BBM(CLOSE, 5, 2, WEIGHTED) AND CROSSOVER(A,B) AND RSI (CLOSE, 5) > 25 AND VOLUME > REF(VOLUME, 1) * 2

Sell

SET A = MACD(3, 6, 5, WEIGHTED)
SET B = MACDSignal(3, 6, 5, WEIGHTED)
CLOSE<BBM(CLOSE, 5, 2, WEIGHTED) AND CROSSOVER(B,A) AND RSI (CLOSE, 5) < 80 AND VOLUME > REF(VOLUME, 1) * 2

1 Like

It is not possible to code trailing stoploss in tradescript languange,

1 Like