I'm trying to add in a flat insight that will fire when the unrealized profit reaches 2%.  It doesn't seem to be working on this backtest though.  I believe the flat insight is not working because the first buy is for 562 shares.  Then the second buy is for 1086 shares.  Then the third buy is 1519 shares, the fourth buy is 1916 shares, etc.  I want it to buy close to 562 shares with every single buy order.  How could I fix this algorithm to accomplish that?

Thank you!