52-week Highs/Lows For ThinkOrSwim

Try this chart out...
Code:
# 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 2015

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":
P = NASDQH / (NASDQH + NASDQL) * 100;
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;
data.EnableApproximation();
data.SetDefaultColor(Color.Cyan);
plot avg = MovingAverage(AvgType, data, length);
avg.EnableApproximation();
avg.AssignValueColor(if between(avg, OverSold, OverBought)
                     then Color.yellow
                     else if avg >= OverBought
                          then Color.Green
                          else Color.Red);
avg.SetLineWeight(2);
plot OB = if isNaN(close) then double.nan else OverBought;
OB.SetDefaultColor(Color.Red);
plot OS = if isNaN(close) then double.nan else OverSold;
OS.SetDefaultColor(Color.Green);
plot neutral = if isNaN(close) then double.nan else 50;
neutral.SetdefaultColor(Color.Dark_Gray);
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
2t1VzHB.png


Those are built in columns already in both the scanner and the watchlist.
how do i use this indicator and put in my tos? i am a new tos user
i can use this code for tradingview too
 
Last edited by a moderator:
Hi there. I'm trying to scan for stocks that are 70% or more above their 52 week low....It's easy to scan for stocks within x% of their highs or lows but stocks above lows seem to be a little bit trickier for me to accomplish. Is there a custom filter I should be using? Thanks for the help....
 
I would try something like

close(“period” = AggregationPeriod.DAY) / Lowest(“data” = CLOSE, “length” = 250) is greater than 1.7
 
Hey Everyone,

Looking to add a watchlist column that shows the %change from 52 week high and 52 week low. They can be separate columns would be great if you could color code it if it is within 5% of the high or low then it is red text. Outside of that it is green text. Any ideas on the script to do this? Could be a really great indicator for all.

Thanks!

Ryan
 
Looking to add a watchlist column that shows the %change from 52 week high and 52 week low.


column study
z52weekhilo
http://tos.mx/mXTP2OD

calc the $ range between highest and lowest
figure this range as , 0% (low) to 100% (high)
display a % number, to indicate where close is, within the hi-lo range

added a leading 0 , so numbers < 10 sort correctly

there are 2 output code sections
# 1st output is colored font
# add a # in front of code lines in section #2 to disable them

# 2nd output is colored background
# add a # in front of code lines in section #1 to disable them


Ruby:
# z52weekhilo

#  set column time = week

# calc the $ range between highest and lowest
# figure this range as , 0% (low) to 100% (high)
# display a % number, to indicate where close is, within the hi-lo range
#   0% = lowest , 100% = highest

def rounding = 0;
def len = 52;
def whi = highest(high, 52);
def wlo = lowest(low, 52);
def rng = whi - wlo;

def per = round(100 * (close - wlo) / rng, rounding);

def lowerlimit = 5;
def upperlimit = 100 - lowerlimit;

#----------------------------------------
# 1st output scheme
# red or green font and black background

#addlabel(1, (if per < 10 then "0" else "") + per + " %", (if (per <= lowerlimit or per >= upperlimit) then color.red else color.green));

#----------------------------------------

# 2nd output scheme
# black font and colored background

addlabel(1, (if per < 10 then "0" else "") + per + " %", color.black);
assignBackgroundColor( if (per <= lowerlimit or per >= upperlimit) then color.red else color.green);

#----------------------------------------

# test label
#addlabel(1, whi + "|" + wlo + "|" + per, color.white);
#


font colored, red or green
added a leading 0 , so numbers < 10 sort correctly
TmrmoUt.jpg



background colored
0kTr3uB.jpg
 
Last edited:
column study
z52weekhilo
http://tos.mx/mXTP2OD

calc the $ range between highest and lowest
figure this range as , 0% (low) to 100% (high)
display a % number, to indicate where close is, within the hi-lo range

added a leading 0 , so numbers < 10 sort correctly

there are 2 output code sections
# 1st output is colored font
# add a # in front of code lines in section #2 to disable them

# 2nd output is colored background
# add a # in front of code lines in section #1 to disable them


Ruby:
# z52weekhilo

#  set column time = week

