The McClellan Oscillator is a market breadth indicator developed by Sherman and Marian McClellan.
It is calculated from Net Advances, which is the number of advancing issues minus 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.
The McClellan Oscillator can be traded with breadth thrusts, centerline crossovers and divergences.
The original code was written by LazyBear - I just modified it to add together all advancing and declining issues from all stock exchanges (NYSE + NASDAQ + others), to make it available on the hourly time frame and also add alerts.