Wealth-Lab Wiki

API ChartStyles Community Components Community Indicators IndexDefinitions Knowledge Base Misc Optimizers Pending Deletion PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos Visualizers
RSS

Navigation


Quick Search
»
Advanced Search »


McClellan Oscillator & Summation Index

RSS

McClellan Oscillator: Indicator Documentation

Syntax

public MCO(Bars advBars, Bars decBars, int period1, int period2, string description)
public static MCO Series(Bars advBars, Bars decBars, int period1, int period2)

Parameter Description

advBarsThe Bars object for NYSE advancing issues
decBarsThe Bars object for NYSE declining issues
period1First EMA lookback period (19)
period2First EMA lookback period (39)

Description

According to definition at Investopedia, McClellan Oscillator is a market breadth indicator that is based on the difference between the number of advancing and declining issues on the NYSE.

References:


Example

This example illustrates how to plot McClellan Oscillator using Market Sentiment provider's symbology, as well as construct McClellan Summation Index:


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 "Market Sentiment" 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); } } }

Alternative calculation of McClellan Summation Index based on James Miekka's formula. The traditional method (see code above) causes some undesired drift, and the Miekka formula stabilizes the Summation Index, preventing the drift, and allows to calculate it without knowing the prior day's value. Thanks Sammy_G!


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 "Market Sentiment" 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 ); } } }

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.

Used under license from FMR Corp. Copyright 2008 FMR Corp. All rights reserved.


ScrewTurn Wiki. Some of the icons created by FamFamFam.