Highest/Lowest Between a Specified Time Period

bmn

Member
Hello

I would like to find the highest and lowest price of the day up until the "current point" with an user input that would either exclude or include pre-market price.

example:
Consider:
Ticker: /CL
Aggregation Type: time/ticker/range

(US) Market opens at 9 AM EST
I would like to plot a continuous line (sort of like MA lines) of the avg (or separate lines for both) of the highest high and lowest low from start of that day (from RTH start or from Pre start) to the current bar.
So for example, if I'm looking at 2D 2m time frame with RTH only selected as user input, then at 9:44 AM EST, I would like the current point of the line to represent the average of the highest high and lowest low between 9:00 to 9:44.
if I scroll left to to previous day's data and look at the bar @10:18 AM, then I would like the line's y axis value to represent the average of the highest high and lowest low between 9:00 to 10:18 of yesterday.
if I scroll a bit to the right on the previous day's data and look at the bar @12:56 PM, then it would be the avg of highest high and lowest low between yesterday's 9:00 to 12:56PM.

similar concept if pre-market hours were included, where starting point would be start of pre-hours instead of 9:00.
 
Solution
Thank you for the update. I was looking for a way to possibly get this data for more than a single day/wk/qt/etc. e.g. get high of past two days (length = 2). But now that I think about it, complexity in code, especially when it comes to calculating "Close" in that scenario is not worth the benefit and agree with your new approach.

Just one last thing, would it be possible to plot a cloud instead of one line of that bar for O/L/H/C? e.g. instead of plotting a line for prev High, draw a cloud that covers the bar that reached that highest price (similar for Open/Close/Low lines).
You're welcome

It seems you should be able to do the first idea by using multiple copies of the study and changing the inputs.

As to the clouds, here...

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