# calc the $ range between highest and lowest
# figure this range as , 0% (low) to 100% (high)
# display a % number, to indicate where close is, within the hi-lo range
#   0% = lowest , 100% = highest

def rounding = 0;
def len = 52;
def whi = highest(high, 52);
def wlo = lowest(low, 52);
def rng = whi - wlo;

def per = round(100 * (close - wlo) / rng, rounding);

def lowerlimit = 5;
def upperlimit = 100 - lowerlimit;

#----------------------------------------
# 1st output scheme
# red or green font and black background

#addlabel(1, (if per < 10 then "0" else "") + per + " %", (if (per <= lowerlimit or per >= upperlimit) then color.red else color.green));

#----------------------------------------

# 2nd output scheme
# black font and colored background

addlabel(1, (if per < 10 then "0" else "") + per + " %", color.black);
assignBackgroundColor( if (per <= lowerlimit or per >= upperlimit) then color.red else color.green);

#----------------------------------------

# test label
#addlabel(1, whi + "|" + wlo + "|" + per, color.white);
#


font colored, red or green
added a leading 0 , so numbers < 10 sort correctly
TmrmoUt.jpg



background colored
0kTr3uB.jpg
Thank you! This is almost it. I'm trying to make it show me the % difference from the 52 week high or low. So if it is over 5% or 10% difference from the high or low it would be green. If it was in that range it would be red.

This is really good for making sure you aren't trading stocks that could pop or drop below these ranges if you don't want to get caught. What modifications could be done to the code to make this work. I did this in a google sheets form
 
Thank you! This is almost it. I'm trying to make it show me the % difference from the 52 week high or low. So if it is over 5% or 10% difference from the high or low it would be green. If it was in that range it would be red.

This is really good for making sure you aren't trading stocks that could pop or drop below these ranges if you don't want to get caught. What modifications could be done to the code to make this work. I did this in a google sheets form


if the stock is high priced and the highest and lowest are close together,
it is possible for the close to be within 5% of the lowest and within 5% of the highest, at the same time.

i made the 1st version based on a % of the range between the highest to lowest, to avoid that.


here is a version, based on a % of the lowest price and highest price, over 52 weeks.
if close is within the % of the highest and lowest, the font will be yellow.


column study

Ruby:
# z52weekhilo2

#  set column time = week

def rounding = 1;
def len = 52;
def whi = highest(high, 52);
def wlo = lowest(low, 52);

#----------------------------------------

input max_percent_diff = 5;

def per_fromhi = round(100 * (whi - close) / whi, rounding);
def per_fromlo = round(100 * (close - wlo) / wlo, rounding);

def nearhi = ( per_fromhi <= max_percent_diff);
def nearlo = ( per_fromlo <= max_percent_diff);


#----------------------------------------
# 1st output scheme
# red or green font and black background

addlabel(1,
( if nearhi and nearlo then "both " + max_percent_diff + "%"
else if nearhi then "HI " + (if per_fromhi < 10 then "0" else "") + per_fromhi + "%"
else if nearlo then "LO " + (if per_fromlo < 10 then "0" else "") + per_fromlo + "%"
else "--")
, ( if nearhi and nearlo then color.yellow
else if nearhi or nearlo then color.red
else color.green)
);

#----------------------------------------
# 2nd output scheme
# black font and colored background

addlabel(0,
( if nearhi and nearlo then "both " + max_percent_diff + "%"
else if nearhi then "HI " + (if per_fromhi < 10 then "0" else "") + per_fromhi + "%"
else if nearlo then "LO " + (if per_fromlo < 10 then "0" else "") + per_fromlo + "%"
else "--")
, color.black );

#assignBackgroundColor( if nearhi and nearlo then color.yellow else if nearhi or nearlo then color.red else color.green );

#----------------------------------------
#

i added the words , Hi or LO , to identify which level close is near
jDQxIRr.jpg
 
Last edited:
if the stock is high priced and the highest and lowest are close together,
it is possible for the close to be within 5% of the lowest and within 5% of the highest, at the same time.

i made the 1st version based on a % of the range between the highest to lowest, to avoid that.


here is a version, based on a % of the lowest price and highest price, over 52 weeks.
if close is within the % of the highest and lowest, the font will be yellow.


column study

Ruby:
# z52weekhilo2

#  set column time = week

