public MCO(Bars advBars, Bars decBars, int period1, int period2, string description) public static MCO Series(Bars advBars, Bars decBars, int period1, int period2)
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using Community.Indicators;namespace WealthLab.Strategies { public class MCO_demo : WealthScript { private StrategyParameter per1; private StrategyParameter per2; public MCO_demo() { per1 = CreateParameter("EMA Period 1",19,2,300,20); per2 = CreateParameter("EMA Period 2",39,2,300,20); } protected override void Execute() { // NYSE Advancers and Decliners data using Wealth-Data provider Bars adv = GetExternalSymbol( "$NYSE_ADVN", true ); Bars dec = GetExternalSymbol( "$NYSE_DECLN", true ); DataSeries mco = MCO.Series(adv,dec,per1.ValueInt,per2.ValueInt); ChartPane paneMCOPane2 = CreatePane(30,true,true); ChartPane paneMCOPane1 = CreatePane(30,true,true); PlotSeries(paneMCOPane1,mco,Color.FromArgb(255,0,0,255),LineStyle.Solid,1); // McClellan Summation Index DataSeries mcoSumIdx = new DataSeries( Bars, "McClellan Summation Index" ); for(int bar = Math.Max(per2.ValueInt,per1.ValueInt); bar < Bars.Count; bar++) { if( adv.Close[bar] > 0 ) mcoSumIdx[bar] = mcoSumIdx[bar-1] + mco[bar]; } PlotSeriesOscillator(paneMCOPane2,mcoSumIdx,1000,-1000, Color.FromArgb( 30,Color.DarkBlue ),Color.FromArgb( 30,Color.DarkRed ),Color.Red,LineStyle.Solid,1); } } }
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using Community.Indicators;namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { int per1 = 19; int per2 = 39; // NYSE Advancers and Decliners data using Wealth-Data provider Bars adv = GetExternalSymbol( "$NYSE_ADVN", true ); Bars dec = GetExternalSymbol( "$NYSE_DECLN", true ); DataSeries mco = MCO.Series(adv,dec,per1,per2); DataSeries mcoSumIdx_m = Close*0; mcoSumIdx_m.Description = "McClellan Summation Index (Miekka)"; DataSeries AminusD = adv.Close - dec.Close; DataSeries emaST = EMA.Series( AminusD, per1, EMACalculation.Modern ); DataSeries emaLT = EMA.Series( AminusD, per2, EMACalculation.Modern ); for(int bar = 3* Math.Max(per2,per1); bar < Bars.Count; bar++) { mcoSumIdx_m[bar] = 1000 - 9*emaST[bar] + 19*emaLT[bar]; } ChartPane mcosi = CreatePane( 30, true,true); PlotSeries( mcosi, mcoSumIdx_m, Color.DarkGreen, WealthLab.LineStyle.Histogram, 3 ); } } }