Previous Day High and Low Breakout Indicator for ThinkorSwim

Can somebody help me setup the following thinkscrips code/scan, TOS lacks additional conditions

I just want to scan for:
Candle that make high over previous day high of day, yet closes under it.
or
Make low below previous day low of day, and closes over it.

Thats it! TOS custom candle pattern builder is missing the integration with the previous high of day study or any studies for that matter.
If I want to scan for 3 ascending candles, yet over vwap, its impossible to incorporate any indicators into the candle scanner.

See if this helps

Ruby:
def ymd        = GetYYYYMMDD();
def candles    = !isnan(close);
def capture    = candles and ymd != ymd[1];
def dayCount   = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0);
def thisDay    = (HighestAll(dayCount) - dayCount) ;
def phd        = if thisday==0 then double.nan else if thisday== 1 and secondsfromTime(0930)== 0
                 then high else if thisday==1 then Max(high, phd[1]) else phd[1];
def phdext     = if IsNaN(phd) then phdext[1] else phd;
def  ph        = phdext;
def  cond1     = if thisday==0 and
                 open > phdext
                 then 1 else 0;
def cond2      = if thisday==0
                 then if cond1 == 1 and close < phdext
                      then 1
                      else 0
                else 0;


def pld        = if thisday==0 then double.nan
                 else if thisday == 1 and secondsFromTime(0930) == 0
                 then low
                 else Min(low, pld[1]);
def pldext     = if IsNaN(pld) then pldext[1] else pld;
def pl         =  pldext;
def  cond1a    = if thisday == 0 and
                 open < pldext
                 then 1 else 0;
def cond2a     = if thisday == 0
                 then if cond1a == 1 and close > pldext
                     then 1
                     else 0
                else 0;
plot scan     = (cond1a == 1 and cond2a == 1) or (cond1 == 1 and cond2 == 1);
 
How to add this indicator to my watchlist . If there is a breakout or breakdown i need to get an alert.

Previous Day High and Low Breakout Indicator​

 
plot scan = close crosses above previousHigh;
The scan needs to be run in the first 5min of the open bell as it states: the current price crosses above the previous High, right at this moment.


You could try replacing the last statement in Post#7 with:
plot scan = open is greater than previousHigh;
This returns all stocks that OPENED above the previous day high.
It will not display PLTR in the results because PLTR open was not above. It crossed above in the first 5min.
Screenshot (85).png

@kevinasore
 
Last edited:
I took this indicator from Robert and tweaked it a little to my need. Originally it plots the 5 min opening range breakout. However, I took that out and only keep the previous day high and low. Then I add some customizations to it to make the breakout or breakdown more noticeable.

Here is what it looks like:

3DOqpxq.png


When the price is within the previous day high and low range then you would see the color of the regular candle. When it's outside of the range then red candles become gray and green candles become white.

thinkScript Code

Rich (BB code):
# 5 min opening range
# Robert Payne
#Plot opening range high / low
input OpenRangeMinutes = 5;
input MarketOpenTime = 0930;
input ShowTodayOnly = yes;

def Today = if GetDay() == GetLastDay() then 1 else 0;
def FirstMinute = if SecondsFromTime(MarketOpenTime) < 60 then 1 else 0;
def OpenRangeTime = if SecondsFromTime(MarketOpenTime) < 60 * OpenRangeMinutes then 1 else 0;

#Plot yesterday's high / low
plot Yhigh = if ShowTodayOnly and !Today then Double.NaN else high(period = "day" )[1];
plot Ylow = if ShowTodayOnly and !Today then Double.NaN else low(period = "day" )[1];

Yhigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Yhigh.SetDefaultColor(Color.UPTICK);
Yhigh.SetLineWeight(2);
Ylow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Ylow.SetDefaultColor(Color.DOWNTICK);
Ylow.SetLineWeight(2);

#Plot pivot
plot Pivot = if ShowTodayOnly and !Today then Double.NaN else (high(period = "day" )[1] + low(period = "day" )[1] + close(period = "day" )[1]) / 3;
Pivot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Pivot.SetDefaultColor(Color.YELLOW);
Pivot.SetLineWeight(2);

#Plot 10 day high / low
plot TenHigh = if ShowTodayOnly and !Today then Double.NaN else Highest(high(period = "day" )[1], 10);
plot TenLow = if ShowTodayOnly and !Today then Double.NaN else Lowest(low(period = "day" )[1], 10);

TenHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TenHigh.SetDefaultColor(Color.UPTICK);
TenHigh.SetLineWeight(3);
TenLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TenLow.SetDefaultColor(Color.DOWNTICK);
TenLow.SetLineWeight(3);

AssignPriceColor(if close >= Yhigh then Color.GREEN
  else if close <= Ylow then Color.RED
  else Color.CURRENT);

AssignPriceColor(if close > Yhigh and open < close then Color.White
  else if close > YHIGH and open > close then Color.Gray
  else if close < Ylow and open < close then Color.White
  else if close < Ylow and open > close then Color.Gray
  else Color.CURRENT);

Shareable Link

https://tos.mx/tbjMgb

Previous Intradays High, Low, Mean

Code:
# Previous Intradays High, Low, Mean
# Mobius
# V01.12.2017 Desktop and Mobile
# Revised original code that uses SecondsFromTime() and SecondsTillTime(). Code now uses RegularTradingStart() and RegularTradingEnd() to bracket RTH. Works in Mobile Apps

def bar = barNumber();
def h = high;
def l = low;
def c = close;
def firstBar = if getTime() crosses above RegularTradingStart(GetYYYYMMDD()) and
                  !isNaN(close)
               then bar
               else double.nan;
def lastBar = if getTime() crosses above RegularTradingEnd(GetYYYYMMDD()) and
                 !isNaN(close)
              then bar
              else double.nan;
addVerticalLine(bar == HighestAll(firstBar), "first bar", color.cyan, curve.short_dash);
addVerticalLine(bar == HighestAll(lastBar), "last bar", color.cyan, curve.short_dash);
def bar_t1 = if !isNaN(firstBar)
            then bar
            else bar_t1[1];
def bar_t2 = if !isNaN(lastBar)
             then bar
             else bar_t2[1];
def prevFirstBar = if bar_t1 != bar_t1[1]
              then bar_t1[1]
              else prevFirstBar[1];
def prevLastBar = if bar_t2 != bar_t2[1]
                  then bar_t2[1]
                  else prevLastBar[1];
addVerticalLine(bar == HighestAll(prevFirstBar), "prev first bar", color.red, curve.short_dash);
addVerticalLine(bar == HighestAll(prevLastBar), "prev Last bar", color.red, curve.short_dash);
def hh = if bar == HighestAll(prevFirstBar)
         then h
         else if between(bar, highestAll(prevFirstBar), highestAll(LastBar)) and
                 h > hh[1]
              then h
              else hh[1];
def hhBar = if h == hh and between(bar, highestAll(prevFirstBar), highestAll(LastBar))
            then barNumber()
            else double.nan;
def ll = if bar == HighestAll(prevFirstBar)
         then l
         else if between(bar, highestAll(prevFirstBar), highestAll(LastBar)) and
                 l < ll[1]
              then l
              else ll[1];
def llBar = if l == ll and between(bar, highestAll(prevFirstBar), highestAll(LastBar))
            then bar
            else double.nan;
plot PrevDayHigh = if bar >= highestAll(hhBar)
                   then highestAll(if isNaN(c[-1])
                                   then hh
                                   else double.nan)
                   else double.nan;
     PrevDayHigh.SetStyle(Curve.Long_Dash);
     PrevDayHigh.SetLineWeight(3);
     PrevDayHigh.SetDefaultColor(Color.Green);
     PrevDayHigh.HideTitle();
plot PrevDayLow = if bar >= HighestAll(llBar)
                  then highestAll(if isNaN(c[-1])
                                  then ll
                                  else double.nan)
                  else double.nan;
     PrevDayLow.SetStyle(Curve.Long_Dash);
     PrevDayLow.SetLineWeight(3);
     PrevDayLow.SetDefaultColor(Color.Red);
     PrevDayLow.HideTitle();
def hl2bar = Floor((highestAll(hhbar) + highestAll(llBar)) / 2);
def hl2price = Round(((PrevDayHigh + PrevDayLow) / 2) / TickSize(), 0) * TickSize();
plot PrevDayHL2 = if bar >= highestAll(HL2bar)
               then highestAll(if !isNaN(c[-1])
                               then HL2price
                               else double.nan)
               else double.nan;
     PrevDayHL2.SetStyle(Curve.Long_Dash);
     PrevDayHL2.SetLineWeight(3);
     PrevDayHL2.SetDefaultColor(Color.Yellow);
     PrevDayHL2.HideTitle();