def rounding = 1;
def len = 52;
def whi = highest(high, 52);
def wlo = lowest(low, 52);

#----------------------------------------

input max_percent_diff = 5;

def per_fromhi = round(100 * (whi - close) / whi, rounding);
def per_fromlo = round(100 * (close - wlo) / wlo, rounding);

def nearhi = ( per_fromhi <= max_percent_diff);
def nearlo = ( per_fromlo <= max_percent_diff);


#----------------------------------------
# 1st output scheme
# red or green font and black background

addlabel(1,
( if nearhi and nearlo then "both " + max_percent_diff + "%"
else if nearhi then "HI " + (if per_fromhi < 10 then "0" else "") + per_fromhi + "%"
else if nearlo then "LO " + (if per_fromlo < 10 then "0" else "") + per_fromlo + "%"
else "--")
, ( if nearhi and nearlo then color.yellow
else if nearhi or nearlo then color.red
else color.green)
);

#----------------------------------------
# 2nd output scheme
# black font and colored background

addlabel(0,
( if nearhi and nearlo then "both " + max_percent_diff + "%"
else if nearhi then "HI " + (if per_fromhi < 10 then "0" else "") + per_fromhi + "%"
else if nearlo then "LO " + (if per_fromlo < 10 then "0" else "") + per_fromlo + "%"
else "--")
, color.black );

#assignBackgroundColor( if nearhi and nearlo then color.yellow else if nearhi or nearlo then color.red else color.green );

#----------------------------------------
#

i added the words , Hi or LO , to identify which level close is near
jDQxIRr.jpg

Ahh I see! Well done dude! Thank you very much. Would be nice if they were combined in a way you know like if the % was shown if it wasn't in the Hi, Lo 5% but showed the Red if it was. Is there a way to combine them. Really appreciate it. Helps out a lot for screening! Since you are so good at it do you know of a way to make the P/L colors Red or Green in the monitor/positions section? I haven't been able to get a straight answer on this.
 
Ahh I see! Well done dude! Thank you very much. Would be nice if they were combined in a way you know like if the % was shown if it wasn't in the Hi, Lo 5% but showed the Red if it was. Is there a way to combine them. Really appreciate it. Helps out a lot for screening! Since you are so good at it do you know of a way to make the P/L colors Red or Green in the monitor/positions section? I haven't been able to get a straight answer on this.
oops, i guess i overlooked that, not showing all the %...
looking at it


i added the missing green % numbers
moved HI and LO to be after the % numbers, so the numbers sort.
i actually added an input that controls if HI and LO are displayed. default is no.
since it is a column study, you have to edit the code, to change inputs.
change this code line to = yes, to display the words after the numbers.
input show_hi_lo = no;

Code:
# z52weekhilo3

#  set column time = week

# watchlist column that shows the %change from 52 week high and 52 week low. 

# calc the $ range between highest and lowest
# figure this range as , 0% (low) to 100% (high)
# display a % number, to indicate where close is, within the hi-lo range
#   0% = lowest , 100% = highest

def rounding = 1;
def len = 52;
def whi = highest(high, 52);
def wlo = lowest(low, 52);

#----------------------------------------

input max_percent_diff = 5;

def per_fromhi = round(100 * (whi - close) / whi, rounding);
def per_fromlo = round(100 * (close - wlo) / wlo, rounding);

# find lowest % 
def min_per = min(per_fromhi, per_fromlo);

def nearhi = ( per_fromhi <= max_percent_diff);
def nearlo = ( per_fromlo <= max_percent_diff);


#----------------------------------------
# 1st output scheme
# red or green font and black background

input show_hi_lo = no;


addlabel(1, 
( if nearhi and nearlo then "both " + max_percent_diff + "%"
else if nearhi then (if per_fromhi < 10 then "0" else "") + per_fromhi + "%" + (if show_hi_lo then " HI" else "")
else if nearlo then (if per_fromlo < 10 then "0" else "") + per_fromlo + "%" + (if show_hi_lo then " LO" else "")
else (if min_per < 10 then "0" else "") + min_per + "%")

, ( if nearhi and nearlo then color.yellow
else if nearhi or nearlo then color.red
else color.green)
);

