New High vs. New Low Index / Leading Indicator by Mobius for ThinkorSwim


Well-known member
The Chart below is of the Market Meltdown in January, 2016. It's hard to be Bearish on the Market as a whole when new highs are breaking out! This is a leading indicator.

#This indicator uses the Index New highs and Index New lows
#to help gauge overall Market sentiment. It's a leading indicator. 
# Index New High - New Low Indicator
# Mobius v2018-March from JQ's OneNote
#After loading, pull it to the upper chart!

declare lower;
input Symb = {default "NYSE", "NASDQ", "AMEX", "ARCA", "ETF"};
input length = 10;
input OverSold = 20;
input OverBought = 80;
Input AvgType = AverageType.Hull;

def agg = AggregationPeriod.Day;
def NYSEH  = close(Symbol = "$NYHGH", period = agg);
def NYSEL  = close(Symbol = "$NYLOW", period = agg);
def NASDQH = close(Symbol = "$NAHGH", period = agg);
def NASDQL = close(Symbol = "$NALOW", period = agg);
def AMEXH  = close(Symbol = "$AMHGH", period = agg);
def AMEXL  = close(Symbol = "$AMLOW", period = agg);
def ARCAH  = close(Symbol = "$ARHGH", period = agg);
def ARCAL  = close(Symbol = "$ARLOW", period = agg);
def ETFH   = close(Symbol = "$ETFHGH", period = agg);
def ETFL   = close(Symbol = "$ETFLOW", period = agg);
def P;
Switch (Symb){
case "NYSE":
P = NYSEH / (NYSEH + NYSEL) * 100;
case "NASDQ":
case "AMEX":
P = AMEXH / (AMEXH + AMEXL) * 100;
case "ARCA":
P = ARCAH / (ARCAH + ARCAL) * 100;
case "ETF":
P = ETFH / (ETFH + ETFL) * 100;
def price = if isNaN(P) then price[1] else P;
plot data = if isNaN(close) then double.nan else price;
plot avg = MovingAverage(AvgType, data, length);
avg.AssignValueColor(if between(avg, OverSold, OverBought)
                     then Color.yellow
                     else if avg >= OverBought
                          then Color.Green
                          else Color.Red);

plot OB = if isNaN(close) then double.nan else OverBought;

plot OS = if isNaN(close) then double.nan else OverSold;

plot neutral = if isNaN(close) then double.nan else 50;

addCloud(0, OS, CreateColor(250,0,0), CreateColor(250,0,0));
addCloud(OS, neutral, createColor(50,0,0), createColor(50,0,0));
addCloud(neutral, OB, createColor(0,50,0), createColor(0,50,0));
addCloud(OB, 100, CreateColor(0,250,0), createColor(0,250,0));

# End High - Low Index
Last edited by a moderator:


New member
Hello and thanks for sharing, I was looking around for a US total new High - New low indicator but could not find it on think or swim, my best approximation was to add up these TOS indicator in a rudimentary formula:
Which can be plotted in TOS but is not still represnting the full US new High - New lows

I would appreciate any leads on that



New member
Hi Markos,
Thank you very much for posting. I notice in the snapshot, you have SPY. Is there a way to put SPY in the study? Or do you recommend just using the SPY chart and using NYSE in your study?
Thank you,

Similar threads