Please code this strategy

buy

last candle closing price is above bbm average (close,5,2,wma) and macd crossover (9,3,9,wma) and sopk crossover (6,3,3,wma) and rsi (close,5) above 50

sell

last candle closing price is below bbm average (close,5,2,wma) and macd crossover (9,3,9,wma) and sopk crossover (6,3,3,wma) and rsi (close,5) below 50

Buy:

SET A = MACDSignal(9, 3, 9, SIMPLE)
SET B = MACD(9, 3, 9, SIMPLE)
SET C = CROSSOVER(A, B) = TRUE
LAST>BBM(CLOSE, 5, 2, EXPONENTIAL) AND CROSSOVER(C,WMA(CLOSE, 30)) AND
 CROSSOVER(SOPK(6, 3, 3, SIMPLE), WMA(CLOSE, 30)) AND RSI(CLOSE, 14) > 50

Sell:

SET A = MACDSignal(9, 3, 9, SIMPLE)
SET B = MACD(9, 3, 9, SIMPLE)
SET C = CROSSOVER(A, B) = TRUE
LAST<BBM(CLOSE, 5, 2, EXPONENTIAL) AND CROSSOVER(C,WMA(CLOSE, 30)) AND
 CROSSOVER(SOPK(6, 3, 3, SIMPLE), WMA(CLOSE, 30)) AND RSI(CLOSE, 14) < 50

generating error , showing that no trades happen…
I have read a question and answer where you said last means last traded price … in my case I have to use last closing price of previous candle means if new candle is start so take last candle closing price

buy
SET A = MACDSignal(3, 6, 5, WEIGHTED)
SET B = MACD(3, 6, 5, WEIGHTED)
SET C = CROSSOVER(A, B) = TRUE
LAST>BBM(CLOSE, 5, 2, EXPONENTIAL) AND CROSSOVER(C,WMA(CLOSE, 5)) AND
CROSSOVER(SOPK(5, 3, 3, WEIGHTED), WMA(CLOSE, 5)) AND RSI(CLOSE, 5) > 50
SELL
SET A = MACDSignal(3, 6, 5, WEIGHTED)
SET B = MACD(3, 6, 5, WEIGHTED)
SET C = CROSSOVER(A, B) = TRUE
LAST<BBM(CLOSE, 5, 2, EXPONENTIAL) AND CROSSOVER(C,WMA(CLOSE, 5)) AND
CROSSOVER(SOPK(5, 3, 3, SIMPLE), WMA(CLOSE, 5)) AND RSI(CLOSE, 5) < 50

the above code is working and no errors check with different scripts …i tried for nifty bank nifty it is working fine

k… I will check it and then give u the feedback

I have check it on 5 min nifty mar fut and bank nifty fut the result is same not even a single trade is happen it shows no trade is taken… write buy and sell script

please code my strategy…my problem is not solved

hello sir, is this code for 5 min chart or 1 min chart or 15 min chart please tell … thanks…