• Get $40 off VIP by signing up for a free account! Sign Up

Previous Day High/Low/Close For ThinkOrSwim


Active member
I like to find ways to remove clutter from the charts so I came up with this. Figured others might find it appealing as well. Plots previous day's high, low and close, as well as the current days open on expansion. these values are taken from the daily aggregation.


#[email protected]
def NA = Double.NaN;

input agg = AggregationPeriod.DAY;
input showOnlyLastPeriod = no;
input showBubbles = yes;
input showValuesInBubbles = yes;
input spaceBetween = 1;
plot currentOpen;
plot prevDayClose;
plot prevDayLow;
plot prevDayHigh;
def exp = IsNaN(close[spaceBetween]);

currentOpen = if exp then open("period"=agg) else NA;
prevDayClose = if exp then close("period"=agg)[1] else NA;
prevDayLow = if exp then low("period"=agg)[1] else NA;
prevDayHigh = if exp then high("period"=agg)[1] else NA;

AddChartBubble(showBubbles, if IsNaN(currentOpen[1]) and !IsNaN(currentOpen) then currentOpen else NA, if showValuesInBubbles then "CurrOpen $"+currentOpen else "CurrOpen", Color.WHITE, yes);
AddChartBubble(showBubbles, if IsNaN(prevDayClose[1]) and !IsNaN(prevDayClose) then prevDayClose else NA, if showValuesInBubbles then "PrevClose $"+prevDayClose else "PrevClose", Color.YELLOW, yes);
AddChartBubble(showBubbles, if IsNaN(prevDayLow[1]) and !IsNaN(prevDayLow) then prevDayLow else NA, if showValuesInBubbles then "PrevLow $"+prevDayLow else "PrevLow", Color.RED, yes);
AddChartBubble(showBubbles, if IsNaN(prevDayHigh[1]) and !IsNaN(prevDayHigh) then prevDayHigh else NA, if showValuesInBubbles then "PrevHigh $"+prevDayHigh else "PrevHigh", Color.GREEN, yes);

Last edited:
Is there a way to have Daily OHLC lines plot on a short time frame chart that I use for a trigger? For instance, If I go and plot out my daily OHLC lines then I can see them on my short term (trigger chart). However, when I jump to a different ticker I have to re-evaluate and spend time plotting which takes away valuable time during trading. Any suggestions on how this can be done.

Much appreciated in advance.
I can't even find a study that plots OHLC on my charts to begin with... I wish I knew something about coding... unfortunately, I'm completely inept on the subject.
Well basically I’d like to have past few days (ie 10 days) plotted on my short term chart. I actually use a 200 tick chart for my trigger chart. Also use 1min and 2 min... they seem to correlate fairly close.

This is for a quick in/out scalping sort of trades.
Last edited:
#April 11th 2020
#last 10 days OHLC

def agg = AggregationPeriod.DAY;

plot open = open(period = agg)[1];
plot high = high(period = agg)[1];
plot low = low(period = agg)[1];
plot close = close(period = agg)[1];

plot open2 = open(period = agg)[2];
plot high2 = high(period = agg)[2];
plot low2 = low(period = agg)[2];
plot close2 = close(period = agg)[2];

plot open3 = open(period = agg)[3];
plot high3 = high(period = agg)[3];
plot low3 = low(period = agg)[3];
plot close3 = close(period = agg)[3];

plot open4 = open(period = agg)[4];
plot high4 = high(period = agg)[4];
plot low4 = low(period = agg)[4];
plot close4 = close(period = agg)[4];

plot open5 = open(period = agg)[5];
plot high5 = high(period = agg)[5];
plot low5 = low(period = agg)[5];
plot close5 = close(period = agg)[5];

plot open6 = open(period = agg)[6];
plot high6 = high(period = agg)[6];
plot low6 = low(period = agg)[6];
plot close6 = close(period = agg)[6];

plot open7 = open(period = agg)[7];
plot high77 = high(period = agg)[7];
plot low7 = low(period = agg)[7];
plot close7 = close(period = agg)[7];

plot open8 = open(period = agg)[8];
plot high8 = high(period = agg)[8];
plot low8 = low(period = agg)[8];
plot close8 = close(period = agg)[8];

plot open9 = open(period = agg)[9];
plot high9 = high(period = agg)[9];
plot low9 = low(period = agg)[9];
plot close9 = close(period = agg)[9];

plot open10 = open(period = agg)[10];
plot high10 = high(period = agg)[10];
plot low10 = low(period = agg)[10];
plot close10 = close(period = agg)[10];
Appreciate you putting your time in for this. However, its not plotting. The name of the indicator is highlighted red after I add it to my studies. Not sure if that means its missing something?
yes! I appreciate this so much. It'll save me loads of time. thank you so much.

Hey buddy. You wouldn't be familiar with Tradestation code system by chance would you? TOS has been very unreliable lately so i have an alternative but this code helps so much...
Is there a script out there to have the previous days High, Low, Close as a badge on the chart? Any help is greatly appreciated

Previous Daily High, Low, & Close

I use this as a pivot in addition to the ORB as another way to see the strength of the move. Not sure how good you are at coding but I'm trying to get the following to plot on a chart as two horizontal lines.

high+low+close/3=Daily Pivot Range

high+low/2 = Second Number

Daily Pivot Range minus Second number = Daily Pivot Differential

Daily Pivot Range + Daily pivot differential = Higher Pivot Range

Second Number minus Daily Pivot Differential = Lower Pivot Range

Plot the Higher Pivot Range and Lower Pivot Range with a horizontal line
Try this

input aggregationPeriod = AggregationPeriod.DAY;

def prevPriceHigh = high(period = aggregationPeriod)[0];
def prevPriceLow = low(period = aggregationPeriod)[0];
def prevPriceClose = close(period = aggregationPeriod)[0];
def Daily_Pivot_Range = (prevPriceHigh[1]+prevPriceLow[1]+prevPriceClose[1])/3;
def Second_Number = (prevPriceHigh[1]+prevPriceLow[1])/2;
def Daily_Pivot_Differential = Daily_Pivot_Range - Second_Number;

plot Higher_Pivot_Range =  Daily_Pivot_Range + Daily_Pivot_Differential;

plot  Lower_Pivot_Range = Second_Number - Daily_Pivot_Differential;
Last edited by a moderator:

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
620 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.