OPEN-SOURCE SCRIPT

Multiple Naked Levels

Theo alfg
PURPOSE OF THE INDICATOR
This indicator autogenerates and displays naked levels and gaps of multiple types collected into one simple and easy to use indicator.

VALUE PROPOSITION OF THE INDICATOR AND HOW IT IS ORIGINAL AND USEFUL
1) CONVENIENCE: The purpose of this indicator is to offer traders with one coherent and robust indicator providing useful, valuable, and often used levels - in one place.
2) CLUSTERS OF CONFLUENCES: With this indicator it is easy to identify levels and zones on the chart with multiple confluences increasing the likelihood of a potential reversal zone.

THE TYPES OF LEVELS AND GAPS INCLUDED IN THE INDICATOR
The types of levels include the following:
1) PIVOT levels (Daily/Weekly/Monthly) depicted in the chart as: dnPIV, wnPIV, mnPIV.
2) POC (Point of Control) levels (Daily/Weekly/Monthly) depicted in the chart as: dnPoC, wnPoC, mnPoC.
3) VAH/VAL STD 1 levels (Value Area High/Low with 1 std) (Daily/Weekly/Monthly) depicted in the chart as: dnVAH1/dnVAL1, wnVAH1/wnVAL1, mnVAH1/mnVAL1
4) VAH/VAL STD 2 levels (Value Area High/Low with 2 std) (Daily/Weekly/Monthly) depicted in the chart as: dnVAH2/dnVAL2, wnVAH2/wnVAL2, mnVAH1/mnVAL2
5) FAIR VALUE GAPS (Daily/Weekly/Monthly) depicted in the chart as: dnFVG, wnFVG, mnFVG.
6) CME GAPS (Daily) depicted in the chart as: dnCME.
7) EQUILIBRIUM levels (Daily/Weekly/Monthly) depicted in the chart as dnEQ, wnEQ, mnEQ.

HOW-TO ACTIVATE LEVEL TYPES AND TIMEFRAMES AND HOW-TO USE THE INDICATOR
You can simply choose which of the levels to be activated and displayed by clicking on the desired radio button in the settings menu.
You can locate the settings menu by clicking into the Object Tree window, left-click on the Multiple Naked Levels and select Settings.
You will then get a menu of different level types and timeframes. Click the checkboxes for the level types and timeframes that you want to display on the chart.
You can then go into the chart and check out which naked levels that have appeared. You can then use those levels as part of your technical analysis.
The levels displayed on the chart can serve as additional confluences or as part of your overall technical analysis and indicators.
In order to back-test the impact of the different naked levels you can also enable tapped levels to be depicted on the chart. Do this by toggling the 'Show tapped levels' checkbox.
Keep in mind however that Trading View can not shom more than 500 lines and text boxes so the indocator will not be able to give you the complete history back to the start for long duration assets.
In order to clean up the charts a little bit there are two additional settings that can be used in the Settings menu:
- Selecting the price range (%) from the current price to be included in the chart. The default is 25%. That means that all levels below or above 20% will not be displayed. You can set this level yourself from 0 up to 100%.
- Selecting the minimum gap size to include on the chart. The default is 1%. That means that all gaps/ranges below 1% in price difference will not be displayed on the chart. You can set the minimum gap size yourself.

BASIC DESCRIPTION OF THE INNER WORKINGS OF THE INDICTATOR
The way the indicator works is that it calculates and identifies all levels from the list of levels type and timeframes above. The indicator then adds this level to a list of untapped levels.
Then for each bar after, it checks if the level has been tapped. If the level has been tapped or a gap/range completely filled, this level is removed from the list so that the levels displayed in the end are only naked/untapped levels.
Below is a descrition of each of the level types and how it is caluclated (algorithm):

