Disclaimer: I know that everything that is posted in the community is free to clone, which I don't have a problem with, but if you do make any improvements to the algorthm, it would be much appreciated if you post your finding back here.

Hello all,

I have created this strategy that seems to work very well, but I found a flaw while testing it, and I was hoping I could get an explanation. First, let me give you a rundown of what this algorithm does.

I can not exaggerate enough on how simple this also is. First things first, here are the indicators that I use (all of these indicators are on hourly bars): 
1. Exponential Moving Average 5 and 2 on XIV. These indicators will be referred to as EMA5 and EMA2.
2. Exponential Moving Average 50 and 25 on SPY. These indicators will be referred to as EMA 50 and EMA 25.
3. Simple Moving Average 200 and 100 on SPY. These indicators will be referred to as SMA 200 and SMA 100.

Now here's the strategy. I'm going to split it up into market trends: 

Bull market:
If SMA200 is less than SMA 100 -this indicates that the market is bull- and EMA5 is less than EMA2, buy XIV because the XIV is going up in a bull market. If EMA5 goes above EMA2, sell all positions.

Bear Market with short-term bull:
If SMA200 is greater than SMA100, EMA50 is less than EMA25, and EMA5 is less than EMA2, buy XIV because the market is bear long term, but EMA50 and EMA25 indicate that there is a short-term bull trend. If, however, EMA5 is greater than EMA2 the algo will sell all XIV shares and move half of its cash into UVXY because the market is in a short-term bull market, but it's still bear long-term according to the SMA200 and SMA100 indicators. 

Full Bear Market:
If SMA200 is greater than SMA100, EMA50 is greater than EMA25, and EMA5 is less than EMA2, buy XIV. If EMA5 is greater than EMA2, the algo will use all of its cash on UVXY because the market is going down in both the short-term and the long-term.

That's the strategy, but I have a problem. I have a schedule that runs every 5 minutes. In my early testing, I used this schedule to try stop losses. However, I found that it was not needed and put a "pass" statement at the beginning of the function so that it wouldn't run. When I run the code, I get the backtest as seen below which isn't bad. Here's the problem, though. When I take out the schedule that isn't supposed to be running in the first place, I get slightly worse results as seen in the backtest in the post below this one. Why is this happening?
 

Thanks in advance,

Malachi