For those who track, use, and rely on the McClellan Oscillator for identifying over-sold conditions....
I made this script, to take the MOSC (aka NYMO), and allowing for a variety of user-defined parameters.. for visualizing it without taking up the lower-study area screen real estate.
This study is intended to alert you when the NYMO reaches a user-defined 'oversold' or 'overbought' level, and it also has a second threshold for when you consider it truly overbought or oversold.
The user-defined features allow you to determine if the labels are displayed regardless of symbol, or, only for symbols that are relevant to the NYMO calculations (ie; SPX, SPY, /ES, NDX, QQQ, /NQ).
You can show bubbles 'by the candle' or move the out of the way of the candles.
You can have it send an audible alert, or not.
I do intent to modify the script to determine if the symbol is SPX (related) or NDX related) and automatically change the exchange used in the NYMO calculation accordingly (instead of requiring the user to adjust it manually).
You get up pointing 'Green Arrows' indicating that the NYMO is at or well below the 'oversold' threshold. (implying, the low is deeply oversold and you should be looking up from here); or down pointing 'Red Arrows' indicating the NYMO is well 'overbought' and you should be careful with putting on too much risk.
You will get yellow up arrows or yellow down arrows.. as the 1st level of oversold or overbought conditions are met.
The ultimate form of this script would be for it to identify a divergence in price, relative to the direction of the NYMO; similar in fashion to an RSI Divergence; however, this seems to be rather difficult for ThinkScript to accomplish (for RSI, or NYMO).
Screen Capture Samples are attached.
The STANDARD McClellan Oscillator Study added to a 1y1d chart.
I lost too much screen real estate for something I only need to be aware of as it got close to being oversold, and then when it becomes oversold.
So I made my NYMO Extreme's Study to visualize the important details (for me) without losing a the screen space.
Then, I made it customizable... and intelligent.
Move the bubble (with the actual values of the NYMO out of the way of the candles.
Or... plot the bubbles close to the candles, but turn off the overbought conditions; since I'm more concerned with oversold conditions.
And.. Make it smart... so that, none of this appears on the screen, if the symbol is not relevant to the NYMO study itself.
But, if you want use it on a thumbnail... or zoomed in.. maybe you want to clean it up even more.
I made this script, to take the MOSC (aka NYMO), and allowing for a variety of user-defined parameters.. for visualizing it without taking up the lower-study area screen real estate.
This study is intended to alert you when the NYMO reaches a user-defined 'oversold' or 'overbought' level, and it also has a second threshold for when you consider it truly overbought or oversold.
The user-defined features allow you to determine if the labels are displayed regardless of symbol, or, only for symbols that are relevant to the NYMO calculations (ie; SPX, SPY, /ES, NDX, QQQ, /NQ).
You can show bubbles 'by the candle' or move the out of the way of the candles.
You can have it send an audible alert, or not.
I do intent to modify the script to determine if the symbol is SPX (related) or NDX related) and automatically change the exchange used in the NYMO calculation accordingly (instead of requiring the user to adjust it manually).
You get up pointing 'Green Arrows' indicating that the NYMO is at or well below the 'oversold' threshold. (implying, the low is deeply oversold and you should be looking up from here); or down pointing 'Red Arrows' indicating the NYMO is well 'overbought' and you should be careful with putting on too much risk.
You will get yellow up arrows or yellow down arrows.. as the 1st level of oversold or overbought conditions are met.
The ultimate form of this script would be for it to identify a divergence in price, relative to the direction of the NYMO; similar in fashion to an RSI Divergence; however, this seems to be rather difficult for ThinkScript to accomplish (for RSI, or NYMO).
Screen Capture Samples are attached.
The STANDARD McClellan Oscillator Study added to a 1y1d chart.
So I made my NYMO Extreme's Study to visualize the important details (for me) without losing a the screen space.
Then, I made it customizable... and intelligent.
Move the bubble (with the actual values of the NYMO out of the way of the candles.
Or... plot the bubbles close to the candles, but turn off the overbought conditions; since I'm more concerned with oversold conditions.
And.. Make it smart... so that, none of this appears on the screen, if the symbol is not relevant to the NYMO study itself.
But, if you want use it on a thumbnail... or zoomed in.. maybe you want to clean it up even more.
Code:
# Pope's NYMO Extremes with Symbol Filtering (V3.01) 2025-01-21
# Script that allows you to define 2 upside and 2 downside thresholds to provide arrows
# on your chart when the NYMO is approaching an oversold/overbought condition, and
# when it has arrived at an overbought/sold condition.
# Added label to be displayed in upper left corner of chart.
# Added logic to move the bubbles away from candles.
# Added logic to send a notification/audio or not.
# Added logic to filter arrows (tuned study off; if not SPX,SPY,/ES,NDX,QQQ,/NQ)
# Separated bubbles into overbought and oversold and made user defined.
input exchange = {default NYSE, NASDAQ, AMEX};
input fastLength = 19;
input slowLength = 39;
input ratioAdjusted = yes;
input approach_over_bought = 60;
input over_bought = 80;
input approach_over_sold = -60;
input over_sold = -80;
input arrow_offset = 2;
input bubble_by_candles = yes;
input show_overbought_bubbles = no;
input show_oversold_bubbles = yes;
input show_labels = yes;
input enableAudibleAlerts = no;
input filter_symbols = yes; # Enable/disable symbol filtering
# Define valid symbols based on the selected exchange
def isNYSE = exchange == exchange.NYSE and (GetSymbolPart(1) == "/ES:XCME" or GetSymbol() == "SPY" or GetSymbol() == "SPX");
def isNASDAQ = exchange == exchange.NASDAQ and (GetSymbolPart(1) == "/NQ:XCME" or GetSymbol() == "NDX" or GetSymbol() == "QQQ");
def isValidSymbol = isNYSE or isNASDAQ;
def symbolFilterCheck = (filter_symbols and isValidSymbol) or !filter_symbols;
# McClellan Oscillator Calculation
def McClellanOsc = reference McClellanSummationIndex(exchange = exchange, "fast length" = fastLength, "slow length" = slowLength, "ratio adjusted" = ratioAdjusted).mcClellanOsc;
def overboughtCondition1 = McClellanOsc >= approach_over_bought and McClellanOsc < over_bought;
def overboughtCondition2 = McClellanOsc >= over_bought;
def oversoldCondition1 = McClellanOsc <= approach_over_sold and McClellanOsc > over_sold;
def oversoldCondition2 = McClellanOsc <= over_sold;
def arrowPositionOverbought = HighestAll(high) - (arrow_offset * TickSize());
def arrowPositionOversold = LowestAll(low) + (arrow_offset * TickSize());
# Plotting Overbought and Oversold Arrows
plot overbought_yellow = if symbolFilterCheck and overboughtCondition1 then arrowPositionOverbought else Double.NaN;
plot overbought_red = if symbolFilterCheck and overboughtCondition2 then arrowPositionOverbought else Double.NaN;
plot oversold_yellow = if symbolFilterCheck and oversoldCondition1 then arrowPositionOversold else Double.NaN;
plot oversold_green = if symbolFilterCheck and oversoldCondition2 then arrowPositionOversold else Double.NaN;
overbought_yellow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
overbought_yellow.SetDefaultColor(Color.YELLOW);
overbought_red.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
overbought_red.SetDefaultColor(Color.RED);
oversold_yellow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
oversold_yellow.SetDefaultColor(Color.YELLOW);
oversold_green.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
oversold_green.SetDefaultColor(Color.GREEN);
# Bubble Logic
def bubbleOverboughtPosition = if bubble_by_candles then high - arrow_offset + 3 else HighestAll(high) + arrow_offset + 3 ;
def bubbleOversoldPosition = if bubble_by_candles then low - arrow_offset - 3 else LowestAll(low) - arrow_offset - 3;
AddChartBubble(symbolFilterCheck and show_overbought_bubbles and overboughtCondition1, bubbleOverboughtPosition, "NYMO " + ROUND(McClellanOsc, 1), Color.YELLOW, yes);
AddChartBubble(symbolFilterCheck and show_overbought_bubbles and overboughtCondition2, bubbleOverboughtPosition + 3, "NYMO " + ROUND(McClellanOsc, 1), Color.RED, yes);
AddChartBubble(symbolFilterCheck and show_oversold_bubbles and oversoldCondition1, bubbleOversoldPosition, "NYMO " + ROUND(McClellanOsc, 1), Color.YELLOW, no);
AddChartBubble(symbolFilterCheck and show_oversold_bubbles and oversoldCondition2, bubbleOversoldPosition - 3, "NYMO " + ROUND(McClellanOsc, 1), Color.GREEN, no);
# Label Logic
AddLabel(symbolFilterCheck and show_labels and overboughtCondition1, "NYMO at " + ROUND(McClellanOsc, 1), Color.YELLOW);
AddLabel(symbolFilterCheck and show_labels and overboughtCondition2, "NYMO at " + ROUND(McClellanOsc, 1) + " Extreme", Color.RED);
AddLabel(symbolFilterCheck and show_labels and oversoldCondition1, "NYMO " + ROUND(McClellanOsc, 1), Color.YELLOW);
AddLabel(symbolFilterCheck and show_labels and oversoldCondition2, "NYMO " + ROUND(McClellanOsc, 1) + " Extreme", Color.GREEN);
# Alert Logic
Alert(enableAudibleAlerts and symbolFilterCheck and overboughtCondition1, "NYMO > " + ROUND(McClellanOsc, 1), Alert.BAR, Sound.Bell);
Alert(enableAudibleAlerts and symbolFilterCheck and overboughtCondition2, "NYMO > " + ROUND(McClellanOsc, 1) + " Extreme", Alert.BAR, Sound.Chimes);
Alert(enableAudibleAlerts and symbolFilterCheck and oversoldCondition1, "NYMO < " + ROUND(McClellanOsc, 1), Alert.BAR, Sound.Bell);
Alert(enableAudibleAlerts and symbolFilterCheck and oversoldCondition2, "NYMO < " + ROUND(McClellanOsc, 1) + " Extreme", Alert.BAR, Sound.Chimes);
Last edited: