A popular analysis technique among traders is to use statistical price data over a given time range. For example, a trader might want to examine the average price range for the time period of 9:30 am - 10:00 am EST (commonly referred to as the Opening Range), and compare the average range to the current, live range as it forms.
What this Script Does
This script allows a user to monitor the current price range against the average price range of up to six different periods of time (sessions). The data is presented in a table in the chart window, with four stats listed per session:
Range: This is the most recent (or current) price range for the session. This value is updated in real-time as the price range forms.
Avg: This is the average price range for the session. (See below for how this is calculated.)
Diff: This is the price difference between the most recent (or current) price range of the session and the average price range of the session. When the most recent price range is smaller than the average, this will be a negative number. This value is updated in real-time as the price range forms.
Range %: This is the percent value of the most recent (or current) price range of the session compared to the average price range of the session. For example, If the most recent price range was half that of the average price range, the Range % would be 50%. If the most recent price range was twice that of the average price range, the Range % would be 200%. A Range % value of 100% indicates that the most recent price range is equal to the average price range. This value is updated in real-time as the price range forms.
What Makes this Script Unique
While this is not the only publicly available average range script, what makes it unique is the complete user control over up to six sessions (including overlapping sessions) and the display of that data.
Scope of this Script
This script is intended for use on intraday timeframes only. It will not calculate properly on daily or higher timeframes. Additionally, for the calculation to be correct, the input session must be evenly divisible by the chart timeframe. For example, if the user inputs a session that is 30 minutes long (e.g., 9:30 am - 10:00 am), then the calculations would be correct on the 1, 2, 3, 5, 10, 15, and 30-minute timeframes only.
User Inputs
This script was written to provide the user with maximum control over the range data and how that data is displayed. These are the user inputs:
Data - Input the number of days used to calculate the average price range of the sessions. This input is applied to all six sessions. The default value is 10.
Sessions - There are six sessions the user can set. Checking the box next to a session will cause that session data to be calculated and displayed. This allows the user to turn on or off a session at their discretion. The default value are displayed in the chart image above.
Visibility - Checking this box will cause the range data to be displayed only when the range is currently forming (i.e., live price is within the session). This allows the user to display the data from multiple sessions only when needed.
Visual Styles - This section has controls for how the data table is displayed. The user can select the table position, colors and border, and text size.
تم نشر هذا النص البرمجي بمصدر غير مفتوح ويمكنك استخدامه بحرية. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني. لا يمكنك مشاهدة أو تعديل كود المصدر الخاص به.
هل تريد استخدام هذا النص البرمجي على الرسم البياني؟
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.