True Market Structure

What it does

  • Shows immediately whether market structure is bullish, bearish, or ranging
  • Picks out Higher Highs, Lower Lows, etc.
  • Alerts on changes to market structure

The point of knowing the market structure is to get the odds on your side – so you don’t make bullish bets in a bearish market and vice versa.

When price makes Higher Highs and Higher Lows, market structure is said to be bullish. When price makes Lower Lows and Lower Highs, it’s bearish. Simple, right? But in practice it’s easy to forget or to miscount. This indicator does the calculations for you.

Why it’s great

It’s great because:

  • Unlike every other open-source script on TradingView (at the time of writing), it does not use simple Williams fractals as pivots. It actually calculates proper Local Highs and Local Lows. And it only allows a High to be confirmed after a Low and a Low after a High. That’s why I called it True Market Structure.
  • By default, it’s colour-coded to interpret the current market structure for you.
  • For those who don’t want to wait for an unpredictable number of bars for a High or Low to be confirmed, there is an optional faster signal: Bullish/Bearish Breaks in market structure.
  • Another optional signal gives you high-potential entries: Buy The Dip highlights when a Higher Low is confirmed during an uptrend, and Sell The Rally shows a Lower High in a downtrend.

All signals can be set as alerts:

  • .Lower Low: A Lower Low has been confirmed.
  • .Higher Low: A Higher Low has been confirmed.
  • .Higher High: A Higher High has been confirmed.
  • .Lower High: A Lower High has been confirmed.
  • .Buy The Dip: A Higher Low has been confirmed after a Higher High.
  • .Sell The Rally: A Lower High has been confirmed after a Lower Low.
  • .Bullish Break: Market structure is switching from bearish/neutral to bullish.
  • .Bearish Break: Market structure is switching from bullish/neutral to bearish.

Check the Limitations section below to understand on what bar different alerts will be triggered, and be mindful of what you set under the alert Options (Only Once, Once Per Bar Close, etc), in order to get the results you expect.

How to get it

It’s free. Just click this button from the script page on TradingView: Add to favorite Scripts button in TradingView

Limitations

Important: If you’re not seeing what you expect, check your settings and re-read this entire description carefully. Confirming Highs and Lows can get deceptively complex.

By definition, you only know that a Higher High etc has formed when it is confirmed, an unpredictable number of bars afterwards. Therefore, there’s a lot of repainting going on. Don’t worry. It’s still accurate.

HH, LH, LL, HL

These are all confirmed on close, after 1 or more bars. But the label is then applied retroactively, to the candle that was the actual High or Low. During a candle, the most recent label can appear and disappear as the current price changes. Once the candle is closed, the label (or lack of one) is fixed. You probably want to set alerts for these on close.

Breaks

Bullish and Bearish Breaks are confirmed on close. During a candle, the break label on the current candle can appear and disappear. Once the candle is closed, the label (or lack of one) is fixed. Breaks are fixed immediately the candle closes. They’re not retroactively applied to or removed from previous bars. You might want to get an alert for a break as it’s happening, before the candle closes, since they can often end up being large moves. Up to you.

Buy The Dip, Sell The Rally

These signals are shown on the candle that confirms the respective High or Low, not on the High/Low candle itself. They’re confirmed on close.

How to trade with it

These are not signals to be traded on their own. You still need a trade thesis. Use with support & resistance and your other favourite indicators. Works on any market on any timeframe. Be aware that market structure will be different on different timeframes.

Settings

These are all the user-configurable settings and what they do.

  • Show Local Highs and Lows – Displays labels for Higher Highs, Lower Highs, Lower Lows, and Higher Lows. Note that TradingView only displays a limited number of drawings on the chart. Therefore, you can’t examine old parts of the chart with this indicator. It will only work for the most recent bars.
  • Force Confirmation of Highs & Lows After N Bars – When you get a range of inside candles after a big candle, you can wait a long time for a true confirmation. While you’re waiting, high or low wicks can happen that might not later be counted as Highs/Lows even though they look like they “should”. This setting stops waiting for a confirmation on higher/lower close and just confirms the fractal after a certain number of bars, which can also cause its own distortion. There might not be a perfect solution, but the default settings work just fine almost all the time.
  • ▻▻▻ Number of Bars – The number of bars after which to force confirmation. Using a high number, like 20, will not change much; it’s like insurance against any unusually long ranges. Using a low number will significantly increase the number of Highs and Lows displayed. It makes the indicator behave a bit more like other “pivot”-based indicators.
  • Use Short Label Text – Get a less cluttered look with very small labels. Likely to be useful after you’ve got used to the normal labels.
  • ▻▻▻ Colour Scheme – High/Low colour scheme for the labels is green for highs, red for lows. Market Bias is green for bullish, red for bearish, grey for ranging.
  • Show Breaks in Market Structure – Show when market structure breaks from Bearish or Ranging to Bullish, or from Bullish or Ranging to Bearish.
  • Show Buy The Dip, Sell The Rally – Highlights when a Higher Low is confirmed after a Higher High, or a Lower High after a Lower Low..

Credits

The rules for Local Highs and Lows come from my trading mentor. All code is my own.

Support and questions

For any questions about using this indicator, or to report a bug, please leave a comment on the script page on TradingView rather than sending messages.

Technical details

To confirm a candle as a Local High, you need a later candle to Close below its Low. To confirm a Local Low, you need a Close above its High. Higher Highs are bullish and Lower Lows are bearish, and I’ve defined the in-between Highs and Lows as “Ranging”, meaning, neutral. They could be trend continuation or reversal.

A Bullish break in market structure is when the Close of the current candle goes higher than the previous Local High. A Bearish Break is when the Close of the current candle goes lower than the most recent Local Low. I chose to use Close rather than High to reduce edge case weirdness. You can get live warnings by setting the alert to Options: Only Once, because during a candle, the current price is taken as the Close. Breaks are like early warnings of a change in market bias, because you’re not waiting for a High or Low to be formed and confirmed.

Buy The Dip is a label I gave to the first Higher Low in a bullish market structure. Sell The Rally is the first Lower High in a bearish market structure. These might be good buying/selling opportunities, but you still need to do your own analysis to confirm that.

🌍 Share this: