Please help me code this to back test

Dear Algo Team,

Please help me backtest the below strategy:

On a Intraday trading:

  • I would like to buy when the current price is greater than market open price of that day by10 Rs
    • ​​My buy exit will be when current price is greater than market open price of that day by 30 Rs
    • My stop loss buy exit will be when current price is less than market open price of that day by 10 Rs
  • ​I would like to sell when the current price is less than market open price of that day by 10 Rs
    • ​​My sell exit will be when current price is less than market open price of that day by 30 Rs
    • My stop loss sell exit will be when current price is greater than market open price of that day by 10 Rs

​Also,in backtesting window...what should I keep in -- "Periodicity", "Bar Interval"and "Days

Thanks for the help in advance

As per the above condition use day periodicity and one bar interval

Buy Script:

LAST > OPEN+10

Exit Buy:

LAST > OPEN+30

Sell Script:

LAST < OPEN-10

Exit Sell:

LAST < OPEN-30