I want code for backtest and my strategy is as below "buy signal when closing price croses above 50SMA line and sell signal when price fall below 50SMA line"

As per the above condition

Buy Script:

CLOSE > SMA(CLOSE,50)

Sell Script:

CLOSE < SMA(CLOSE,50)