This algo is supposed to buy when the 200 day sma is bellow price and liquidate when price falls bellow 200 day sma. I believe the data for the 200 day sma is not working correctly as this algo is making purchases when it should not be. Could you let me know if there is a problem in the data or with my code?

Author