MovingAverage / system-backtest-project

Backtest result of projects
0 stars 0 forks source link

Market Type indicator #2

Open MovingAverage opened 6 years ago

MovingAverage commented 6 years ago
library("quantstrat")

# 2. Stock Instrument Initialization

# 2.1. Initial Settings
init.portf <- '2014-12-31'
start.date <- '2015-01-01'
end.date <- '2015-12-31'
Sys.setenv(TZ="UTC")
init.equity <- 10000

getSymbols(Symbols="SPY",src="google",from=start.date,to=end.date,index.class="POSIXct",adjust=T)
tail(SPY,10)

SPY$ROC <- ROC(Cl(SPY),type="discrete")
SPY$ROC <- ROC(Cl(SPY))
SPY$ROCMean <- runMean(SPY$ROC, 100)
SPY$ROCSD <- runSD(SPY$ROC, 100)
SPY$MKtype <- (SPY$ROCMean/SPY$ROCSD) * 10

chartSeries(SPY$MKtype)
MovingAverage commented 6 years ago

"Market SQN score for 200 days, 50 days, and 25 days to assess the bigger picture."

MovingAverage commented 6 years ago

screen shot 2017-09-10 at 10 52 07 am

MovingAverage commented 6 years ago

From Vans newsletter "Van monitors market type because it helps traders know which kind of trading systems they should be using right now. Systems that perform well in a Bull Quiet market type should have been performing really well for the last few months — and right now. Bull Quiet type systems are relatively easy to design (think buy and hold with a trailing stop) but Van would also encourage you to define different trading systems for different market types. If the market were to switch to a Sideways Quiet type, you would stop using your Bull Quiet systems and start using your Sideways Quiet systems. Rather than trying to predict what the market will do and how to be proactive with your positions ahead of the market, simply know the market type and trade the appropriate systems.

This approach makes a few assumptions —

"

MovingAverage commented 6 years ago

"There are numerous ETFs that track everything from countries, commodities, currencies and stock market indices to individual market sectors. ETFs provide a wonderfully easy way to discover what’s happening in the world markets. I apply a version of my System Quality Number® (SQN®) score to measure the relative performance of numerous markets in a world model.

The Market SQN score uses the daily percent change for input over a 100-day period. Typically, a Market SQN score over 1.47 is strongly bullish and a score below -0.7 is very weak. The following color codes help communicate the strengths and weaknesses of the ETFs in this report:

Dark Green: ETFs with very strong Market SQN scores > 1.47 Light Green: ETFs with strong Market SQN scores (0.70 to 1.47). Yellow: ETFs with slightly positive Market SQN scores (0 to 0.70). These are Neutral/Sideways Brown: ETFs with slightly negative Market SQN scores (0 to -0.7). Red: Very weak ETFs that earn negative Market SQN scores (< -0.7)."