#----------------------------------------
# 2nd output scheme
# black font and colored background

addlabel(0,  
( if nearhi and nearlo then "both " + max_percent_diff + "%"
else if nearhi then (if per_fromhi < 10 then "0" else "") + per_fromhi + "%" + (if show_hi_lo then " HI" else "")
else if nearlo then (if per_fromlo < 10 then "0" else "") + per_fromlo + "%" + (if show_hi_lo then " LO" else "")
else (if min_per < 10 then "0" else "") + min_per + "%")
, color.black );

#assignBackgroundColor( if nearhi and nearlo then color.yellow else if nearhi or nearlo then color.red else color.green );
#

with HI LO
4gJyVzQ.jpg


without HI LO
ubRr0Tp.jpg
 
Last edited:
oops, i guess i overlooked that, not showing all the %...
looking at it


i added the missing green % numbers
moved HI and LO to be after the % numbers, so the numbers sort.
i actually added an input that controls if HI and LO are displayed. default is no.
since it is a column study, you have to edit the code, to change inputs.
change this code line to = yes, to display the words after the numbers.
input show_hi_lo = no;

Code:
# z52weekhilo3

#  set column time = week

# watchlist column that shows the %change from 52 week high and 52 week low.

# calc the $ range between highest and lowest
# figure this range as , 0% (low) to 100% (high)
# display a % number, to indicate where close is, within the hi-lo range
#   0% = lowest , 100% = highest

def rounding = 1;
def len = 52;
def whi = highest(high, 52);
def wlo = lowest(low, 52);

#----------------------------------------

input max_percent_diff = 5;

def per_fromhi = round(100 * (whi - close) / whi, rounding);
def per_fromlo = round(100 * (close - wlo) / wlo, rounding);

# find lowest %
def min_per = min(per_fromhi, per_fromlo);

def nearhi = ( per_fromhi <= max_percent_diff);
def nearlo = ( per_fromlo <= max_percent_diff);


#----------------------------------------
# 1st output scheme
# red or green font and black background

input show_hi_lo = no;


addlabel(1,
( if nearhi and nearlo then "both " + max_percent_diff + "%"
else if nearhi then (if per_fromhi < 10 then "0" else "") + per_fromhi + "%" + (if show_hi_lo then " HI" else "")
else if nearlo then (if per_fromlo < 10 then "0" else "") + per_fromlo + "%" + (if show_hi_lo then " LO" else "")
else (if min_per < 10 then "0" else "") + min_per + "%")

, ( if nearhi and nearlo then color.yellow
else if nearhi or nearlo then color.red
else color.green)
);

#----------------------------------------
# 2nd output scheme
# black font and colored background

addlabel(0, 
( if nearhi and nearlo then "both " + max_percent_diff + "%"
else if nearhi then (if per_fromhi < 10 then "0" else "") + per_fromhi + "%" + (if show_hi_lo then " HI" else "")
else if nearlo then (if per_fromlo < 10 then "0" else "") + per_fromlo + "%" + (if show_hi_lo then " LO" else "")
else (if min_per < 10 then "0" else "") + min_per + "%")
, color.black );

#assignBackgroundColor( if nearhi and nearlo then color.yellow else if nearhi or nearlo then color.red else color.green );
#

with HI LO
4gJyVzQ.jpg


without HI LO
ubRr0Tp.jpg
Great Job! Thank you so much!
 
I can't figure out how to create a pristine scanner for this info: Looking at creating a scanner that searches for tickers within 10% of their 52 week high within the past 14 days. Unsure how to specify the second time frame. Any ideas?
Thanks!
 
I can't figure out how to create a pristine scanner for this info: Looking at creating a scanner that searches for tickers within 10% of their 52 week high within the past 14 days. Unsure how to specify the second time frame. Any ideas?
Thanks!

could use the approx trading days in a year, 252.
set scan time to day.

Code:
def yr_hi = highest(high, 252);
def limit_per = 10;
def limit_level =  ( yr_hi * ( 1 - ( limit_per/100))) ;
def isabovelvl = if (close > limit_level) then 1 else 0;
def days_back = 14;
plot z = if sum(isabovelvl, days_back) >= 1 then 1 else 0;
 
