Previous Day High and Low Breakout Indicator for ThinkorSwim

I want the midpoint between previous days open and close......no high or low.....just open and close....

So will my script use previous day open, previous day close and calculate the mid point?"

Thanks benten for all the help.

Also, will this draw a line across the screen? Thanks again
 
@Slappytheking No, this will not extend to the right of your chart. Only to the current day unless you have expansion on. That may give you a projection for tomorrow's levels.
 
Hi,
I want to create two watchlist columns that display the high and low after a specific time, ie after 11:30am. Is this possible?
 
@divinci01 Since you just want to plot and scan for the previous day's high and low, here is the script for that (taken from post #1)

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;

#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);

Add it as a separate indicator and then setup your scanner to something like this:

fX5oM95.png
I can't see the bottom portion of this post to see how you are suggesting to setup the scanner - can you repost that?
 
@Taye Sure, look at the bottom of the script and delete the following:

Code:
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);
 
@divinci01 Since you just want to plot and scan for the previous day's high and low, here is the script for that (taken from post #1)

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;

#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);

Add it as a separate indicator and then setup your scanner to something like this:

fX5oM95.png
It seems this will only allow you to use the 1day (D) timeframe. So if you are using the 5min chart, for example, how can this alert you when the close crosses over the high (or below the low)? @BenTen
 
@Lyled7 I don't see anything wrong with it. If the close of the current 5m candle closes below the Previous day high or low, the same can be shown on the daily chart. You're going to get the same result.
 
@Lyled7 I don't see anything wrong with it. If the close of the current 5m candle closes below the Previous day high or low, the same can be shown on the daily chart. You're going to get the same result.
Ok so the scanner would bring up the stock as soon as it crosses above the PDH? Maybe I’m confused but I thought the daily chart shows one bar for the entire day.
 
@Lyled7 That one bar still moves around, though. So you should still be able to use it to scan for candidates crossing above or below a specific line.
 
@Lyled7 That one bar still moves around, though. So you should still be able to use it to scan for candidates crossing above or below a specific line.
Ok - i'll set it up and give it a run tomorrow to see how it works.

Not to beat a dead horse, b/c I might be totally wrong, but for the scanner to return a stock meeting the criteria you select "within 1 bar" - doesn't that bar have to finish, and then a new bar started? For example, let's say you are using a 1 min chart..... at 9:30:27 am stock ABC meets the criteria set in the scanner. Within 1 bar would mean the scanner would show ABC only after the current bar finishes at 9:31am and the next 1 minute bar has started.

If that's the case, then on a daily chart that only has 1 bar for the entire day - the scanner would never return any results b/c that 1 bar doesn't finish until 4pm.

Am I completely wrong here? And thank you for helping me out, i appreciate it! And sorry if i'm not explaining my thought process clearly.
 
@Lyled7 It could be that at the time of scanning, there wasn't any stock matching your condition. I tried a different condition such as below and it worked. At least we know the scanner is working.

asEPea6.png
 
@Lyled7 What do you mean by that? I don't use this specific scanner. I was just setting it up to show you how the condition works.
 
Hello!

Facing a problem with making TOS save yesterdays RTH High and Low when Extended Trading Hours are ON.

Need this as a part for my pre-market scanner.

Using thin piece of code and its not working.

Any help is highly appreciated!!!

Code:
def RTH = GetTime() >= RegularTradingStart(GetYYYYMMDD()) and
                 GetTime() <= RegularTradingEnd(GetYYYYMMDD());

def yHighRTH = if !RTH then yHighRTH[1] else if RTH and high > yHighRTH[1] then high else yHighRTH[1]; #yesterday's high
 
Hello! I found this forum and I was hoping to get a little bit of help. All I want is to have a yellow arrow on top of the bar that crosses the previous day high or low. I tried modifying the screw drawing strategies but didn't have any luck. Could someone help me?
 
@divinci01 Since you just want to plot and scan for the previous day's high and low, here is the script for that (taken from post #1)

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;

#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);

Add it as a separate indicator and then setup your scanner to something like this:

fX5oM95.png

Hi @BenTen,
is the aggregate for this is only on DAY??? i tried to change it to 2 min, I get an error.
Thank you
 

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
547 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