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); } } }