Hi/Lo from last 30 minutes of yesterday

RyanHunter100

New member
I'm missing a fundamental element here I'm sure, so please forgive my ignorance.

I want to see the high and low range for the last 30 minutes of yesterday.
I've got a 2 day 1 minute chart so it includes yesterday's data.
My script works as it puts a single line with the correct values on the last bar of yesterday.
My problem is I can't get the line to extend all the way to the right side of the chart.
It plots on the single bar but no further.

Code:
# Is it yesterday?
def yesterday = GetDay() != GetLastDay();

# Is the time at least 15:59pm?
def lastMinute = SecondsFromTime(1559) >= 0;

# If it's yesterday and within the last minute, then search for the lowest price in the last 30 minutes
def lowPrice = if yesterday and lastMinute then Lowest(low, 30) else Double.NaN;

# Plot the line on this bar only
plot YesterdayLast30MinsLow = lowPrice;
YesterdayLast30MinsLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
YesterdayLast30MinsLow.SetDefaultColor(Color.RED);
YesterdayLast30MinsLow.SetLineWeight(2);

# If it's yesterday and within the last minute, then search for the highest price in the last 30 bars
def highPrice = if yesterday and lastMinute then Highest(high, 30) else Double.NaN;

# Plot the line on this bar only
plot YesterdayLast30MinsHigh = highPrice;
YesterdayLast30MinsHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
YesterdayLast30MinsHigh.SetDefaultColor(Color.GREEN);
YesterdayLast30MinsHigh.SetLineWeight(2);

zXwBiN8.jpg
 
Solution
I'm missing a fundamental element here I'm sure, so please forgive my ignorance.

I want to see the high and low range for the last 30 minutes of yesterday.
I've got a 2 day 1 minute chart so it includes yesterday's data.
My script works as it puts a single line with the correct values on the last bar of yesterday.
My problem is I can't get the line to extend all the way to the right side of the chart.
It plots on the single bar but no further.

Code:
# Is it yesterday?
def yesterday = GetDay() != GetLastDay();

# Is the time at least 15:59pm?
def lastMinute = SecondsFromTime(1559) >= 0;

# If it's yesterday and within the last minute, then search for the lowest price in the last 30 minutes
def lowPrice = if yesterday and...
I'm missing a fundamental element here I'm sure, so please forgive my ignorance.

I want to see the high and low range for the last 30 minutes of yesterday.
I've got a 2 day 1 minute chart so it includes yesterday's data.
My script works as it puts a single line with the correct values on the last bar of yesterday.
My problem is I can't get the line to extend all the way to the right side of the chart.
It plots on the single bar but no further.

Code:
# Is it yesterday?
def yesterday = GetDay() != GetLastDay();

# Is the time at least 15:59pm?
def lastMinute = SecondsFromTime(1559) >= 0;

# If it's yesterday and within the last minute, then search for the lowest price in the last 30 minutes
def lowPrice = if yesterday and lastMinute then Lowest(low, 30) else Double.NaN;

# Plot the line on this bar only
plot YesterdayLast30MinsLow = lowPrice;
YesterdayLast30MinsLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
YesterdayLast30MinsLow.SetDefaultColor(Color.RED);
YesterdayLast30MinsLow.SetLineWeight(2);

# If it's yesterday and within the last minute, then search for the highest price in the last 30 bars
def highPrice = if yesterday and lastMinute then Highest(high, 30) else Double.NaN;

# Plot the line on this bar only
plot YesterdayLast30MinsHigh = highPrice;
YesterdayLast30MinsHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
YesterdayLast30MinsHigh.SetDefaultColor(Color.GREEN);
YesterdayLast30MinsHigh.SetLineWeight(2);

zXwBiN8.jpg

Just modify these two lines. The double.nan was stopping the plot. The recursive in bold will extend the line to the right.

def highPrice = if yesterday and lastMinute then Highest(high, 30) else highprice[1];
def lowPrice = if yesterday and lastMinute then Lowest(low, 30) else lowprice[1];
 
Solution
Just modify these two lines. The double.nan was stopping the plot. The recursive in bold will extend the line to the right.

def highPrice = if yesterday and lastMinute then Highest(high, 30) else highprice[1];
def lowPrice = if yesterday and lastMinute then Lowest(low, 30) else lowprice[1];
THANK YOU!! Exactly what I was missing
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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