# End Code Previous Days High, Low, Mean
hi looking for code that is yesterdays gainer more than( 15%) but that fell today more than 10% (loser) ? thanks in advance :)
 
Found this script in the thinkScript lounge. Hopefully it's what you're looking for:

Code:
#This custom column plots the high or low break compared to the previous day's. Green is a high break. Red is a low break. Pink is a hi and low break with the hi break amt shown.
#Title = Broke, Revision 9/25/13
#Revised:  12:03 PM 9/25/2013

def HiBroke = If (close > high[1] ,1,0);
def LoBroke = If (close  < low[1] ,1,0);
def BothBroke = If (HiBroke && LoBroke, 1,0);
def HiBrokeAmt = If HiBroke then (close - high[1] ) else double.nan;
def LoBrokeAmt = If LoBroke then (low[1] - close) else double.nan;

Addlabel(1,  if HiBroke && !LoBroke then round(HiBrokeAmt,2)
else if !HiBroke && LoBroke then round(LoBrokeAmt,2)
else  if HiBroke && LoBroke then  round(HiBrokeAmt,2)
else 0, color.yellow);

AssignBackgroundColor(if HiBroke then color.Dark_green
else if LoBroke then color.Light_red
else if HiBroke && LoBroke then color.pink
else color.current);
it can be applied to chart but is there any way we can add column to scan result
 
@richielucky Yes that script will work as a watchlist column.
Watchlist column instructions:
Then click on the small gear just above your results in Scan Hacker and add the column
 
Last edited:
Hello

Can anyone share a revised script to show last 5 days of each high/LOW/OPEN/CLOSE?
Here is a script that I did for highs and lows that shows the last 5 previous regulart trading hour highs/lows/opens/closes extended to the right edge of the chart.

Capture.jpg
Ruby:
#Example_PreviousDaysHL-each_extended_through_expansion
#20170911 - BLT
#Example Highs/Lows from previous days, extended from each day through the right expansion

script philow {
    input n = 1;
    def ymd = GetYYYYMMDD();
    def ok = !IsNaN(close);
    def capture = ok and ymd != ymd[1];
    def dayCount = CompoundValue(1, if capture
                                    then dayCount[1] + 1
                                    else dayCount[1], 0);
    def thisDay = (HighestAll(dayCount) - dayCount) ;
    def hh = CompoundValue(1, if thisDay == n and SecondsFromTime(0930) == 0
                              then high
                              else if thisDay == n and  high > hh[1] and secondstillTime(1600)>0
                              then high
                              else hh[1] , high);
    def hhnan = if IsNaN(close) then hhnan[1] else hh;
    plot hhplot = if thisDay == n and SecondsFromTime(0930) < 0
                  then Double.NaN
                  else if thisDay <= n
                  then hhnan
                  else Double.NaN;

    def ll = CompoundValue(1, if thisDay == n and SecondsFromTime(0930) == 0
                              then low
                              else if  thisDay == n and low < ll[1] and secondstillTime(1600)>0
                              then low
                              else ll[1] , low);
    def llnan   = if IsNaN(ll) then llnan[1] else ll;
    plot llplot = if thisDay == n and SecondsFromTime(0930) < 0
                  then Double.NaN
                  else if thisDay <= n
                  then (llnan)
                  else Double.NaN;

    def oo = CompoundValue(1, if thisDay == n and SecondsFromTime(0930) == 0
                              then open
                              else if  thisDay == n  and secondstillTime(1600)>0
                              then oo[1]
                              else oo[1], open);
    def oonan   = if IsNaN(oo) then oonan[1] else oo;
    plot ooplot = if thisDay == n and SecondsFromTime(0930) < 0
                  then Double.NaN
                  else if thisDay <= n
                  then (oonan)
                  else Double.NaN;

    def cc = CompoundValue(1, if thisDay == n and secondstillTime(1600)>=0
                              then close
                              else cc[1], close);
    def ccnan   = if IsNaN(cc) then ccnan[1] else cc;
    plot ccplot = if thisDay == n and SecondsFromTime(0930) < 0
                  then Double.NaN
                  else if thisDay <= n
                  then (ccnan)
                  else Double.NaN;

}

#Plots of Highs/Lows/Opens/Closes based upon script...add more days using similar plot statements, increasing the value by 1

plot H1 = philow(1);
plot H2 = philow(2);
plot H3 = philow(3);
plot H4 = philow(4);
plot H5 = philow(5);

