TradeStates applied to S&P500 (SPY)

SystTrader
2 min readSep 5, 2017

--

TradeStates is a trading algorithm to generate trading signals on any stock, ETF or other financial instrument. SPY is an ETF (Exchange Traded Fund) on the S&P500 index. Raw End of Day data on SPY is obtained from Tiingo.

The time zones indicated in grey indicate when SPY would have been in trade.

The colors of the lines or bands in the chart represent the following:

  • Green: the upper line of the band indicates the current or most recent high of the price.
  • Orange: low price zone, where the price pulled back 70% or more from the top of the green zone, without hitting the stop yet.
  • Red: a line indicating the stop price. When the price drops below the red line, the position is stopped out and sold.
  • Blue: the SMA (simple moving average) using a memory period of 100 days

The table contains the following:

  • price: the current available (rightmost in the chart) eod (end of day) price
  • stop: the current stop level (red line)
  • steep: the current steepness in %/yr of the blue line
  • sharpe: the steepness divided by the volatility
  • result: the cumulative result of the current (rightmost) trade
  • orange: the top of the orange zone
  • steepday: the steepness in%/dy of the blue line
  • volday: the volatility in %/dy

The green box shows that the current TradeState is green, indicating that the price lies in the green band. The number inside this box is the number of days that this green state is in effect.

The isolated number indicated with vc is the volatility coefficient in %/150 dys

TradeStates produced 3 trades on SPY since 1 Jan 2008, all highly profitable.

Disclaimer: This article was written for informational purposes only, and is not intended as personal investment advice. Practice due diligence before investing in any investment vehicle mentioned in this article. I wrote this article myself, and it expresses my own opinions. I am not receiving compensation for it.

--

--

SystTrader

Data scientist and private investor. Building and testing trading strategies led by statistics only.