Please help me in finding what is wrong with my code

I am writing below code and back testing on 30 min chart of infy



Exit long


after executing the backtest, I am getting chart which is showing buy and exit on each and every 30 min candle which is not possible. How to test this code pls help. ( i have snap shots but could not find the option to attach in this question).

Pls help, bye Vishal

the above script is giving results check the screenshot