The momentum strategy (below) contains a TrendSwitch which turns the strategy ON when (external symbol) SPY shows a weekly close above its sma15 and, if it is ON, it turns the strategy OFF when SPY shows a weekly close under its sma25. It has worked most reliably . . . . .until now.
A short history: the strategy was in OFF mode from May10 to Aug6. It turned ON (correctly) at the start of the week of Aug9. After one week in the ON position it should have turned OFF and entered no trades starting the week of Aug16.
( week-ending Aug13 : SPY close 108.31, sma25 112.33 ). However it has remained stuck in the ON position and continues to enter new trades.
The strategy has turned ON and OFF after a single weekly bar once before (week of Dec10,07), so that doesn't seem to represent a quirk. I cannot see that SPY has current data problems. This puzzle likely has a simple explanation but I can't see it. I'd like to get the program going again - help much appreciated
CODE:
Please log in to see this code.
Size:
Color:
QUOTE:
( week-ending Aug13 : SPY close 108.31, sma25 112.33 ). However it has remained stuck in the ON position and continues to enter new trades.
Week-ending Aug6 : SPY close 112.39, sma25 112.44 - can you spot a CrossUnder here? Me not. SPY was below the average.
Size:
Color:
Eugene
but
. . . . .coming into Aug, TrendSwitch is OFF
QUOTE:
Week-ending Aug6 : SPY close 112.39, sma25 112.44 - can you spot a Crossunder here? Me not. SPY was below the average.
now here, b/c SPY closes above sma15 ( 109.895 the end of the week vs SPY at 112.39), this is the CrossOver that turns the switch ON. The program did this correctly and entered trades during the following week
week-ending Aug13, SPY close 108.31. sma25 112.33 - this is the CrossUnder that should have turned the switch OFF
but hasn't yet
note that the TrendSwitch turns On when there is a Crossover of sma15 and then OFF when there is a Crossunder of sma25
Thanks again
Size:
Color:
Week Aug 6 - SPY close 112.39, sma25 112.44 (below)
Week Aug 13 - SPY close 108.31, sma25 112.33 (again below)
Where do you see a CrossUnder of Close/SMA25 here? SPY was already below SMA25 on the 1st week.
Size:
Color:
ok, I see what's happening - if when the switch is on, SPY doesn't Crossover its sma25 it can't switch OFF. Need to think how to introduce a back-up OFF switch. Thanks
Size:
Color: