reallywendy

4H Range

reallywendy 已更新   
This script visualizes certain key values based on a 4-hour timeframe of the selected market on the chart. These values include the High, Mid, and Low price levels during each 4-hour period.

These levels can be helpful to identify inside range price action, chop, and consolidation. They can sometimes act as pivots and can be a great reference for potential entries and exits if price continues to hold the same range.

Here's a step-by-step overview of what this indicator does:

1. Inputs: At the beginning of the script, users are allowed to customize some inputs:
Choose the color of lines and labels.
Decide whether to show labels on the chart.
Choose the size of labels ("tiny", "small", "normal", or "large").
Choose whether to display price values in labels.
Set the number of bars to offset the labels to the right.
Set a threshold for the number of ticks that triggers a new calculation of high, mid, and low values.
* Tick settings may need to be increased on equity charts as one tick is usually equal to one cent.
For example, if you want to clear the range when there is a close one point/one dollar above or below the range high/low then on ES
that would be 4 ticks but one whole point on AAPL would be 100 ticks. 100 ticks on an equity chart may or may not be ideal due to
different % change of 100 ticks might be too excessive depending on the price per share.
So be aware that user preferred thresholds can vary greatly depending on which chart you're using.

2. Retrieving Price Data: The script retrieves the high, low, and closing price for every 4-hour period for the current market.
The script also calculates the mid-price of each 4-hour period (the average of the high and low prices).

3. Line Drawing: At the start of the script (first run), it draws three lines (high, mid, and low) at the levels corresponding to the high,
mid, and low prices. Users can also change transparency settings on historical lines to view them. Default setting for historical lines
is for them to be hidden.

4. Updating Lines and Labels: For each subsequent 4-hour period, the script checks whether the close price of the period has gone
beyond a certain threshold (set by user input) above the previous high or below the previous low. If it has, the script deletes the
previous lines and labels, draws new lines at the new high, mid, and low levels, and creates new labels (if the user has opted to
show labels).

5. Displaying Values in the Data Window: In addition to the visual representation on the chart, the script also plots the high, mid, and
low prices. These plotted values appear in the Data Window of TradingView, allowing users to see the exact price levels even when
they're not directly labeled on the chart.

6. Updating Lines and Labels Position: At the end of each period, the script moves the lines and labels (if they're shown) to the right,
keeping them aligned with the current period.

Please note: This script operates based on a 4-hour timeframe, regardless of the timeframe selected on the chart. If a shorter timeframe is selected on the chart, the lines and labels will appear to extend across multiple bars because they represent 4-hour price levels. If a longer timeframe is selected, the lines and labels may not accurately represent high, mid, and low levels within that longer timeframe.
版本注释:
Updated script for users to select the preferred range timeframe to display. This will also allow you to add the script to a chart more than once to show multiple ranges together. You can color code different ranges as you please. I find the 4 hour and daily ranges combined to be helpful. Timeframes included are 5min, 15min, 30min, 240min (4 hour), Daily, Weekly, and Monthly.

开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?