plot L1 = philow(1).llplot;
plot L2 = philow(2).llplot;
plot L3 = philow(3).llplot;
plot L4 = philow(4).llplot;
plot L5 = philow(5).llplot;

plot O1 = philow(1).ooplot;
plot O2 = philow(2).ooplot;
plot O3 = philow(3).ooplot;
plot O4 = philow(4).ooplot;
plot O5 = philow(5).ooplot;

plot C1 = philow(1).ccplot;
plot C2 = philow(2).ccplot;
plot C3 = philow(3).ccplot;
plot C4 = philow(4).ccplot;
plot C5 = philow(5).ccplot;

H1.setdefaultColor(color.cyan);
H2.setdefaultColor(color.cyan);
H3.setdefaultColor(color.cyan);
H4.setdefaultColor(color.cyan);
H5.setdefaultColor(color.cyan);

O1.setdefaultColor(color.white);
O2.setdefaultColor(color.white);
O3.setdefaultColor(color.white);
O4.setdefaultColor(color.white);
O5.setdefaultColor(color.white);

L1.setdefaultColor(color.magenta);
L2.setdefaultColor(color.magENTA);
L3.setdefaultColor(color.mageNTA);
L4.setdefaultColor(color.magENTA);
L5.setdefaultColor(color.magENTA);

C1.setdefaultColor(color.yellow);
C2.setdefaultColor(color.yellow);
C3.setdefaultColor(color.yellow);
C4.setdefaultColor(color.yellow);
C5.setdefaultColor(color.yellow);
 
Wondering if it is possible to find high or low between two timeframes in a day (in a min chart) for ex: Find high between 10AM to 11AM

Also, to find highest/lowest from current time/bar back to 10AM
 
Wondering if it is possible to find high or low between two timeframes in a day (in a min chart) for ex: Find high between 10AM to 11AM

Also, to find highest/lowest from current time/bar back to 10AM

See if this helps.

Capture.jpg
Ruby:
def h10eod     = if GetTime() > RegularTradingEnd(GetYYYYMMDD()[1]) and  GetTime() < RegularTradingStart(GetYYYYMMDD())
                 then Double.NaN
                 else if SecondsFromTime(1000) == 0
                      then high
                 else if SecondsTillTime(1600) > 0  and high > h10eod[1]
                      then high
                 else h10eod[1];
plot high10eod = h10eod;
high10eod.SetDefaultColor(Color.WHITE);
high10eod.SetPaintingStrategy(PaintingStrategy.LINE);
high10eod.SetLineWeight(4);

def h1011      = if GetTime() > RegularTradingEnd(GetYYYYMMDD()[1]) and  GetTime() < RegularTradingStart(GetYYYYMMDD())
                 then Double.NaN
                 else if SecondsFromTime(1000) == 0
                      then high
                 else if SecondsTillTime(1100) >= 0  and high > h1011[1]
                      then high
                 else h1011[1];

plot high1011  = h1011;
high1011.SetDefaultColor(Color.CYAN);
high1011.SetPaintingStrategy(PaintingStrategy.DASHES);
high1011.SetLineWeight(2);

input bubblemover = 3;
def   b  = bubblemover;
def   b1 = b + 1;

input showbubbles = yes;
AddChartBubble(showbubbles and !IsNaN(close[b1]) and IsNaN(close[b]), high1011[b1], "H10_11", Color.CYAN);
AddChartBubble(showbubbles and !IsNaN(close[b1]) and IsNaN(close[b]), high10eod[b1], "H10_EOD", Color.WHITE);
 
I took this indicator from Robert and tweaked it a little to my need. Originally it plots the 5 min opening range breakout. However, I took that out and only keep the previous day high and low. Then I add some customizations to it to make the breakout or breakdown more noticeable.

Here is what it looks like:

3DOqpxq.png


When the price is within the previous day high and low range then you would see the color of the regular candle. When it's outside of the range then red candles become gray and green candles become white.

thinkScript Code

Rich (BB code):
# 5 min opening range
# Robert Payne
#Plot opening range high / low
input OpenRangeMinutes = 5;
input MarketOpenTime = 0930;
input ShowTodayOnly = yes;

def Today = if GetDay() == GetLastDay() then 1 else 0;
def FirstMinute = if SecondsFromTime(MarketOpenTime) < 60 then 1 else 0;
def OpenRangeTime = if SecondsFromTime(MarketOpenTime) < 60 * OpenRangeMinutes then 1 else 0;

