Volume/Market Profile

SamRecio מעודכן   
Volume/Market Profile is a 2 in 1 Volume Profile and Market Profile Indicator.
This indicator is my own calculations for compiling a volume profile and market profile.
The profile is progressively calculated live as the chart develops.
I have made use of both Boxes AND Lines to allow me to display a finer granularity profile by displaying up to twice the max amount of lines allowed in tradingview.
I have spent a lot of time to make sure the values are getting appended exactly as intended so that I can assure this profile is operating as precisely as possible within the limitations of the data available.
To make my calculations easier to use in other places, I have made my volume profile a function that can be extracted and used whenever you need values from a volume profile.
Feel free to read through the script if you don't understand how this profile is developed. I have made a commentary of my volume profile function to help you understand what exactly happens to compile the profiles.
As mentioned before, This indicator doubles as a market profile. To view both at the same time you will need to add the indicator on your chart twice.
I have built in comprehensive customizations to allow you to display your profiles however fits your needs.

Timeframe: The aggregation period for profiles, to see a 1 week profile, change the timeframe to 1 week.
Note: You can add custom timeframes by adding a custom timeframe in your chart timeframe dropdown menu. When you add timeframes in this area, they appear as options within indicators with the timeframe input.
Sensitivity: Allows for greater or less granularity changes. The calculation method for granularity automatically changes depending on the range of your chart.
Note: Multiply this value by 100 and that will be the max range (in ticks) of your price before the indicator automatically adjusts to make the profile less granular. (ex. If price ranges $1, and 1 tick is $0.01, granularity will be 0.01 with a sensitivity of 1+)
Value Area %: % of total volume to display as the value zone. (_% of total profile values are contained within the value zone)
Calculate as Market Profile: Uses a 1 Instead of the candle volume, to display a Market Profile. (If selected POC -> TPOC)
Display Size: Sets the # of bars from the profile axis to the profile's max value. If set negative, profile will be displayed left of axis, if positive, profile will be displayed to the right of the axis.
Display Offset: Sets the # of bars in front(or behind) the current chart bar to set the axis of the profile. If negative, the axis will be to the left of the current chart bar, if positive the axis will be right of the current chart bar.
Display Historical POC/VAH/VAL: Choose to display historical poc,vah,val lines.
Colors: I'm not explaining colors.
הערות שחרור:
-Added a new error condition. Incase your Profile Timeframe is too large for the chart you're on. (ex. 5min timeframe trying to look at a 12 month profile) The chart doesn't have that data on such a low timeframe, so now you'll get an error.
הערות שחרור:
-Added an option to display the current poc/vah/val as lines across your bars instead of only on the profile.
- Moved the "Display historical..." setting into its own group with the newly added option, now under "Additional Data Displays"
הערות שחרור:
MAJOR UPDATE: Notes first then more details below.
1. Lookback Calculation Added
2. High/Low Volume Area Added
3. Lowest Volume Area Removed
4. Progressive VP Calc minor Bug fix

In my examples I will talk about a daily volume profile on a 5 minute chart.
1) I have created a lookback volume profile calculation that translates your requested timeframe into the proper number of bars and then displays a profile created from the # of lookback bars.
The lookback profile does not reset on ever new day, rather it looks at how long the previous day was and displays a profile for that length back of data, by doing this, your lookback profile will always be relevant to the data you want to see, and all the bar conversions are done behind the scenes.
The calculation was created with different sessions, and chart types in mind. It does not (by default) use a static lookback bars number, it will determine the proper amount of bars to view a profile at the length of the time you requested. If you look at a 1 day profile on a 5 min RTH chart you will typically get a 77 bar profile, except if you were to switch to the ETH version of the chart, you will get a 191 bar profile, this is due to the the dynamic lookback bar calculation style, It is still giving you a profile from yesterday at the same time.
This method would fail if it were only checking the previous day's length of bars and updating on every new day with a new lookback. If there were a short day, the profile on the following day would start phasing out data before the day is over. Because of this, I am checking the length of the the current day, as well as the length of the previous day and taking the greatest of the 2 updating on every bar, to give you an entire day's profile even after a short day.
After identifying this I realized a contrary argument, "If I input 4H, I want to see a profile from the last 4 Hours".
Because of this, The lookback calculation uses a different determination method for intraday timeframe requests, vs DWM timeframe requests.
It works like this:
If you use a timeframe for a lookback profile that is 1 day or larger, the lookback will be determined based on the number of Days, Weeks, Months, Etc. requested. These lengths can change depending on the length of the D/W/M.
If you use a timeframe for a lookback profile that is less than 1 day, you will see that amount of time in bars back. A 240min(4Hour) profile on a 5 min chart will ALWAYS be 48 bars.

If you want to use a lookback calculation of a specific number of bars, you can override the lookback calculation at the bottom of the settings.

2. You can now choose to color zones with High/Low volume relative to the POC's volume.
Example: Low Volume % = 10; will color every node with volume equal-to or Less than 10% of the POC's volume.
Example: High Volume % = 90; will color every node with volume equal-to or Greater Than 90% of the POC's volume.

3.With the addition of High/Low volume zones, the least volume area was no longer necessary .

4.Previously the VP was including data from the starting bar, but then writing to the same indexes in same bar. It ended up only minorly effecting the entire profile, but I noticed it when comparing the 2 calculations.
Simple terms: The previous Progressive calculation was including double data for the first bar, no longer.

Please feel free to ask any questions you may have about this update, I have also included tooltips in the Settings for quick references of this data.
הערות שחרור:
Identified an error causing a slight inaccuracy in profile calculation.
This issue was solved by moving the z_point variable definition from outside, to inside the "Input Values" loop(Line 101)
הערות שחרור:
Removed High/Low Volume % Zones
Replaced with High/Low Volume Nodes via. Cluster Identification

My Volume Cluster ID method can be easily explained as vertical Pivot Points through out the Profile.

Determination method for normal Pivot points: Pick a point, Check bars left, Check bars right, If nothing else is higher (or lower), mark it as a pivot point.
Determination method for VMP: Pick a point, Check bars down, Check bars up, it the point is the highest (or lowest) point OR within the allowed amount of tolerance from the highest or lowest point, mark it as a node point.

"Analysis width" is the specific number of indexes to check up and down
"% Tolerance" (signified as only '%' in the settings) widens or narrows the included values based on % from the highest (or lowest) in the node

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יכולים להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אך שימוש חוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.

רוצה להשתמש בסקריפ זה בגרף?