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