About McClellan Oscillator
Developed by Sherman and Marian McClellan, the 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 .
McClellan Oscillator signals can be generated with breadth thrusts, centerline crossovers, overall levels and divergences.
About my version
This version here is a modification, though:
- It can only be used on the DAX index (DAX 30 or GER 30)
- It only considers the DAX 30 stocks
- The data window will provide a summary about rising and declining stocks
- The data window will output the last change for each of the 30 stocks
BUG
I am only publishing this version because I am not sure if my current version is saved when I leave tradingview.com without publishing the script.
This version still contains a bug - the if/else clauses do not correctly recognize declining stocks. So the oscillator should not be used as it is.
Working on it these days. Feel free to provide feedback!
Stuff I am working on
- Coloring the area green/red according to the value
- Fixing this bug/making this script more efficient
DISCLAIMER
This script was mainly written for educational purposes (training myself how to write custom indicatotors).
As you can see, the code is really messy.
Credits
Based on the simple version of aftabmk
You can find the original version by searching for McClellan Oscillator for nifty 50.