ATR-Based Support & Resistance for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
Our research showed that securities usually stay in their ATR. It is about 4.8% days when security is goes out of ATR. So we are using this feature in our trading, when security is out of their 70% of ATR we are looking for signals to trade backward. This indicator could show you when bars are close to ATR.

By default, the indicator uses the "DAY" option. However, if you would like to play around with other timeframe aggregation, then you can do so from the indicator's setting. I found it interesting when applying the Monthly or OPT_EXP (aggregation period equal to option expiration) onto the Daily chart.

T4KVQhs.png

pz4G1gS.png


thinkScript Code

Code:
# ATR Grid (ATR-Based Support & Resistance)
# Assembled by BenTen and @diazlaz at useThinkScript.com
# Converted from https://www.tradingview.com/script/EDN4oFyQ-ATR-0-5-0-7-ranges/

input lvl1 = 0.5;
input lvl2 = 0.7;
input daily_atr_len = 15;

input length = 15;
input AggPeriod = AggregationPeriod.DAY;
input averageType = AverageType.WILDERS;

def h = high(GetSymbol(), period = AggPeriod)[1];
def c = close(GetSymbol(), period = AggPeriod)[1];
def l = low(GetSymbol(), period = AggPeriod)[1];

def atr_func = MovingAverage(averageType, TrueRange(h, c, l), length);
def day_atr = atr_func;
def day_close = c;

plot p1 = day_close + day_atr;
p1.assignValueColor(COLOR.DARK_RED);
p1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

plot p7 = day_close + day_atr * lvl2;
p7.assignValueColor(COLOR.RED);
AddCloud(p1, p7, COLOR.DARK_RED, COLOR.DARK_RED);
p7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

plot p5 = day_close + day_atr * lvl1;
p5.assignValueColor(COLOR.RED);
AddCloud(p7, p5, COLOR.RED, COLOR.RED);
p5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

plot m5 = day_close - day_atr * lvl1;
m5.assignValueColor(COLOR.GREEN);
#AddCloud(p7,p5,COLOR.GREEN, COLOR.GREEN);
m5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

plot m7 = day_close - day_atr * lvl2;
m7.assignValueColor(COLOR.GREEN);
AddCloud(m7, m5, COLOR.GREEN, COLOR.GREEN);
m7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

plot m1 = day_close - day_atr;
m1.assignValueColor(COLOR.DARK_GREEN);
AddCloud(m1, m7, COLOR.DARK_GREEN, COLOR.DARK_GREEN);
m1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
 
Last edited:

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

@john3 Correct. Ignore the input daily_atr_len. That was included by mistake. Use the regular length like you mentioned :)
 
Yes if 15 it would be a 15 period moving average. Red top plot is the close + ATR. Then it plots next lower lines at .7 and then .5 of that first close + ATR plot. Add clouds and that is it. Same for green plots just reversed.
 
def atr_func = MovingAverage(averageType, TrueRange(h, c, l), length);

That above doesn't seem to be a "real" Wilders ATR, but I'm not a coder, so apologies in advance if I'm wrong.

Does it use a 15-Day Moving Average as a base or is it based on a Daily range, Average True Range? I have a code for daily ATR and it seems to be different.

declare upper;

input ATRLength = 14;
input BasePeriod = AggregationPeriod.DAY;
input Displace = 0;

def dATR = Average(TrueRange(high(period = "DAY"), close(period = "DAY"), low(period = "DAY")));
plot SessionOpen = open(period = BasePeriod)[Displace];
def dATRa = dATR * Sqrt(BasePeriod / AggregationPeriod.DAY );

@horserider So it is based on a Daily ATR moving average (or 15 min ATR Moving Average if selected, etc), but the base isn't an ATR of a Daily range, right? The description, at least to me, sounds like it is based on an ATR of a Daily range.
 
input length = 15;
input averageType = AverageType.WILDERS;
def atr_func = MovingAverage(averageType, TrueRange(h, c, l), length);

ToS ATR below:
input length = 14;
input averageType = AverageType.WILDERS;
plot ATR = MovingAverage(averageType, TrueRange(high, close, low), length);

