Hello Quant Community,

I have recently been working on a EMA crossover strategy that implements quite a few other indicators but I have recently run into an issue.

My issue is when I try to short stocks, so I removed all strategy elements besides the EMAs because that is what is causing the issue. I am sure its some simple logic but frankly I need a fresh set of eyes on it.

So I am trying to go LONG on a 13/49EMA Crossover when price is above a 220EMA, and short when there is a 49/13EMA Crossover below the 220EMA.

I know an EMA strategy standing alone is rough to make profitable, however I believe with other analyses and Profit/Loss orders I would like to try to make it profitable. 

Eventually I would like to implement my complete strategy in a Universe Filter but thats a post for another day. And the code is currently set up to take a full portfolio and buy based on portfolio size.


So everything works fine for the 13/49EMA Crossover above the 220EMA, however when there is a 49/13EMA when price is below 220EMA it seems to buy and sell every minute. I am fairly certain its a simple logic thing, thats why I implemented so many plots for visualization when I use other indicators and analysis as well. However the plotting doesnt come up great in an attached backtest so feel free to throw it in your own Node.

Any help or ideas would be greatly appriciated!