[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: McClellan Index



PureBytes Links

Trading Reference Links

The following code will do what you asked, I think. You will have to 
create two symbols, not really composites although I use that naming 
convention. They are ~NYSE and ~NASD. The format of the files is 
OHLCVX where O = adv issues, C = dec issues and H is the higher of 
the two and L is the lower of the two. V is adv volume and X (open 
interest) is dec Volume. I use this to calculate a cumulative 
adv/dec and Moving Balance Indicator. They are fairly useful tools 
too. The data and code for the MBI are on my website, 
www.imageview.us. The data is not up to date thought. I will try to 
get that updated if time permist. 

Note the data source I use is specified in the code comments.

Barry

_SECTION_BEGIN("McClellan Index");

// By Barry Scarborough. Written 12/13/05
// Data source - http://unicorn.us.com/advdec/
// you must download this manually every day or use a macro or 
script to extract the data. 
// If you use a macro use http://unicorn.us.com/advdec/recent.txt as 
the source

// advancing issues 
function fUpIssues(market) { return Foreign(market,"O"); }  // get 
the up issues
// declining issues
function fDnIssues(market) { return Foreign(market,"C"); }  // get 
the down issues

tgl = ParamToggle("Select Market", "NYSE|NASD", 0);

if (!tgl)
{
	mkt = "~NYSE";
	index = "^NYA";
}
else
{
	mkt = "~NASD";
	index = "^IXIC";
}

per1 = Param("Fast EMA", 19, 1, 50, 1);
per2 = Param("Slow EMA", 39, 39, 75, 1);

ema1 = EMA(fUpIssues(mkt )-fDnIssues(mkt ), per1); 
ena2 =  EMA(fUpIssues(mkt )-fDnIssues(mkt ), per2);
Plot(Cum(ema1 - ena2), "McLellan Index(" + mkt + ")", colorRed );
Plot (Foreign(index, "C"), Index, colorBlue, styleLeftAxisScale);
Plot(0, "", colorBlack); // plots a zero reference line

_SECTION_END();

Another variation that I use is 

// Cumulative Advance / Decline 
// By Barry Scarborough
tgl = ParamToggle("Index", "NYSE|NASD", 0);
if (tgl) index = "NASD"; else index = "NYSE"; // select the index
period = Param("MA Period", 5, 1, 50, 1);
aI = Foreign("~" + index, "Open"); 
dI = Foreign("~" + index, "Close"); 
CumAD = Cum(aI-dI);

ad = aI - dI; // an array of daily H - L
ads5Day = Ref(MA(ad, period ),-1); // 5 day simple ma of the four 
days before today
adsNext = ad;                      // todays a-d values
ads =  (0.75 * ads5Day) + (0.25 * adsNext); // 75/25 weighted // 
weight it 75-25

Plot(MA(CumAD ,period), "CumAD " + index + " MA(" + NumToStr(period, 
2.0 ) + ") ", colorBlue) ;	
Plot(CumAD , " Open-Close ", colorRed) ;	



--- In amibroker@xxxxxxxxxxxxxxx, "areehoi" <rhoierman@xxxx> wrote:
>
> Is anyone using the McClellan Index?  If so is it the one from the 
AB
> library? The formula there is:
> Graph0 = Cum( EMA( AdvIssues()-DecIssues(), 19 ) - EMA(
> AdvIssues()-DecIssues(), 39 ) );
> The "AdvIssues" and "DecIssues" is a defined AFL function. Where it
> gets this data is a mystery to me as I do not have this data in my
> database yet it will come up with a chart on some symbols and not 
on
> others (for example BHH yes IBM no).  What I'm looking for is a
> McClellan Oscillator or Summation index that can utilize the
> advance/decline issue data in your own database(NYSE or NASDAQ) and
> has a zero line showing the index over or below it.  I note some
> McClellan indicators multiply by 1000 (1000 is simply cosmetic so
> results are whole numbers instead of decimals).  If anyone has 
such a
> formula it would appreciated if you could send to me or post. 
Thanks.
> 
> Dick H
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/