I am looking for a thinkscript that will plot an indicator when a stock price hits all time high in past 12 months period.
Can someone point me to it or tell me if such script exists?
 
I am looking for a thinkscript that will plot an indicator when a stock price hits all time high in past 12 months period.
Can someone point me to it or tell me if such script exists?
Here you will find 9 pages of high / lows. Plug & Play until you find the one that works for you.
 
Try this chart out...
Code:
# 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 2015

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":
P = NASDQH / (NASDQH + NASDQL) * 100;
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;
data.EnableApproximation();
data.SetDefaultColor(Color.Cyan);
plot avg = MovingAverage(AvgType, data, length);
avg.EnableApproximation();
avg.AssignValueColor(if between(avg, OverSold, OverBought)
                     then Color.yellow
                     else if avg >= OverBought
                          then Color.Green
                          else Color.Red);
avg.SetLineWeight(2);
plot OB = if isNaN(close) then double.nan else OverBought;
OB.SetDefaultColor(Color.Red);
plot OS = if isNaN(close) then double.nan else OverSold;
OS.SetDefaultColor(Color.Green);
plot neutral = if isNaN(close) then double.nan else 50;
neutral.SetdefaultColor(Color.Dark_Gray);
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
2t1VzHB.png


Those are built in columns already in both the scanner and the watchlist.
What are main differences between this market indicator and McClellan Oscillator?
 
Try this chart out...
Code:
# 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 2015

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":
P = NASDQH / (NASDQH + NASDQL) * 100;
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;
data.EnableApproximation();
data.SetDefaultColor(Color.Cyan);
plot avg = MovingAverage(AvgType, data, length);
avg.EnableApproximation();
avg.AssignValueColor(if between(avg, OverSold, OverBought)
                     then Color.yellow
                     else if avg >= OverBought
                          then Color.Green
                          else Color.Red);
avg.SetLineWeight(2);
plot OB = if isNaN(close) then double.nan else OverBought;
OB.SetDefaultColor(Color.Red);
plot OS = if isNaN(close) then double.nan else OverSold;
OS.SetDefaultColor(Color.Green);
plot neutral = if isNaN(close) then double.nan else 50;
neutral.SetdefaultColor(Color.Dark_Gray);
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
2t1VzHB.png


Those are built in columns already in both the scanner and the watchlist.

This is an interesting indicator, but how to use it, please?
 
What are main differences between this market indicator and McClellan Oscillator?
Breath indicators are all similar:
https://www.marketinout.com/chart/market.php?breadth=new-highs-new-lows

This is an interesting indicator, but how to use it, please?

per the OP:
It is a technical indicator used by some traders and investors who view the 52-week high or low as an important factor in determining a stock's current value and predicting future price movement.
 
Try this chart out...
Code:
# 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 2015

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":
P = NASDQH / (NASDQH + NASDQL) * 100;
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;
data.EnableApproximation();
data.SetDefaultColor(Color.Cyan);
plot avg = MovingAverage(AvgType, data, length);
avg.EnableApproximation();
avg.AssignValueColor(if between(avg, OverSold, OverBought)
                     then Color.yellow
                     else if avg >= OverBought
                          then Color.Green
                          else Color.Red);
avg.SetLineWeight(2);
plot OB = if isNaN(close) then double.nan else OverBought;
OB.SetDefaultColor(Color.Red);
plot OS = if isNaN(close) then double.nan else OverSold;
OS.SetDefaultColor(Color.Green);
plot neutral = if isNaN(close) then double.nan else 50;
neutral.SetdefaultColor(Color.Dark_Gray);
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
2t1VzHB.png


Those are built in columns already in both the scanner and the watchlist.
I loaded this study however it shows the red and green bars but not the graph lines. I am in pre market but have not seen anything that would make a difference, any idea what's wrong. Thx in advance
 
I loaded this study however it shows the red and green bars but not the graph lines. I am in pre market but have not seen anything that would make a difference, any idea what's wrong. Thx in advance
This indicator uses a daily aggregation.
Premarket is just a segment of a day so can't use a daily aggregation. Only intraday indicators work in extended hours.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Thread starter Similar threads Forum Replies Date
inthefutures New Intraday Highs and Lows For ThinkOrSwim Indicators 0

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
356 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top