#Plot yesterday's high / low
plot Yhigh = if ShowTodayOnly and !Today then Double.NaN else high(period = "day" )[1];
plot Ylow = if ShowTodayOnly and !Today then Double.NaN else low(period = "day" )[1];

Yhigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Yhigh.SetDefaultColor(Color.UPTICK);
Yhigh.SetLineWeight(2);
Ylow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Ylow.SetDefaultColor(Color.DOWNTICK);
Ylow.SetLineWeight(2);

#Plot pivot
plot Pivot = if ShowTodayOnly and !Today then Double.NaN else (high(period = "day" )[1] + low(period = "day" )[1] + close(period = "day" )[1]) / 3;
Pivot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Pivot.SetDefaultColor(Color.YELLOW);
Pivot.SetLineWeight(2);

#Plot 10 day high / low
plot TenHigh = if ShowTodayOnly and !Today then Double.NaN else Highest(high(period = "day" )[1], 10);
plot TenLow = if ShowTodayOnly and !Today then Double.NaN else Lowest(low(period = "day" )[1], 10);

TenHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TenHigh.SetDefaultColor(Color.UPTICK);
TenHigh.SetLineWeight(3);
TenLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TenLow.SetDefaultColor(Color.DOWNTICK);
TenLow.SetLineWeight(3);

AssignPriceColor(if close >= Yhigh then Color.GREEN
  else if close <= Ylow then Color.RED
  else Color.CURRENT);

AssignPriceColor(if close > Yhigh and open < close then Color.White
  else if close > YHIGH and open > close then Color.Gray
  else if close < Ylow and open < close then Color.White
  else if close < Ylow and open > close then Color.Gray
  else Color.CURRENT);

Shareable Link

https://tos.mx/tbjMgb

Previous Intradays High, Low, Mean

Code:
# Previous Intradays High, Low, Mean
# Mobius
# V01.12.2017 Desktop and Mobile
# Revised original code that uses SecondsFromTime() and SecondsTillTime(). Code now uses RegularTradingStart() and RegularTradingEnd() to bracket RTH. Works in Mobile Apps

def bar = barNumber();
def h = high;
def l = low;
def c = close;
def firstBar = if getTime() crosses above RegularTradingStart(GetYYYYMMDD()) and
                  !isNaN(close)
               then bar
               else double.nan;
def lastBar = if getTime() crosses above RegularTradingEnd(GetYYYYMMDD()) and
                 !isNaN(close)
              then bar
              else double.nan;
addVerticalLine(bar == HighestAll(firstBar), "first bar", color.cyan, curve.short_dash);
addVerticalLine(bar == HighestAll(lastBar), "last bar", color.cyan, curve.short_dash);
def bar_t1 = if !isNaN(firstBar)
            then bar
            else bar_t1[1];
def bar_t2 = if !isNaN(lastBar)
             then bar
             else bar_t2[1];
def prevFirstBar = if bar_t1 != bar_t1[1]
              then bar_t1[1]
              else prevFirstBar[1];
def prevLastBar = if bar_t2 != bar_t2[1]
                  then bar_t2[1]
                  else prevLastBar[1];
addVerticalLine(bar == HighestAll(prevFirstBar), "prev first bar", color.red, curve.short_dash);
addVerticalLine(bar == HighestAll(prevLastBar), "prev Last bar", color.red, curve.short_dash);
def hh = if bar == HighestAll(prevFirstBar)
         then h
         else if between(bar, highestAll(prevFirstBar), highestAll(LastBar)) and
                 h > hh[1]
              then h
              else hh[1];
def hhBar = if h == hh and between(bar, highestAll(prevFirstBar), highestAll(LastBar))
            then barNumber()
            else double.nan;
def ll = if bar == HighestAll(prevFirstBar)
         then l
         else if between(bar, highestAll(prevFirstBar), highestAll(LastBar)) and
                 l < ll[1]
              then l
              else ll[1];
def llBar = if l == ll and between(bar, highestAll(prevFirstBar), highestAll(LastBar))
            then bar
            else double.nan;
plot PrevDayHigh = if bar >= highestAll(hhBar)
                   then highestAll(if isNaN(c[-1])
                                   then hh
                                   else double.nan)
                   else double.nan;
     PrevDayHigh.SetStyle(Curve.Long_Dash);
     PrevDayHigh.SetLineWeight(3);
     PrevDayHigh.SetDefaultColor(Color.Green);
     PrevDayHigh.HideTitle();