Looks like the same formula.

ATR is the Average True Range. So this is the wilders average of the True Range over 15 periods
 
I believe @horserider description is correct, Perhaps we can all spend some time looking at it further and backtest it. I will add it to my backlog and look at this again over the weekend.
 
I am using a monthly aggregation period on a daily chart, but am having trouble creating a scan between two. Does anyone know how to create a scan that works on differing aggregation periods and time frames?
 
Thanks @BenTen, this is one of the indicators i am looking for, it plots the Expected Move on weekly or when applying the OPT_EXP on the daily timeframe, it gives us the entire EM...it is really useful.... I am thinking what are the options strategy we can apply with this information provided....
 
@BenTen @Welkin @horserider Please take a look at this amazing pivot points indicator. It combines the floor trading and fibs pivot points plus mids and other levels. It plots the expected move on any given time frame. Try it on any time frame and you will see how accurate. Is there a way to color between the levels of support and resistance?
I use monthly pivots on day chart showing only R2, Mid2, R1 to Exit long trades.

Code:
# The Pivot Points Indicator Package

# Floor Trader’s Pivot Points
# Fibonacci Pivot Point
# What we have taken the original version which only calculates R1, R2, R3 and S1, S2, S3 and have added the following features:

# Additional Support/Resistance Levels of S4 and R4
# Option to Display Mid-Pivots
# Text Labels are Plotted Adjacent to Each Level for Quick Identification
# Visual and Audio Alerts for when Price Crosses any of the S/R Levels

input marketThreshold = 0.00;
input timeFrame = AggregationPeriod.DAY;
Input MidPlot = yes;
input showOnlyToday = no;
input showBubble = yes;
input ShiftBubble = 5;def n1 = ShiftBubble+1;

def PP2 = high(period = timeFrame)[2] + low(period = timeFrame)[2] + close(period = timeFrame)[2];

plot R4;
plot R3;
plot Mid3;
plot R2;
plot Mid2;
plot R1;
plot Mid1;
plot PP;
plot Mid_1;
plot S1;
plot Mid_2;
plot S2;
plot Mid_3;
plot S3;
plot S4;

if showOnlyToday and !IsNaN(close(period = timeFrame)[-1])
then {
R1 = Double.NaN;
R2 = Double.NaN;
R3 = Double.NaN;
R4 = Double.NaN;
PP = Double.NaN;
S1 = Double.NaN;
S2 = Double.NaN;
S3 = Double.NaN;
S4 = Double.NaN;
Mid1 = Double.NaN;
Mid2 = Double.NaN;
Mid3 = Double.NaN;
Mid_1 = Double.NaN;
Mid_2 = Double.NaN;
Mid_3 = Double.NaN; 

} else {

PP = (high(period = timeFrame)[1] + low(period = timeFrame)[1] + close(period = timeFrame)[1]) / 3;
#
R1 = 2 * PP - low(period = timeFrame)[1];
S1 = 2 * PP - high(period = timeFrame)[1];
#
MID1 = PP + ((R1 - PP) /2);
MID_1 = PP - ((PP - S1) /2);
#
R2 = PP + (High(period = timeFrame)[1] - Low(period = timeFrame) [1]);
S2 = PP - (High(period = timeFrame) [1] - Low(period = timeFrame) [1]);
#
MID2 = R1 + ((R2 - R1) /2);
MID_2 = S1 - ((S1 - S2) /2);
#
R3 = R2 + high(period = timeFrame)[1] - low(period = timeFrame)[1];
S3 = S2 - high(period = timeFrame)[1] + low(period = timeFrame)[1];
#
MID3 = R2 + ((R3 - R2) /2);
MID_3 = S2 - ((S2 - S3) /2);
#
R4 = R3 + high(period = timeFrame)[1] - low(period = timeFrame)[1];
S4 = S3 - high(period = timeFrame)[1] + low(period = timeFrame)[1];


}

