What does hl2, ohlc4, and hlc3 do in thinkscript?


New member
There's a lot of interest here in indicators that use aggregation periods. Typically, the prices used for the indicators are the open or the close for the aggregation period, but plenty of other price types exist (e.g., hl2). If I wanted to use one of these other price types for an indicator, my concern is that there could be a delay in when those price types (e.g., hl2) become available for recent aggregation periods. For example, if I'm on a 5 minute aggregation period, how quickly will the hl2 for the most recent aggregation period become available - in enough time to make real-time decisions?
@BigBuzz Some Studies and Indicators already make use of hl2 and hlc3 for price calculations... I use hl2 quite often myself... The best way to determine the differences between price types is to display two charts, or more, side by side and observe how the price types change chart paints... You will observe timing and repainting differences... Don't take our word for it, experiment... After all, experimenting is free...

HL2 formula: (high+close)/2
HLC3 formula: (high+low+close)/3
HOLC4 formula: (high+open+low+close)/4

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

(Open+Close)/2 would be smoother the HL2 , but you would have to define (Open+Close)/2.

Using an Aggregation statement:

input agg1 = AggregationPeriod.FIVE_MIN;
input agg2 = AggregationPeriod.Thirty_MIN;
input agg3 = AggregationPeriod. Hour;

def openA = open(period = agg1);
def highA = high(period = agg1);
def lowA = low(period = agg1);
def closeA = close(period = agg1);
def openB = open(period = agg2);
def highB = high(period = agg2);
def lowB = low(period = agg2);
def closeB = close(period = agg2);
def openC = open(period = agg3);
def highC = high(period = agg3);
def lowC = low(period = agg3);
def closeC = close(period = agg3);

def PriceA = (OpenA+CloseA)/2;
def PriceB = (OpenB+CloseB)/2;
def PriceC = (OpenC+CloseC)/2;

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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