Hi All,

I want to buy if 1 share of spy if the atr of the previous candle is greater than the atr of 2 candles ago. It was glitching and did not allow me to upload the backtest, but I attached the code in python. Could someone explain what I am doing wrong? It is not ordering any buys even though the atr has increased at some point in the data after the warm up period of 14 days.

If you see what is wrong please attach a fixed code in your response, thank you so much.