Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Building GenAI Applications. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

Configure McClellan Oscillator for Nifty in Amibroker using AUX1 and AUX2 parameters

1 min read

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.


[wp_ad_camp_5]

 
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

Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Building GenAI Applications. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

Fisher Transform – Amibroker AFL Code

The Fisher Transform is a technical analysis indicator developed by John F. Ehlers, designed to identify potential turning points in the price movements of...
Rajandran R
2 min read

My Experience Converting SSL Hybrid from PineScript to Amibroker…

As a trader and coding enthusiast, I often find myself needing to translate trading indicators from one programming language to another. Recently, I embarked...
Rajandran R
8 min read

Line Trading – OpenAlgo Automation Module for Amibroker Users

The line Trading Automation tool is designed for Manual traders who want to perform level-based trade execution faster and also bring some advanced trade...
Rajandran R
59 sec read

29 Replies to “Configure McClellan Oscillator for Nifty in Amibroker using AUX1…”

  1. 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.

  2. 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;

    1. 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);

  3. @ 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:)

  4. 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

  5. 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

  6. 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?

  7. 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

  8. 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

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

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More