OPEN-SOURCE SCRIPT

Average Range Lines

Telah dikemas kini
This Average Range Lines indicator identifies high and low price levels based on a chosen time period (day, week, month, etc.) and then uses a simple moving average over the length of the lookback period chosen to project support and resistance levels, otherwise referred to as average range. The calculation of these levels are slightly different than Average True Range and I have found this to be more accurate for intraday price bounces.

Lines are plotted and labeled on the chart based on the following methodology:
+3.0: 3x the average high over the chosen timeframe and lookback period.
+2.5: 2.5x the average high over the chosen timeframe and lookback period.
+2.0: 2x the average high over the chosen timeframe and lookback period.
+1.5: 1.5x the average high over the chosen timeframe and lookback period.
+1.0: The average high over the chosen timeframe and lookback period.
+0.5: One-half the average high over the chosen timeframe and lookback period.
Open: Opening price for the chosen time period.
-0.5: One-half the average low over the chosen timeframe and lookback period.
-1.0: The average low over the chosen timeframe and lookback period.
-1.5: 1.5x the average low over the chosen timeframe and lookback period.
-2.0: 2x the average low over the chosen timeframe and lookback period.
-2.5: 2.5x the average low over the chosen timeframe and lookback period.
-3.0: 3x the average low over the chosen timeframe and lookback period.

Look for price to find support or resistance at these levels for either entries or to take profit. When price crosses the +/- 2.0 or beyond, the likelihood of a reversal is very high, especially if set to weekly and monthly levels.

This indicator can be used/viewed on any timeframe. For intraday trading and viewing on a 15 minute or less timeframe, I recommend using the 4 hour, 1 day, and/or 1 week levels. For swing trading and viewing on a 30 minute or higher timeframe, I recommend using the 1 week, 1 month, or longer timeframes. I don’t believe this would be useful on a 1 hour or less timeframe, but let me know if the comments if you find otherwise.

Based on my testing, recommended lookback periods by timeframe include:
Timeframe: 4 hour; Lookback period: 60 (recommend viewing on a 5 minute or less timeframe)
Timeframe: 1 day; Lookback period: 10 (also check out 25 if your chart doesn’t show good support/resistance at 10 days lookback – I have found 25 to be useful on charts like SPX)
Timeframe: 1 week; Lookback period: 14
Timeframe: 1 month; Lookback period: 10

The line style and colors are all editable. You can apply a global coloring scheme in the event you want to add this indicator to your chart multiple times with different time frames like I do for the weekly and monthly.

I appreciate your comments/feedback on this indicator to improve. Also let me know if you find this useful, and what settings/ticker you find it works best with!

Also check out my profile for more indicators!
Nota Keluaran
Photo update to show line labels
Nota Keluaran
Updated label code to prevent duplicate labels for the same line.
Nota Keluaran
Updated label spacing to place it beyond the current candle and avoid overlap.
Nota Keluaran
Updating the coding to accurately reflect the full average range and labels and added to more line levels on both the positive and negative sides.

With this update, the +/- 1.0 refers to the full range of the timeframe and period selected (e.g. 10 days, 14 weeks, 10 months, etc.). If a stock moves from open to the +1.0 level, that's a full move for that period and likely exhausted if looking at a daily timeframe.

Highly recommend looking to play from level to level using this indicator whether trading intraday on the 4 hour / daily levels, or swinging on the weekly / monthly levels (note: If you do go down to the 4 hour, I recommend using 60 periods.) Consider utilizing a 2nd indicator for confluence on the support/resistance at these levels, such as the RSI.

Also, note the image update shows weekly levels in purple, and monthly levels in teal. Add this indicator to your chart twice or more to show multiple levels.
averageAverage True Range (ATR)movingrangesimpleSimple Moving Average (SMA)simplemovingaveragesSupport and Resistancetruerange

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?


Juga pada:

Penafian