PP.SetDefaultColor(GetColor(0));
R1.SetDefaultColor(Color.Red);
R2.SetDefaultColor(Color.Red);
R3.SetDefaultColor(Color.Red);
R4.SetDefaultColor(Color.Red);
S1.SetDefaultColor(Color.Yellow);
S2.SetDefaultColor(Color.Yellow);
S3.SetDefaultColor(Color.Yellow);
S4.SetDefaultColor(Color.Yellow);
Mid1.SetDefaultColor(GetColor(3));
Mid2.SetDefaultColor(GetColor(3));
Mid3.SetDefaultColor(GetColor(3));
Mid_1.SetDefaultColor(GetColor(3));
Mid_2.SetDefaultColor(GetColor(3));
Mid_3.SetDefaultColor(GetColor(3));

PP.SetStyle(Curve.firm);
R1.SetStyle(Curve.SHORT_DASH);
R2.SetStyle(Curve.SHORT_DASH);
R3.SetStyle(Curve.SHORT_DASH);
R4.SetStyle(Curve.SHORT_DASH);
S1.SetStyle(Curve.SHORT_DASH);
S2.SetStyle(Curve.SHORT_DASH);
S3.SetStyle(Curve.SHORT_DASH);
S4.SetStyle(Curve.SHORT_DASH);
Mid1.SetStyle(Curve.SHORT_DASH);
Mid2.SetStyle(Curve.SHORT_DASH);
Mid3.SetStyle(Curve.SHORT_DASH);
Mid_1.SetStyle(Curve.SHORT_DASH);
Mid_2.SetStyle(Curve.SHORT_DASH);
Mid_3.SetStyle(Curve.SHORT_DASH);

def paintingStrategy = if timeFrame == AggregationPeriod.WEEK then PaintingStrategy.DASHES else if timeFrame == AggregationPeriod.MONTH then PaintingStrategy.DASHES else PaintingStrategy.LINE_VS_POINTS;

PP.SetPaintingStrategy(PaintingStrategy.DASHES);
R1.SetPaintingStrategy(PaintingStrategy.DASHES);
R2.SetPaintingStrategy(PaintingStrategy.DASHES);
R3.SetPaintingStrategy(PaintingStrategy.DASHES);
R4.SetPaintingStrategy(PaintingStrategy.DASHES); 
S1.SetPaintingStrategy(PaintingStrategy.DASHES);
S2.SetPaintingStrategy(PaintingStrategy.DASHES);
S3.SetPaintingStrategy(PaintingStrategy.DASHES);
S4.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid1.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid2.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid3.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid_1.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid_2.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid_3.SetPaintingStrategy(PaintingStrategy.DASHES);

def cond = showBubble and isNaN(close[ShiftBubble]) and !isNaN(close[n1]) ;
AddChartBubble(cond,PP,Concat("PP: ",Round(PP)),color.magenta);
AddChartBubble(cond,R1,Concat("R1: ",Round(R1)),color.magenta);
AddChartBubble(cond,R2,Concat("R2: ",Round(R2)),color.magenta);
AddChartBubble(cond,R3,Concat("R3: ",Round(R3)),color.magenta);
AddChartBubble(cond,R4,Concat("R4: ",Round(R4)),color.magenta);
AddChartBubble(cond,S1,Concat("S1: ",Round(S1)),color.magenta);
AddChartBubble(cond,S2,Concat("S2: ",Round(S2)),color.magenta);
AddChartBubble(cond,S3,Concat("S3: ",Round(S3)),color.magenta);
AddChartBubble(cond,S4,Concat("S4: ",Round(S4)),color.magenta);
AddChartBubble(cond,Mid1,Concat("Mid1: ",Round(Mid1)),color.magenta);
AddChartBubble(cond,Mid2,Concat("Mid2: ",Round(Mid2)),color.magenta);
AddChartBubble(cond,Mid3,Concat("Mid3: ",Round(Mid3)),color.magenta);
AddChartBubble(cond,Mid_1,Concat("Mid_1: ",Round(Mid_1)),color.magenta);
AddChartBubble(cond,Mid_2,Concat("Mid_2: ",Round(Mid_2)),color.magenta);
AddChartBubble(cond,Mid_3,Concat("Mid_3: ",Round(Mid_3)),color.magenta);