PIVOT
Daily, Weekly and Monthly levels in trading refer to significant price points that traders monitor within the context of a single trading day. These levels can provide insights into market behavior and help traders make informed decisions regarding entry and exit points.
Traders often use D/W/M levels to set entry and exit points for trades. For example, entering long positions near support (daily close) or selling near resistance (daily close).
Daily levels are used to set stop-loss orders. Placing stops just below the daily close for long positions or above the daily close for short positions can help manage risk.
The relationship between price movement and daily levels provides insights into market sentiment. For instance, if the price fails to break above the daily high, it may signify bearish sentiment, while a strong breakout can indicate bullish sentiment.
The way these levels are calculated in this indicator is based on finding pivots in the chart on D/W/M timeframe. The level is then set to previous D/W/M close = current D/W/M open.
In addition, when price is going up previous D/W/M open must be smaller than previous D/W/M close and current D/W/M close must be smaller than the current D/W/M open. When price is going down the opposite.

POINT OF CONTROL
The Point of Control (POC) is a key concept in volume profile analysis, which is commonly used in trading.
It represents the price level at which the highest volume of trading occurred during a specific period.
The POC is derived from the volume traded at various price levels over a defined time frame. In this indicator the timeframes are Daily, Weekly, and Montly.
It identifies the price level where the most trades took place, indicating strong interest and activity from traders at that price.
The POC often acts as a significant support or resistance level. If the price approaches the POC from above, it may act as a support level, while if approached from below, it can serve as a resistance level. Traders monitor the POC to gauge potential reversals or breakouts.
The way the POC is calculated in this indicator is by an approximation by analysing intrabars for the respective timeperiod (D/W/M), assigning the volume for each intrabar into the price-bins that the intrabar covers and finally identifying the bin with the highest aggregated volume.
The POC is the price in the middle of this bin.
The indicator uses a sample space for intrabars on the Daily timeframe of 15 minutes, 35 minutes for the Weekly timeframe, and 140 minutes for the Monthly timeframe.
The indicator has predefined the size of the bins to 0.2% of the price at the range low. That implies that the precision of the calulated POC og VAH/VAL is within 0.2%.
This reduction of precision is a tradeoff for performance and speed of the indicator.
This also implies that the bigger the difference from range high prices to range low prices the more bins the algorithm will iterate over. This is typically the case when calculating the monthly volume profile levels and especially high volatility assets such as alt coins.
Sometimes the number of iterations becomes too big for Trading View to handle. In these cases the bin size will be increased even more to reduce the number of iterations.
In such cases the bin size might increase by a factor of 2-3 decreasing the accuracy of the Volume Profile levels.
Anyway, since these Volume Profile levels are approximations and since precision is traded for performance the user should consider the Volume profile levels(POC, VAH, VAL) as zones rather than pin point accurate levels.

VALUE AREA HIGH/LOW STD1/STD2
The Value Area High (VAH) and Value Area Low (VAL) are important concepts in volume profile analysis, helping traders understand price levels where the majority of trading activity occurs for a given period.
The Value Area High/Low is the upper/lower boundary of the value area, representing the highest price level at which a certain percentage of the total trading volume occurred within a specified period.
The VAH/VAL indicates the price point above/below which the majority of trading activity is considered less valuable. It can serve as a potential resistance/support level, as prices above/below this level may experience selling/buying pressure from traders who view the price as overvalued/undervalued
In this indicator the timeframes are Daily, Weekly, and Monthly. This indicator provides two boundaries that can be selected in the menu.
The first boundary is 70% of the total volume (=1 standard deviation from mean). The second boundary is 95% of the total volume (=2 standard deviation from mean).
The way VAH/VAL is calculated is based on the same algorithm as for the POC.
However instead of identifying the bin with the highest volume, we start from range low and sum up the volume for each bin until the aggregated volume = 30%/70% for VAL1/VAH1 and aggregated volume = 5%/95% for VAL2/VAH2.
Then we simply set the VAL/VAH equal to the low of the respective bin.