plot PrevDayLow = if bar >= HighestAll(llBar)
                  then highestAll(if isNaN(c[-1])
                                  then ll
                                  else double.nan)
                  else double.nan;
     PrevDayLow.SetStyle(Curve.Long_Dash);
     PrevDayLow.SetLineWeight(3);
     PrevDayLow.SetDefaultColor(Color.Red);
     PrevDayLow.HideTitle();
def hl2bar = Floor((highestAll(hhbar) + highestAll(llBar)) / 2);
def hl2price = Round(((PrevDayHigh + PrevDayLow) / 2) / TickSize(), 0) * TickSize();
plot PrevDayHL2 = if bar >= highestAll(HL2bar)
               then highestAll(if !isNaN(c[-1])
                               then HL2price
                               else double.nan)
               else double.nan;
     PrevDayHL2.SetStyle(Curve.Long_Dash);
     PrevDayHL2.SetLineWeight(3);
     PrevDayHL2.SetDefaultColor(Color.Yellow);
     PrevDayHL2.HideTitle();
# End Code Previous Days High, Low, Mean
is there a way to tweak the top code so the candles stay green/red and don't change to white? thank you
 
is there a way to tweak the top code so the candles stay green/red and don't change to white? thank you
Find and Change this to:
Rich (BB code):
AssignPriceColor(if close > Yhigh and open < close then Color.White
To this:
Rich (BB code):
AssignPriceColor(if close > Yhigh and open < close then Color.Current
 
Last edited:
@BenTen

Just curious if there is a similar study that alerts to price breaking above/below previous day high/low? I know i can manually set my alerts, but just curious if there is a study that will alert me on the chart when that happens? any help is appreciated. thank you happy 2022!
 
@BenTen

Just curious if there is a similar study that alerts to price breaking above/below previous day high/low? I know i can manually set my alerts, but just curious if there is a study that will alert me on the chart when that happens? any help is appreciated. thank you happy 2022!
Did you try any of the scripts in this thread?
 
Is there a way to add chart bubbles to these levels?





Rich (BB code):
# 5 min opening range
# Robert Payne
#Plot opening range high / low
input OpenRangeMinutes = 5;
input MarketOpenTime = 0930;
input ShowTodayOnly = yes;

def Today = if GetDay() == GetLastDay() then 1 else 0;
def FirstMinute = if SecondsFromTime(MarketOpenTime) < 60 then 1 else 0;
def OpenRangeTime = if SecondsFromTime(MarketOpenTime) < 60 * OpenRangeMinutes then 1 else 0;

#Plot yesterday's high / low
plot Yhigh = if ShowTodayOnly and !Today then Double.NaN else high(period = "day" )[1];
plot Ylow = if ShowTodayOnly and !Today then Double.NaN else low(period = "day" )[1];

Yhigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Yhigh.SetDefaultColor(Color.UPTICK);
Yhigh.SetLineWeight(2);
Ylow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Ylow.SetDefaultColor(Color.DOWNTICK);
Ylow.SetLineWeight(2);

#Plot pivot
plot Pivot = if ShowTodayOnly and !Today then Double.NaN else (high(period = "day" )[1] + low(period = "day" )[1] + close(period = "day" )[1]) / 3;
Pivot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Pivot.SetDefaultColor(Color.YELLOW);
Pivot.SetLineWeight(2);

#Plot 10 day high / low
plot TenHigh = if ShowTodayOnly and !Today then Double.NaN else Highest(high(period = "day" )[1], 10);
plot TenLow = if ShowTodayOnly and !Today then Double.NaN else Lowest(low(period = "day" )[1], 10);

TenHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TenHigh.SetDefaultColor(Color.UPTICK);
TenHigh.SetLineWeight(3);
TenLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TenLow.SetDefaultColor(Color.DOWNTICK);
TenLow.SetLineWeight(3);

AssignPriceColor(if close >= Yhigh then Color.GREEN
else if close <= Ylow then Color.RED
else Color.CURRENT);

AssignPriceColor(if close > Yhigh and open < close then Color.White
else if close > YHIGH and open > close then Color.Gray
else if close < Ylow and open < close then Color.White
else if close < Ylow and open > close then Color.Gray
else Color.CURRENT);
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
399 Online
Create Post

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