Mid1.SetHiding (!MidPlot);
Mid2.SetHiding (!MidPlot);
Mid3.SetHiding (!MidPlot);
Mid_1.SetHiding (!MidPlot);
Mid_2.SetHiding (!MidPlot);
Mid_3.SetHiding (!MidPlot);

#####
 
@BenTen @Welkin @horserider Please take a look at this amazing pivot points indicator. It combines the floor trading and fibs pivot points plus mids and other levels. It plots the expected move on any given time frame. Try it on any time frame and you will see how accurate. Is there a way to color between the levels of support and resistance?
I use monthly pivots on day chart showing only R2, Mid2, R1 to Exit long trades.

Code:
# The Pivot Points Indicator Package

# Floor Trader’s Pivot Points
# Fibonacci Pivot Point
# What we have taken the original version which only calculates R1, R2, R3 and S1, S2, S3 and have added the following features:

# Additional Support/Resistance Levels of S4 and R4
# Option to Display Mid-Pivots
# Text Labels are Plotted Adjacent to Each Level for Quick Identification
# Visual and Audio Alerts for when Price Crosses any of the S/R Levels

input marketThreshold = 0.00;
input timeFrame = AggregationPeriod.DAY;
Input MidPlot = yes;
input showOnlyToday = no;
input showBubble = yes;
input ShiftBubble = 5;def n1 = ShiftBubble+1;

def PP2 = high(period = timeFrame)[2] + low(period = timeFrame)[2] + close(period = timeFrame)[2];

plot R4;
plot R3;
plot Mid3;
plot R2;
plot Mid2;
plot R1;
plot Mid1;
plot PP;
plot Mid_1;
plot S1;
plot Mid_2;
plot S2;
plot Mid_3;
plot S3;
plot S4;

if showOnlyToday and !IsNaN(close(period = timeFrame)[-1])
then {
R1 = Double.NaN;
R2 = Double.NaN;
R3 = Double.NaN;
R4 = Double.NaN;
PP = Double.NaN;
S1 = Double.NaN;
S2 = Double.NaN;
S3 = Double.NaN;
S4 = Double.NaN;
Mid1 = Double.NaN;
Mid2 = Double.NaN;
Mid3 = Double.NaN;
Mid_1 = Double.NaN;
Mid_2 = Double.NaN;
Mid_3 = Double.NaN;

} else {

PP = (high(period = timeFrame)[1] + low(period = timeFrame)[1] + close(period = timeFrame)[1]) / 3;
#
R1 = 2 * PP - low(period = timeFrame)[1];
S1 = 2 * PP - high(period = timeFrame)[1];
#
MID1 = PP + ((R1 - PP) /2);
MID_1 = PP - ((PP - S1) /2);
#
R2 = PP + (High(period = timeFrame)[1] - Low(period = timeFrame) [1]);
S2 = PP - (High(period = timeFrame) [1] - Low(period = timeFrame) [1]);
#
MID2 = R1 + ((R2 - R1) /2);
MID_2 = S1 - ((S1 - S2) /2);
#
R3 = R2 + high(period = timeFrame)[1] - low(period = timeFrame)[1];
S3 = S2 - high(period = timeFrame)[1] + low(period = timeFrame)[1];
#
MID3 = R2 + ((R3 - R2) /2);
MID_3 = S2 - ((S2 - S3) /2);
#
R4 = R3 + high(period = timeFrame)[1] - low(period = timeFrame)[1];
S4 = S3 - high(period = timeFrame)[1] + low(period = timeFrame)[1];


}

PP.SetDefaultColor(GetColor(0));
R1.SetDefaultColor(Color.Red);
R2.SetDefaultColor(Color.Red);
R3.SetDefaultColor(Color.Red);
R4.SetDefaultColor(Color.Red);
S1.SetDefaultColor(Color.Yellow);
S2.SetDefaultColor(Color.Yellow);
S3.SetDefaultColor(Color.Yellow);
S4.SetDefaultColor(Color.Yellow);
Mid1.SetDefaultColor(GetColor(3));
Mid2.SetDefaultColor(GetColor(3));
Mid3.SetDefaultColor(GetColor(3));
Mid_1.SetDefaultColor(GetColor(3));
Mid_2.SetDefaultColor(GetColor(3));
Mid_3.SetDefaultColor(GetColor(3));

