Log in to see Cloud of Tags

Wealth-Lab Wiki

TASC 2012-08 | Sector Rotation Model (Siligardos)

RSS

Traders' Tip text

The WealthScript code to produce the SRMind oscillator is given below. Wealth-Lab customers should create and update a DataSet with the Sector ETF symbols and then click any symbol in any DataSet to run the script. Solidly positive for virtually every day 2012, the SRMind oscillator appears to suggest that the S&P 500’s recent setback to the 200-day moving average (Figuire 1) will be just that – a setback, despite the fundamental backdrop of Europe’s expanding crisis.


Image
Figure 1. SRMind oscillator atop the S&P 500 index, which recently tested the 200-day moving average.


Tip: Don't copy! Instead, use the Strategy Download feature in the Strategy Explorer (Ctrl+O)

using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators;

namespace WealthLab.Strategies { public class SRMind : WealthScript { StrategyParameter _lookback; StrategyParameter _maPeriod; public SRMind() { _lookback = CreateParameter("Lookback Period", 75, 20, 200, 5); _maPeriod = CreateParameter("MA Period", 200, 50, 200, 25); } protected override void Execute() { int lbp = _lookback.ValueInt; DataSeries xly = GetExternalSymbol("XLY", true).Close; // Consumer Discretionary DataSeries xlf = GetExternalSymbol("XLF", true).Close; // Financial DataSeries xle = GetExternalSymbol("XLE", true).Close; // Energy DataSeries xlu = GetExternalSymbol("XLU", true).Close; // Utilities DataSeries xlp = GetExternalSymbol("XLP", true).Close; // Consumer Staples DataSeries bear = (ROC.Series(xle, lbp) + ROC.Series(xlu, lbp) + ROC.Series(xlp, lbp)) / 3d; DataSeries bull = (ROC.Series(xly, lbp) + ROC.Series(xlf, lbp)) / 2d; DataSeries srm = 100 * (bull - bear); srm.Description = "SRMind"; ChartPane srmPane = CreatePane(40, true, true); PlotSeriesOscillator(srmPane, srm, 0, 0, Color.LightGreen, Color.LightPink, Color.Black, LineStyle.Solid, 1); DataSeries sma = SMA.Series(Close, _maPeriod.ValueInt); PlotSeries(PricePane, sma, Color.Blue, LineStyle.Solid, 2); } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.


ScrewTurn Wiki. Some of the icons created by FamFamFam.