Scripting Example - McClellan Oscillator

The McClellan Oscillator was developed by Sherman and Marian McClellan. Based on breadth data (NYSE Advance and NYSE Decline) and exponential Moving Averages the indicator can be setup in Optuma using scripting.

Use the following script with a Show View tool. (Note: To use the script you must have Optuma’s Breadth Measures data exchange.)

//Source Data for NYSE Advance and Declines
D1 = GETDATA(CODE=ADVNYSE:BM);
D2 = GETDATA(CODE=DECNYSE:BM);
//Setup 19EMAs on AD Codes
A1 = MA(D1, BARS=19, STYLE=Exponential);
A2 = MA(D2, BARS=19, STYLE=Exponential);
//Setup 39EMAs on AD Codes
A3 = MA(D1, BARS=39, STYLE=Exponential);
A4 = MA(D2, BARS=39, STYLE=Exponential);

(A1 - A2) - (A3 - A4)

 

The final result will look like this:

Ex1

To create the McClellan Summation Index use the ACC() function with the formula above, as per this example for the SPX advance/declines:

//Source Data for SPX Advance and Declines
D1 = GETDATA(CODE=ADVSPX:BM);
D2 = GETDATA(CODE=DECSPX:BM);
//Setup 19EMAs on AD Codes
A1 = MA(D1, BARS=19, STYLE=Exponential);
A2 = MA(D2, BARS=19, STYLE=Exponential);
//Setup 39EMAs on AD Codes
A3 = MA(D1, BARS=39, STYLE=Exponential);
A4 = MA(D2, BARS=39, STYLE=Exponential);

MO=(A1 - A2) - (A3 - A4);
ACC(MO)

Capture