PP.SetStyle(Curve.firm);
R1.SetStyle(Curve.SHORT_DASH);
R2.SetStyle(Curve.SHORT_DASH);
R3.SetStyle(Curve.SHORT_DASH);
R4.SetStyle(Curve.SHORT_DASH);
S1.SetStyle(Curve.SHORT_DASH);
S2.SetStyle(Curve.SHORT_DASH);
S3.SetStyle(Curve.SHORT_DASH);
S4.SetStyle(Curve.SHORT_DASH);
Mid1.SetStyle(Curve.SHORT_DASH);
Mid2.SetStyle(Curve.SHORT_DASH);
Mid3.SetStyle(Curve.SHORT_DASH);
Mid_1.SetStyle(Curve.SHORT_DASH);
Mid_2.SetStyle(Curve.SHORT_DASH);
Mid_3.SetStyle(Curve.SHORT_DASH);

def paintingStrategy = if timeFrame == AggregationPeriod.WEEK then PaintingStrategy.DASHES else if timeFrame == AggregationPeriod.MONTH then PaintingStrategy.DASHES else PaintingStrategy.LINE_VS_POINTS;

PP.SetPaintingStrategy(PaintingStrategy.DASHES);
R1.SetPaintingStrategy(PaintingStrategy.DASHES);
R2.SetPaintingStrategy(PaintingStrategy.DASHES);
R3.SetPaintingStrategy(PaintingStrategy.DASHES);
R4.SetPaintingStrategy(PaintingStrategy.DASHES);
S1.SetPaintingStrategy(PaintingStrategy.DASHES);
S2.SetPaintingStrategy(PaintingStrategy.DASHES);
S3.SetPaintingStrategy(PaintingStrategy.DASHES);
S4.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid1.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid2.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid3.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid_1.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid_2.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid_3.SetPaintingStrategy(PaintingStrategy.DASHES);

def cond = showBubble and isNaN(close[ShiftBubble]) and !isNaN(close[n1]) ;
AddChartBubble(cond,PP,Concat("PP: ",Round(PP)),color.magenta);
AddChartBubble(cond,R1,Concat("R1: ",Round(R1)),color.magenta);
AddChartBubble(cond,R2,Concat("R2: ",Round(R2)),color.magenta);
AddChartBubble(cond,R3,Concat("R3: ",Round(R3)),color.magenta);
AddChartBubble(cond,R4,Concat("R4: ",Round(R4)),color.magenta);
AddChartBubble(cond,S1,Concat("S1: ",Round(S1)),color.magenta);
AddChartBubble(cond,S2,Concat("S2: ",Round(S2)),color.magenta);
AddChartBubble(cond,S3,Concat("S3: ",Round(S3)),color.magenta);
AddChartBubble(cond,S4,Concat("S4: ",Round(S4)),color.magenta);
AddChartBubble(cond,Mid1,Concat("Mid1: ",Round(Mid1)),color.magenta);
AddChartBubble(cond,Mid2,Concat("Mid2: ",Round(Mid2)),color.magenta);
AddChartBubble(cond,Mid3,Concat("Mid3: ",Round(Mid3)),color.magenta);
AddChartBubble(cond,Mid_1,Concat("Mid_1: ",Round(Mid_1)),color.magenta);
AddChartBubble(cond,Mid_2,Concat("Mid_2: ",Round(Mid_2)),color.magenta);
AddChartBubble(cond,Mid_3,Concat("Mid_3: ",Round(Mid_3)),color.magenta);

Mid1.SetHiding (!MidPlot);
Mid2.SetHiding (!MidPlot);
Mid3.SetHiding (!MidPlot);
Mid_1.SetHiding (!MidPlot);
Mid_2.SetHiding (!MidPlot);
Mid_3.SetHiding (!MidPlot);

