Need code for buy when price is above 21 SMA and MACD histogram is rising below zero and sell signal when price is below 21 SMA and MACD histogram is falling above zero

As per the above condition

Buy Script:

SET A = MACDSignal(13, 26, 9, SIMPLE)
SET B = MACD(13, 26, 9, SIMPLE)
LAST > SMA(CLOSE,21) AND CROSSOVER(A, B) = TRUE

Sell Script:

SET A = MACDSignal(13, 26, 9, SIMPLE)
SET B = MACD(13, 26, 9, SIMPLE)
LAST < SMA(CLOSE,21) AND CROSSOVER(B, A) = TRUE
1 Like