Help needed in coding

Hi,

I was trying to code & backtest strategy something like below, however not sure if its possible, can someone please help,

eg for Nifty Futures
N=20
long script : If current price >= open price + N
exit long script : If current price >= open price + N + N
SL : current price = open price

N=20
short script : If current price <= open price + N
exit short script : If current price <= open price - N - N
SL : current price = open

Thanks.

For the above condition as per the syntax we can write

LAST >= OPEN+20

But it may give you continues signals as it checks each and every candle in backtest, so verify your condition.

Hi, thanks for your reply. I tried to backtest above strategy for last 30 days data, but it says “Script generated no trades”.
Let me know if I am missing anything.
I tried below,
Long : LAST >= OPEN+20
Exit : LAST >= OPEN+20+20