Buy nifty 50 point up from prev close

Please tell me how to code in PI to buy nifty future above 50 point from prev close and sell it below 50 points from prev close. For example, if nifty future was closed at 8000 yesterday, then today I want to buy it at 8050 and sell it at 7950.

As per the above query you can use price alert indicator

Thanks. Please tell me how to back test it. I tried CLOSE>CLOSE+50 for buy and CLOSE<CLOSE-50 for sell but it does not work. The graph shows buy and sell signal for all the days.

give the price directly instead of close+50

Then please tell me how to do back test with direct price? I need a code to calculate prev close + 50 dynamically (for every day) for back test for 6 months. Direct price will work for one day only.