FAIR VALUE GAPS
Fair Value Gaps (FVG) is a concept primarily used in technical analysis and price action trading, particularly within the context of futures and forex markets. They refer to areas on a price chart where there is a noticeable lack of trading activity, often highlighted by a significant price movement away from a previous level without trading occurring in between.
FVGs represent price levels where the market has moved significantly without any meaningful trading occurring. This can be seen as a "gap" on the price chart, where the price jumps from one level to another, often due to a rapid market reaction to news, events, or other factors.
These gaps typically appear when prices rise or fall quickly, creating a space on the chart where no transactions have taken place. For example, if a stock opens sharply higher and there are no trades at the prices in between the two levels, it creates a gap. The areas within these gaps can be areas of liquidity that the market may return to “fill” later on.
FVGs highlight inefficiencies in pricing and can indicate areas where the market may correct itself. When the market moves rapidly, it may leave behind price levels that traders eventually revisit to establish fair value.
Traders often watch for these gaps as potential reversal or continuation points. Many traders believe that price will eventually “fill” the gap, meaning it will return to those price levels, providing potential entry or exit points.
This indicator calculate FVGs on three different timeframes, Daily, Weekly and Montly.
In this indicator the FVGs are identified by looking for a three-candle pattern on a chart, signalling a discrete imbalance in order volume that prompts a quick price adjustment. These gaps reflect moments where the market sentiment strongly leans towards buying or selling yet lacks the opposite orders to maintain price stability.
The indicator sets the gap to the difference from the high of the first bar to the low of the third bar when price is moving up or from the low of the first bar to the high of the third bar when price is moving down.

CME GAPS (BTC only)
CME gaps refer to price discrepancies that can occur in charts for futures contracts traded on the Chicago Mercantile Exchange (CME). These gaps typically arise from the fact that many futures markets, including those on the CME, operate nearly 24 hours a day but may have significant price movements during periods when the market is closed.
CME gaps occur when there is a difference between the closing price of a futures contract on one trading day and the opening price on the following trading day. This difference can create a "gap" on the price chart.
Opening Gaps: These usually happen when the market opens significantly higher or lower than the previous day's close, often influenced by news, economic data releases, or other market events occurring during non-trading hours.
Gaps can result from reactions to major announcements or developments, such as earnings reports, geopolitical events, or changes in economic indicators, leading to rapid price movements.
The importance of CME Gaps in Trading is the potential for Filling Gaps: Many traders believe that prices often "fill" gaps, meaning that prices may return to the gap area to establish fair value.
This can create potential trading opportunities based on the expectation of gap filling. Gaps can act as significant support or resistance levels. Traders monitor these levels to identify potential reversal points in price action.
The way the gap is identified in this indicator is by checking if current open is higher than previous bar close when price is moving up or if current open is lower than previous day close when price is moving down.

EQUILIBRIUM
Equilibrium in finance and trading refers to a state where supply and demand in a market balance each other, resulting in stable prices. It is a key concept in various economic and trading contexts. Here’s a concise description:
Market Equilibrium occurs when the quantity of a good or service supplied equals the quantity demanded at a specific price level. At this point, there is no inherent pressure for the price to change, as buyers and sellers are in agreement.
Equilibrium Price is the price at which the market is in equilibrium. It reflects the point where the supply curve intersects the demand curve on a graph. At the equilibrium price, the market clears, meaning there are no surplus goods or shortages.
In this indicator the equilibrium level is calculated simply by finding the midpoint of the Daily, Weekly, and Montly candles respectively.

NOTES
1) Performance. The algorithms are quite resource intensive and the time it takes the indicator to calculate all the levels could be 5 seconds or more, depending on the number of bars in the chart and especially if Montly Volume Profile levels are selected (POC, VAH or VAL).
2) Levels displayed vs the selected chart timeframe. On a timeframe smaller than the daily TF - both Daily, Weekly, and Monthly levels will be displayed. On a timeframe bigger than the daily TF but smaller than the weekly TF - the Weekly and Monthly levels will be display but not the Daily levels. On a timeframe bigger than the weekly TF but smaller than the monthly TF - only the Monthly levels will be displayed. Not Daily and Weekly.

CREDITS
The core algorithm for calculating the POC levels is based on the indicator "Naked Intrabar POC" developed by rumpypumpydumpy (https:tradingview.com/u/rumpypumpydumpy/).
The "Naked intrabar POC" indicator calculates the POC on the current chart timeframe.
This indicator (Multiple Naked Levels) adds two new features:
1) It calculates the POC on three specific timeframes, the Daily, Weekly, and Monthly timeframes - not only the current chart timeframe.
2) It adds functionaly by calculating the VAL and VAH of the volume profile on the Daily, Weekly, Monthly timeframes .
Pivot points and levelsVolume Profile

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Thông báo miễn trừ trách nhiệm