This Tutorial Explains how to use AUX1 and AUX2 parameters in Amibroker Configure and Plot McClellan Oscillator for Nifty

**McClellan Oscillator** is a breadth indicator derived from Net Advances, the number of advancing issues less the number of declining issues. Subtracting the 39-day exponential moving average of Net Advances from the 19-day exponential moving average of Net Advances forms the oscillator. As the formula reveals, the McClellan Oscillator is a momentum indicator that works similar to MACD.

The formula to calculate the oscillator:

McClellan Oscillator = (EMA1 of [(Advancing Issues – Declining Issues)/total Issues] – EMA2 of [(Advancing Issues – Declining Issues)/total issues]) * 1000

**This is the step by step procedure about how to configure McClellan Oscillator for Nifty in Amibroker using Aux1 and Aux2 parameters**

**Preparation of the database**

1)Now to build the Mcclellan Oscillator we need database in the following format Date,Open,High,Low,Close,Advance,Declines,Volume as shown below

2) ADVANCE, DECLINES values for the NSE which can be downloaded from the nseindia website http://nseindia.com/content/equities/eq_advdeclines.htm for the older months starting from Jan 2010-Oct 2010. For Nov 2010-till date Advance-Declines can be obtained from Data Downloader software from volume digger

3)Nifty Historical data can be downloaded from the nseindia portal. Now we need to comine those historical data of nifty and advance and decline values as shown in the above sample format

4)After merging save the file as **Nifty Breadth.csv** and save in your local diskspace

5)Open Amibroker->Goto File Menu->New->Database and create a new database

6)Now from File Menu-> Import wizard – > Pick Files to set the database format. Select the the **Nifty Breadth.csv** file and configure the format

as shown below

Dont forget to note the Aux1 and Aux2 variables included in the format. Only Amibroker 5.3 and higher version supports auxillary variables. **Here aux1 = advance and aux2 = decline**

7)After importing we need to write a afl code in Amibroker for the above mentioned formula

**To simplify the McClellan Oscillator calculation – the formula could be split into 5 steps:**

1)Calculate (Advances – Declines) / (Advances + Declines)

2)Calculate fast exponential moving average (EMA1) of what you receive from #1

3)Calculate slow exponential moving average (EMA2) of what you receive from #1

4)#3 result subtract from #4 result

5)Multiply by 1000 (to work with whole numbers)

Which can be coded in amibroker as

_SECTION_BEGIN(“McClellan”);

SetChartOptions(0,chartShowArrows|chartShowDates);

ratio = (Aux1-Aux2)/(Aux1+Aux2);

Value = EMA(ratio,19)-EMA(ratio,39);

McClellanOsc = Value*1000;

Plot( McClellanOsc,”McClellan Oscillator =”,colorGreen );

_SECTION_END();

where aux1=advance and aux2=decline

Download MCCellan Oscillator for Amibroker

Now the charts are plotted against Nifty as shown on the top of the post. Thanks Madhav and Priya for providing inputs to configure MCCellan Oscillator for Amibroker

**Cheers!
Rajandran R**

Dear Sir,

Please refer http://www.trendsignal.co.uk and http://www.trendsignal.usa and find one of the advanced moving average called Vector Moving average used in their software.I send the math formula for VMA to your mail. If you can understand the VMA and provide the afl code for amibroker. Let me to know about the meaning of the VMA and let me to try for the afl code.

Thank you.

Please refer the above message

I can’t able to find your email.

please check the following link for the math formula

http://www.mathworks.com/help/toolbox/econ/brzyk8h-1.html

Pl refer my previous messages also

Please also check vector average

Thanks very much raj. Delighted ðŸ™‚

Thanks Raj Did with Pretty ease as usual :p

@Santhanam : Will look into it.

@Madhav and Priya : Without you people McClellan Osc for Nifty woudnt be achieved

Dear sir,

Thanks for your response on vector average.

And please help me in coding afl for fisher transform in Ninja trader.

Partly it is as follows. But I don’t know how to get that Prev FTF val.

Help me.

Period = Param(“Period”, 10, 2, 200, 1 );

minLo = LLV(C, Period);

maxHi = HHV(C, Period);

num1 = maxHi – minLo;

FTFval= 0.66 * ((C- minLo) / num1 – 0.5) + 0.67 * prev FTFval;

eriod = Param(“Period”, 10, 2, 200, 1 );

minLo = LLV(C, Period);

maxHi = HHV(C, Period);

num1 = maxHi -minLo;

pFTFval= 0.66 * ((C- minLo) / num1 – 0.5) ;

FTFVal= PFTFVal + (0.67 * Ref(pFTFval,-1));

Plot(FTFval,””,colorGreen);

@santanam

Iam just a month old with Ninja Trader platform. Still have to explore much before having hands on coding.

@ Rajandran R @ priya @madhav

first of all thankyou very much all for taking time and efforts to solve that how aux1/2 can be engaged in work. i really appreciate ur efforts and raj sir memory that he remembered my problem.

god bless u

regards

ankit:)

@ankit

Its all efforts of Raj

Dear Sir,

You have mistaken my request reg fisher transform

It is in the NINJA. I need afl code for Amibroker. I partly modified the fisher transform indicator in Ninja as above to amibroker afl. I want to complete it for amibroker

@santhanam

Download the Fisher Transform AFL code

Check out the Snapshot of Fisher Transform. Heard that it is better than MACD. Check out the snapshot for Nifty

Check out the notes for Fisher transform – Using The Fisher Transform

Thank you Sri.

@Santhanam

you had made me the fan of fisher transform

Sir,

What about the vector average

@Santanam

Its still in my radar. Once it is completed you will see the coding in marketcalls here as a post

dear sir

can u help me regarding how i can get adv/dec issue vol for nse

if yes iwill b highly thankfull to u

McClellan Oscillator is indeed a deadly ossilator! Perhaps its the only one ossilator (to my knowledge) that can predict a ……

“Hindenburg Omen”

Speaking of which, Rajandran sir I was wondering, is there a way to predict a Hindenburg Omen in our nse or europe or usa market perhaps?

Hello Rajandran!

Could you tell me how to make the A/D line or A/D ratio show up in Amibroker? can we use EoD data for the same?

Thanks & regards

Yuv

Sir,

How can we plot AUX1 & AUX2 after the values are imported into Amibroker?

Sam

The above AFL shows syntax error?

AUX1 and AUX2 works only with amibroker 5.3 version and above. If you are using lesser version then it will throws

error.

I am using a higher version, so it should have worked.Please send me the AFL at [email protected], how to plot AUX1/ AUX2

If you need assistance email your queries with snapshot at [email protected] . Code is already test and it works good in 5.4, 5.5, .5.6 versions.

Dear sir,

Your site is simply superb, particularly your step by step explanation in using certain features of Amibroker and articles related to technical analysis. Kindly guide us in configuring McClellan Summation Index in Amibroker. You have already wrote regarding McClellan oscillator configuring which was much useful.

Thankyou

raj

i make new database as nse breadth beside nseeod but the chart not ploted.

pls. help

hi sir

how to download daily AUX1 and AUX2 daily

regds/kumar

Go thro the complete tutorial where you can import your external data to Aux1 and Aux2. To Download the AUX1 and AUX2 from the charts you need to use Export CSV from Amibroker with little modification in coding.