X Period High/Low/Mid

Today we have a simple, but endlessly versatile, indicator that plots the X Period High/Low/Mid of your chosen market.

Traditionally the 52 week High/Low is used as a breakout signal. However, by changing to an X period, and adding a midway line, we create a more versatile indicator that can be tailored to various markets.

By default it's set at 250 periods (because I like the 250 period moving average), and I generally trade H4 and Daily time frames. But tweak it to your liking, you just have to modify the length periods by your desired time frame and lookback length. E.g. to create a 52 week indicator on the daily time frame, enter a length of 260 in the indicator (5 days per week * 52 weeks = 260).

For the above reason, I haven't made this indicator MTF, as there's no real need. However, if users find it easier I can look at adding it later.

Also, the mid point between an X period high/low is often a good trend-follower, as well as acting as support/resistance . I encourage you to experiment with different ways of using this indicator. Entire systems (if your risk management is correct) can be built and traded from this one indicator.

Good luck.

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?