S&P 500 glitch in the system

i found a fatal flaw in the code.
S&P 500 (SPX500)Trend Analysis

Disclaimer