#####
looks interesting, cleaned the code up a bit.

Code:
# The Pivot Points Indicator Package
# Floor Trader’s Pivot Points
# Fibonacci Pivot Point
# What we have taken the original version which only calculates R1, R2, R3 and S1, S2, S3 and have added the following features:

# Additional Support/Resistance Levels of S4 and R4
# Option to Display Mid-Pivots
# Text Labels are Plotted Adjacent to Each Level for Quick Identification
# Visual and Audio Alerts for when Price Crosses any of the S/R Levels

input marketThreshold = 0.00;
input timeFrame = AggregationPeriod.DAY;
input MidPlot = yes;
input showOnlyToday = no;
input showBubble = yes;
input ShiftBubble = 5;
def n1 = ShiftBubble+1;
def o = open(period = timeFrame);
def h = high(period = timeFrame);
def l = low(period = timeFrame);
def c = close(period = timeFrame);

plot R4;
plot R3;
plot Mid3;
plot R2;
plot Mid2;
plot R1;
plot Mid1;
plot PP;
plot Mid_1;
plot S1;
plot Mid_2;
plot S2;
plot Mid_3;
plot S3;
plot S4;

if showOnlyToday and !IsNaN(c[-1])
then {
R1 = Double.NaN;
R2 = Double.NaN;
R3 = Double.NaN;
R4 = Double.NaN;
PP = Double.NaN;
S1 = Double.NaN;
S2 = Double.NaN;
S3 = Double.NaN;
S4 = Double.NaN;
Mid1 = Double.NaN;
Mid2 = Double.NaN;
Mid3 = Double.NaN;
Mid_1 = Double.NaN;
Mid_2 = Double.NaN;
Mid_3 = Double.NaN;

} else {

PP = hlc3(period = timeFrame)[1];
#
R1 = 2 * PP - l[1];
S1 = 2 * PP - h[1];
#
MID1 = PP + ((R1 - PP) /2);
MID_1 = PP - ((PP - S1) /2);
#
R2 = PP + (h[1] - l[1]);
S2 = PP - (h[1] - l[1]);
#
MID2 = R1 + ((R2 - R1) /2);
MID_2 = S1 - ((S1 - S2) /2);
#
R3 = R2 + h[1] - l[1];
S3 = S2 - h[1] + l[1];
#
MID3 = R2 + ((R3 - R2) /2);
MID_3 = S2 - ((S2 - S3) /2);
#
R4 = R3 + h[1] - l[1];
S4 = S3 - h[1] + l[1];
}

PP.SetDefaultColor(GetColor(0));
R1.SetDefaultColor(Color.Red);
R2.SetDefaultColor(Color.Red);
R3.SetDefaultColor(Color.Red);
R4.SetDefaultColor(Color.Red);
S1.SetDefaultColor(Color.Yellow);
S2.SetDefaultColor(Color.Yellow);
S3.SetDefaultColor(Color.Yellow);
S4.SetDefaultColor(Color.Yellow);
Mid1.SetDefaultColor(GetColor(3));
Mid2.SetDefaultColor(GetColor(3));
Mid3.SetDefaultColor(GetColor(3));
Mid_1.SetDefaultColor(GetColor(3));
Mid_2.SetDefaultColor(GetColor(3));
Mid_3.SetDefaultColor(GetColor(3));

PP.SetStyle(Curve.firm);
R1.SetStyle(Curve.SHORT_DASH);
R2.SetStyle(Curve.SHORT_DASH);
R3.SetStyle(Curve.SHORT_DASH);
R4.SetStyle(Curve.SHORT_DASH);
S1.SetStyle(Curve.SHORT_DASH);
S2.SetStyle(Curve.SHORT_DASH);
S3.SetStyle(Curve.SHORT_DASH);
S4.SetStyle(Curve.SHORT_DASH);
Mid1.SetStyle(Curve.SHORT_DASH);
Mid2.SetStyle(Curve.SHORT_DASH);
Mid3.SetStyle(Curve.SHORT_DASH);
Mid_1.SetStyle(Curve.SHORT_DASH);
Mid_2.SetStyle(Curve.SHORT_DASH);
Mid_3.SetStyle(Curve.SHORT_DASH);

def paintingStrategy = if timeFrame == AggregationPeriod.WEEK then PaintingStrategy.DASHES else if timeFrame == AggregationPeriod.MONTH then PaintingStrategy.DASHES else PaintingStrategy.LINE_VS_POINTS;

PP.SetPaintingStrategy(PaintingStrategy.DASHES);
R1.SetPaintingStrategy(PaintingStrategy.DASHES);
R2.SetPaintingStrategy(PaintingStrategy.DASHES);
R3.SetPaintingStrategy(PaintingStrategy.DASHES);
R4.SetPaintingStrategy(PaintingStrategy.DASHES);
S1.SetPaintingStrategy(PaintingStrategy.DASHES);
S2.SetPaintingStrategy(PaintingStrategy.DASHES);
S3.SetPaintingStrategy(PaintingStrategy.DASHES);
S4.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid1.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid2.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid3.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid_1.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid_2.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid_3.SetPaintingStrategy(PaintingStrategy.DASHES);

def cond = showBubble and isNaN(close[ShiftBubble]) and !isNaN(close[n1]) ;
AddChartBubble(cond,PP,Concat("PP: ",Round(PP)),color.magenta);
AddChartBubble(cond,R1,Concat("R1: ",Round(R1)),color.magenta);
AddChartBubble(cond,R2,Concat("R2: ",Round(R2)),color.magenta);
AddChartBubble(cond,R3,Concat("R3: ",Round(R3)),color.magenta);
AddChartBubble(cond,R4,Concat("R4: ",Round(R4)),color.magenta);
AddChartBubble(cond,S1,Concat("S1: ",Round(S1)),color.magenta);
AddChartBubble(cond,S2,Concat("S2: ",Round(S2)),color.magenta);
AddChartBubble(cond,S3,Concat("S3: ",Round(S3)),color.magenta);
AddChartBubble(cond,S4,Concat("S4: ",Round(S4)),color.magenta);
AddChartBubble(cond,Mid1,Concat("Mid1: ",Round(Mid1)),color.magenta);
AddChartBubble(cond,Mid2,Concat("Mid2: ",Round(Mid2)),color.magenta);
AddChartBubble(cond,Mid3,Concat("Mid3: ",Round(Mid3)),color.magenta);
AddChartBubble(cond,Mid_1,Concat("Mid_1: ",Round(Mid_1)),color.magenta);
AddChartBubble(cond,Mid_2,Concat("Mid_2: ",Round(Mid_2)),color.magenta);
AddChartBubble(cond,Mid_3,Concat("Mid_3: ",Round(Mid_3)),color.magenta);

Mid1.SetHiding (!MidPlot);
Mid2.SetHiding (!MidPlot);
Mid3.SetHiding (!MidPlot);
Mid_1.SetHiding (!MidPlot);
Mid_2.SetHiding (!MidPlot);
Mid_3.SetHiding (!MidPlot);

#####

if you want to color between lines use the addcloud(); function for which plots you wish to color between.
for example
AddCloud(R2, Mid2, Color.GREEN, Color.GREEN, no);
will color the space between R2 and Mid2 green, 'no' at the end of the function specifies if you want the clouds to have an outline, which I don't think is needed.
 
@Welkin Thank you I appreciate the help. What I like the most about the indicator is it's accuracy, and once the levels plotted they do not move or change their position. If you find a way to use it let me know. I only use it mainly for long term investment using certain monthly levels. I wouldn't mind using it for intraday trades.
 
@BenTen thanks. Can you may be explain how to look for entry points with this. I have it set for 2min chart with 2hr aggregation. Similar looks are in place for higher timeframes.

ImZzwfr.png
 
@BenTen @horserider is there a way for the ATR pivot study above to work in iOS displaying horizontal lines? I know if won’t show the shading, but for some reason, the lines are all continuous in graph form and not horizontal (by day or by week, etc)
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
358 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