Forex Heatmap█ OVERVIEW
This indicator creates a dynamic grid display of currency pair cross rates (exchange rates) and percentage changes, emulating the Cross Rates and Heat Map widgets available on our Forex page. It provides a view of realtime exchange rates for all possible pairs derived from a user-specified list of currencies, allowing users to monitor the relative performance of several currencies directly on a TradingView chart.
█ CONCEPTS
Foreign exchange
The Foreign Exchange (Forex/FX) market is the largest, most liquid financial market globally, with an average daily trading volume of over 5 trillion USD. Open 24 hours a day, five days a week, it operates through a decentralized network of financial hubs in various major cities worldwide. In this market, participants trade currencies in pairs , where the listed price of a currency pair represents the exchange rate from a given base currency to a specific quote currency . For example, the "EURUSD" pair's price represents the amount of USD (quote currency) that equals one unit of EUR (base currency). Globally, the most traded currencies include the U.S. dollar (USD), Euro (EUR), Japanese yen (JPY), British pound (GBP), and Australian dollar (AUD), with USD involved in over 87% of all trades.
Understanding the Forex market is essential for traders and investors, even those who do not trade currency pairs directly, because exchange rates profoundly affect global markets. For instance, fluctuations in the value of USD can impact the demand for U.S. exports or the earnings of companies that handle multinational transactions, either of which can affect the prices of stocks, indices, and commodities. Additionally, since many factors influence exchange rates, including economic policies and interest rate changes, analyzing the exchange rates across currencies can provide insight into global economic health.
█ FEATURES
Requesting a list of currencies
This indicator requests data for every valid currency pair combination from the list of currencies defined by the "Currency list" input in the "Settings/Inputs" tab. The list can contain up to six unique currency codes separated by commas, resulting in a maximum of 30 requested currency pairs.
For example, if the specified "Currency list" input is "CAD, USD, EUR", the indicator requests and displays relevant data for six currency pair combinations: "CADUSD", "USDCAD", "CADEUR", "EURCAD", "USDEUR", "EURUSD". See the "Grid display" section below to understand how the script organizes the requested information.
Each item in the comma-separated list must represent a valid currency code. If the "Currency list" input contains an invalid currency code, the corresponding cells for that currency in the "Cross rates" or "Heat map" grid show "NaN" values. If the list contains empty items, e.g., "CAD, ,EUR, ", the indicator ignores them in its data requests and calculations.
NOTE: Some uncommon currency pair combinations might not have data feeds available. If no available symbols provide the exchange rates between two specified currencies, the corresponding table cells show "NaN" results.
Realtime data
The indicator retrieves realtime market prices, daily price changes, and minimum tick sizes for all the currency pairs derived from the "Currency list" input. It updates the retrieved information shown in its grid display after new ticks become available to reflect the latest known values.
NOTE: Pine scripts execute on realtime bars only when new ticks are available in the chart's data feed. If no new updates are available from the chart's realtime feed, it may cause a delay in the data the indicator receives.
Grid display
This indicator displays the requested data for each currency pair in a table with cells organized as a grid. Each row name corresponds to a pair's base currency , and each column name corresponds to a quote currency . The cell at the intersection of a specific row and column shows the value requested from the corresponding currency pair.
For example, the cell at the intersection of a "EUR" row and "USD" column shows the data retrieved for the "EURUSD" currency pair, and the cell at the "USD" row and "EUR" column shows data for the inverse pair ("USDEUR").
Note that the main diagonal cells in the table, where rows and columns with the same names intersect, are blank. The exchange rate from one currency to itself is always 1, and no Forex symbols such as "EUREUR" exist.
The dropdown input at the top of the "Settings/Inputs" tab determines the type of information displayed in the table. Two options are available: "Cross rates" and "Heat map" . Both modes color their cells for light and dark themes separately based on the inputs in the "Colors" section.
Cross rates
When a user selects the "Cross rates" display mode, the table's cells show the latest available exchange rate for each currency pair, emulating the behavior of the Cross Rates widget. Each cell's value represents the amount of the quote currency (column name) that equals one unit of the base currency (row name). This display allows users to compare cross rates across currency pairs, and their inverses.
The background color of each cell changes based on the most recent update to the exchange rate, allowing users to monitor the direction of short-term fluctuations as they occur. By default, the background turns green (positive cell color) when the cross rate increases from the last recorded update and red (negative cell color) when the rate decreases. The cell's color reverts to the chart's background color after no new updates are available for 200 milliseconds.
Heat map
When a user selects the "Heat map" display mode, the table's cells show the latest daily percentage change of each currency pair, emulating the behavior of the Heat Map widget.
In this mode, the background color of each cell depends on the corresponding currency pair's daily performance. Heat maps typically use colors that vary in intensity based on the calculated values. This indicator uses the following color coding by default:
• Green (Positive cell color): Percentage change > +0.1%
• No color: Percentage change between 0.0% and +0.1%
• Bright red (Negative cell color): Percentage change < -0.1%
• Lighter/darker red (Minor negative cell color): Percentage change between 0.0% and -0.1%
█ FOR Pine Script™ CODERS
• This script utilizes dynamic requests to iteratively fetch information from multiple contexts using a single request.security() instance in the code. Previously, `request.*()` functions were not allowed within the local scopes of loops or conditional structures, and most `request.*()` function parameters, excluding `expression`, required arguments of a simple or weaker qualified type. The new `dynamic_requests` parameter in script declaration statements enables more flexibility in how scripts can use `request.*()` calls. When its value is `true`, all `request.*()` functions can accept series arguments for the parameters that define their requested contexts, and `request.*()` functions can execute within local scopes. See the Dynamic requests section of the Pine Script™ User Manual to learn more.
• Scripts can execute up to 40 unique `request.*()` function calls. A `request.*()` call is unique only if the script does not already call the same function with the same arguments. See this section of the User Manual's Limitations page for more information.
• Typically, when requesting higher-timeframe data with request.security() using barmerge.lookahead_on as the `lookahead` argument, the `expression` argument should use the history-referencing operator to offset the series, preventing lookahead bias on historical bars. However, the request.security() call in this script uses barmerge.lookahead_on without offsetting the `expression` because the script only displays results for the latest historical bar and all realtime bars, where there is no future information to leak into the past. Instead, using this call on those bars ensures each request fetches the most recent data available from each context.
• The request.security() instance in this script includes a `calc_bars_count` argument to specify that each request retrieves only a minimal number of bars from the end of each symbol's historical data feed. The script does not need to request all the historical data for each symbol because it only shows results on the last chart bar that do not depend on the entire time series. In this case, reducing the retrieved bars in each request helps minimize resource usage without impacting the calculated results.
Look first. Then leap.
Heatmap
Momentum Nexus Oscillator [UAlgo]The "Momentum Nexus Oscillator " indicator is a comprehensive momentum-based tool designed to provide traders with visual cues on market conditions using multiple oscillators. By combining four popular technical indicators—RSI (Relative Strength Index), VZO (Volume Zone Oscillator), MFI (Money Flow Index), and CCI (Commodity Channel Index)—this heatmap offers a holistic view of the market's momentum.
The indicator plots two lines: one representing the current chart’s combined momentum score and the other representing a higher timeframe’s (HTF) score, if enabled. Through smooth gradient color transitions and easy-to-read signals, the Momentum Nexus Heatmap allows traders to easily identify potential trend reversals or continuation patterns.
Traders can use this tool to detect overbought or oversold conditions, helping them anticipate possible long or short trade opportunities. The option to use a higher timeframe enhances the flexibility of the indicator for longer-term trend analysis.
🔶 Key Features
Multi-Oscillator Approach: Combines four popular momentum oscillators (RSI, VZO, MFI, and CCI) to generate a weighted score, providing a comprehensive picture of market momentum.
Dynamic Color Heatmap: Utilizes a smooth gradient transition between bullish and bearish colors, reflecting market momentum across different thresholds.
Higher Timeframe (HTF) Compatibility: Includes an optional higher timeframe input that displays a separate score line based on the same momentum metrics, allowing for multi-timeframe analysis.
Customizable Parameters: Adjustable RSI, VZO, MFI, and CCI lengths, as well as overbought and oversold levels, to match the trader’s strategy or preference.
Signal Alerts: Built-in alert conditions for both the current chart and higher timeframe scores, notifying traders when long or short entry signals are triggered.
Buy/Sell Signals: Displays visual signals (▲ and ▼) on the chart when combined scores reach overbought or oversold levels, providing clear entry cues.
User-Friendly Visualization: The heatmap is separated into four sections representing each indicator, providing a transparent view of how each contributes to the overall momentum score.
🔶 Interpreting Indicator:
Combined Score
The indicator generates a combined score by weighing the individual contributions of RSI, VZO, MFI, and CCI. This score ranges from 0 to 100 and is plotted as a line on the chart. Lower values suggest potential oversold conditions, while higher values indicate overbought conditions.
Color Heatmap
The indicator divides the combined score into four distinct sections, each representing one of the underlying momentum oscillators (RSI, VZO, MFI, and CCI). Bullish (greenish) colors indicate upward momentum, while bearish (grayish) colors suggest downward momentum.
Long/Short Signals
When the combined score drops below the oversold threshold (default is 26), a long signal (▲) is displayed on the chart, indicating a potential buying opportunity.
When the combined score exceeds the overbought threshold (default is 74), a short signal (▼) is shown, signaling a potential sell or short opportunity.
Higher Timeframe Analysis
If enabled, the indicator also plots a line representing the combined score for a higher timeframe. This can be used to align lower timeframe trades with the broader trend of a higher timeframe, providing added confirmation.
Signals for long and short entries are also plotted for the higher timeframe when its combined score reaches overbought or oversold levels.
🔶Purpose of Using Multiple Technical Indicators
The combination of RSI, VZO, MFI, and CCI in the Momentum Nexus Heatmap provides a comprehensive approach to analyzing market momentum by leveraging the unique strengths of each indicator. This multi-indicator method minimizes the limitations of using just one tool, resulting in more reliable signals and a clearer understanding of market conditions.
RSI (Relative Strength Index)
RSI contributes by measuring the strength and speed of recent price movements. It helps identify overbought or oversold levels, signaling potential trend reversals or corrections. Its simplicity and effectiveness make it one of the most widely used indicators in technical analysis, contributing to momentum assessment in a straightforward manner.
VZO (Volume Zone Oscillator)
VZO adds the critical element of volume to the analysis. By assessing whether price movements are supported by significant volume, VZO distinguishes between price changes that are driven by real market conviction and those that might be short-lived. It helps validate the strength of a trend or alert the trader to potential weakness when price moves are unsupported by volume.
MFI (Money Flow Index)
MFI enhances the analysis by combining price and volume to gauge money flow into and out of an asset. This indicator provides insight into the participation of large players in the market, showing if money is pouring into or exiting the asset. MFI acts as a volume-weighted version of RSI, giving more weight to volume shifts and helping traders understand the sustainability of price trends.
CCI (Commodity Channel Index)
CCI contributes by measuring how far the price deviates from its statistical average. This helps in identifying extreme conditions where the market might be overextended in either direction. CCI is especially useful for spotting trend reversals or continuations, particularly during market extremes, and for identifying divergence signals.
🔶 Disclaimer
Use with Caution: This indicator is provided for educational and informational purposes only and should not be considered as financial advice. Users should exercise caution and perform their own analysis before making trading decisions based on the indicator's signals.
Not Financial Advice: The information provided by this indicator does not constitute financial advice, and the creator (UAlgo) shall not be held responsible for any trading losses incurred as a result of using this indicator.
Backtesting Recommended: Traders are encouraged to backtest the indicator thoroughly on historical data before using it in live trading to assess its performance and suitability for their trading strategies.
Risk Management: Trading involves inherent risks, and users should implement proper risk management strategies, including but not limited to stop-loss orders and position sizing, to mitigate potential losses.
No Guarantees: The accuracy and reliability of the indicator's signals cannot be guaranteed, as they are based on historical price data and past performance may not be indicative of future results.
[DarkTrader] Pivot Point HeatmapThe indicator calculates pivot points using price data from different timeframes such as 12M, 1M, 1W, 3D, and 1D. For each timeframe, it retrieves the high, low, open, and close prices of the previous bar. The pivot point is calculated as the average of the high, low, and close prices, which provides a central level where market sentiment may shift. This calculation is repeated for each timeframe, ensuring a multi-dimensional view of potential interest zones.
Importance of Pivot Points :
Pivot points are essential tools in technical analysis, providing traders with levels that act as potential support and resistance zones. These zones help identify price levels where reversals or breakouts are more likely to occur.
Visual Representation :
The core feature of this indicator is its ability to visualize pivot points as a heatmap on the chart. Instead of showing just the latest pivot points, it tracks the historical pivot swipe, providing a dynamic view of how price interacts with these key levels. Each pivot point is represented by a line, color-coded based on its position relative to other points, creating a gradient effect that highlights the most critical price areas.
Customization Options :
Traders can customize various aspects of the heatmap to suit their preferences. The indicator offers options to toggle pivot swipe history, enabling traders to either focus on the most recent price interactions or consider how price has behaved over time. The background color and pivot line colors are fully customizable, making it easy to match the heatmap with your chart's theme or emphasize certain price levels.
Detecting Sweeps and Price Interaction :
Another important feature is the detection of price interactions with pivot levels. If the current bar's high and low cross a pivot point, it signals that the pivot level has been "swept" by price action, potentially indicating a change in market sentiment. The indicator either extends the line if the pivot point remains relevant or deletes it if price has broken through. This dynamic adjustment helps traders stay updated on which pivot levels are still valid.
Volume Analysis - Heatmap and Volume ProfileHello All!
I have a new toy for you! Volume Analysis - Heatmap and Volume Profile . Honestly I started to work to develop Volume Heatmap then I decided to improve it and add more features such Volume profile, volume, difference in Buy/Sell volumes etc. I tried to put my abilities into this script and tried to use some new Pine Language™ features ( method, force_overlay, enum etc features ). I hope the usage of these new features would be an example for Pine Programmers.
Lets talk about how it works:
- It gets number of Rows/Columns from the user for each candle to create heatmap
- It calculates the number of the candles to analyze. Number of the candles may change by number of Rows/columns or if any volume / difference in volumes / volume profile is enabled
- It gets Closing/Opening price, Volume and Time info from lower time frame for each candle ( it can be up to 100K for each candle )
- After getting the data it calculates lower time frame to analyze
- Then it calculates how closing price moves, how much volume on each move and create boxes by the volume/move in each box
- The colors for each box calculated by volume info and closing price movements in the lower time frame
- It shows the boxes on Absolute places or Zero Line optionally
- it shows Volume, Cumulative volume, Difference between Buy/Sell volume for each column
- it changes empty box color by Chart background color, also you can change transparency
- At this time it creates Volume Profile with up to 25 rows
- As a new Pine Language™ feature, it can show Volume Profile in the indicator window or in Main chart, shows Value Area, Value Area High (VAH), Value Area Low (VAL), and draw it and POC (Point Of Control) in the indicator window and/or in the main chart
- Honestly the feature I like is that: For the markets that are not open 24/7, it combines the data from the lower time period without any gaps. For example, if you work for a market that is closed on Saturdays and Sundays, it ensures data integrity by omitting weekends and holidays. so for example if the data is like "ABC---DEF-X---YL-Z" then it makes this data like "ABCDEFXYLZ". In this way, there will be no data breaks in the displayed boxes, there will be no empty colons, and it will appear as if data is coming in at any time.
- Finally it shows Info Panel to give info, its background color automatically changes by the Chart background color
- Important! You should set your "Plan" accordingly, your plan is "Premium or Higher" or "Lower tier". so the script can understand the minimum time frame it can get data!!
I tried to share many screenshots below to explain it much better
How it looks?
it shows Highest Buy/Sell volumes brighter, move volume -> brighter
Volume Profile ( up to 25 row s) ( number of contained candles should be more than 1 )
Volume Profile can be shown in the main chart optionally
How the main chart looks:
Closing price shown and you can enable it, change colors & line width
Can include many candles according to Row&Column number you set
Optionally it can show cumulative volume for each candle
Closing prices from lower time frame
Shows Candle Body by changing background colors
It can shows all included candles on Zero line
You can change the colors of many things
You can set Empty box and border transparency
Table, Empty box Colors adjustment done automatically by chart background color
Sometimes we can not get data from some historical candles if time frame is high such 2days, 1 week etc, and it looks like:
It also checks if Chart time frame and Chart type is suitable
Enjoy!
VIX-Heatmap [CrossTrade]The "VIX-Heatmap" is a sophisticated and informative indicator designed for traders who want to integrate volatility analysis into their trading strategy, especially focusing on the market's fear gauge, the VIX (Volatility Index). This tool is not just about plotting numbers; it's about visualizing market sentiment in a more intuitive and impactful way.
Key Features and Customization Options:
1. Primary Functionality:
At its core, the VIX-Heatmap tracks the daily closing price of the VIX. It provides a clear, line-based visualization, with the line color set to black for stark contrast and easy visibility.
2. Segmented Volatility Levels:
The indicator allows users to set multiple VIX levels: Danger Zone (super low VIX level), and Levels 1 through 5. These levels are represented as horizontal lines on the chart, offering a structured view of different volatility thresholds.
3. Customizable Thresholds:
Traders can input their preferred values for each level, tailoring the indicator to fit their perception of market risk and volatility. This customization makes the tool versatile for different trading styles and market conditions.
4. Heatmap Visualization:
The chart's background color changes based on the VIX level, creating a "heatmap" effect. This visual representation allows traders to quickly gauge the current market sentiment. The color intensity varies from white (for extremely low VIX values) through various shades of red, increasing in intensity with higher VIX levels. This gradient provides an immediate visual cue of rising or falling market anxiety.
5. Interactive Display:
The indicator includes an interactive table display at the bottom center of the chart that shows the current VIX level in large, bold text, ensuring that it catches the trader's eye.
6. Optional Background Coloring:
Users have the option to enable or disable the heatmap feature. When enabled, the chart's background reflects the VIX level with the corresponding color, enhancing the visual impact of the data.
Applications and Benefits:
The VIX-Heatmap is ideal for traders who base their decisions not only on price movements but also on market sentiment and volatility. Its color-coded heatmap approach simplifies the interpretation of the VIX data, making it accessible even to those who may not be deeply familiar with volatility indices. By offering a quick visual summary of current market fear levels, it aids in making informed decisions, especially in times of market uncertainty.
In summary, the VIX-Heatmap transforms the traditional VIX data into an interactive, visually engaging, and easy-to-interpret format.
Volume Profile Heatmap [UAlgo]The "Volume Profile Heatmap " indicator is a tool designed to visualize the distribution of trading volume across different price levels over a specified period. This heatmap-style indicator helps traders identify significant price levels where a high volume of trading activity has occurred, which can be crucial for making informed trading decisions. The indicator divides the price range into multiple levels and calculates the volume of trades occurring at each level, presenting this data in a visually intuitive manner using a gradient of colors.
By analyzing the volume profile, traders can gain insights into areas of support and resistance, as well as the Point of Control (POC)—the price level with the highest traded volume. This information is valuable in assessing market sentiment, potential reversal points, and key areas of interest where price action might consolidate or react.
🔶 Key Features
Customizable Analysis Period: The indicator allows users to specify the analysis period, defining the historical range over which the volume profile is calculated.
Adjustable Number of Levels: Users can set the number of price levels to divide the price range, offering flexibility in the granularity of the volume analysis.
Color-Coded Heatmap: The indicator uses a gradient color scheme to visually represent volume intensity at each price level. Higher volume areas are shaded differently than lower volume areas, making it easy to spot significant price levels.
Opacity Control: Users can adjust the opacity of the volume boxes, enabling a clearer or more subtle visualization according to their preferences.
Point of Control (POC) Display: The indicator highlights the Point of Control, the price level with the highest traded volume, with a distinct line on the chart, allowing traders to easily identify this critical level.
🔶 Disclaimer
Use with Caution: This indicator is provided for educational and informational purposes only and should not be considered as financial advice. Users should exercise caution and perform their own analysis before making trading decisions based on the indicator's signals.
Not Financial Advice: The information provided by this indicator does not constitute financial advice, and the creator (UAlgo) shall not be held responsible for any trading losses incurred as a result of using this indicator.
Backtesting Recommended: Traders are encouraged to backtest the indicator thoroughly on historical data before using it in live trading to assess its performance and suitability for their trading strategies.
Risk Management: Trading involves inherent risks, and users should implement proper risk management strategies, including but not limited to stop-loss orders and position sizing, to mitigate potential losses.
No Guarantees: The accuracy and reliability of the indicator's signals cannot be guaranteed, as they are based on historical price data and past performance may not be indicative of future results.
Open Interest (OI) Delta [UAlgo]The Open Interest (OI) Delta indicator is a tool designed to provide insights into the dynamics of Open Interest changes within the futures market. Open Interest (OI) refers to the total number of outstanding derivative contracts, such as options or futures, that have not been settled. The OI Delta measures the change in Open Interest over a specified period, allowing traders to assess whether new money is entering the market or existing positions are being closed.
This indicator offers two distinct display modes to visualize OI Delta, along with customizable levels that help in categorizing the magnitude of OI changes. Additionally, it provides the option to color-code the bars on the price chart based on the intensity and direction of OI Delta, making it easier for traders to interpret market sentiment and potential future price movements.
🔶 Key Features
Two Display Modes: Choose between two different modes for visualizing OI Delta, depending on your analysis preferences:
Mode 1: Displays the OI Delta directly as positive or negative values.
Mode 2: Separates positive and negative OI Delta values, displaying them as absolute values for easier comparison.
Customizable Levels: Set up to four levels of OI Delta magnitude, each with customizable thresholds and colors. These levels help categorize the OI changes into Normal, Medium, Large, and Extreme ranges, allowing for a more nuanced interpretation of market activity.
MA Length and Standard Deviation Period: Adjust the moving average length and standard deviation period for OI Delta, which smooths out the data and helps in identifying significant deviations from the norm.
Color-Coded Bar Chart: Optionally color the price bars on your chart based on the OI Delta levels, helping to visually correlate price action with changes in Open Interest.
Heatmap Display: Toggle the display of OI Delta levels on the chart, with the option to fill the areas between these levels for a more visually intuitive understanding of the data.
🔶 Interpreting Indicator
Positive vs. Negative OI Delta:
A positive OI Delta indicates that the Open Interest is increasing, suggesting that new contracts are being created, which could imply fresh capital entering the market.
A negative OI Delta suggests that Open Interest is decreasing, indicating that contracts are being closed out or settled, which might reflect profit-taking or a reduction in market interest.
Magnitude Levels:
Level 1 (Normal OI Δ): Represents typical, less significant changes in OI. If the OI Delta stays within this range, it may indicate routine market activity without any substantial shift in sentiment.
Level 2 (Medium OI Δ): Reflects a more significant change in OI, suggesting increased market interest and possibly the beginning of a new trend or phase of market participation.
Level 3 (Large OI Δ): Indicates a strong change in OI, often associated with a decisive move in the market. This could signify strong conviction among market participants, either bullish or bearish.
Level 4 (Extreme OI Δ): The highest level of OI change, often preceding major market moves. Extreme OI Δ can be a signal of potential market reversals or the final phase of a strong trend.
Color-Coded Bars:
When enabled, the color of the price bars will reflect the magnitude and direction of the OI Delta. This visual aid helps in quickly assessing the correlation between price movements and changes in market sentiment as indicated by OI.
This indicator is particularly useful for futures traders looking to gauge the strength and direction of market sentiment by analyzing changes in Open Interest. By combining this with price action, traders can gain a deeper understanding of market dynamics and make more informed trading decisions
🔶 Disclaimer
Use with Caution: This indicator is provided for educational and informational purposes only and should not be considered as financial advice. Users should exercise caution and perform their own analysis before making trading decisions based on the indicator's signals.
Not Financial Advice: The information provided by this indicator does not constitute financial advice, and the creator (UAlgo) shall not be held responsible for any trading losses incurred as a result of using this indicator.
Backtesting Recommended: Traders are encouraged to backtest the indicator thoroughly on historical data before using it in live trading to assess its performance and suitability for their trading strategies.
Risk Management: Trading involves inherent risks, and users should implement proper risk management strategies, including but not limited to stop-loss orders and position sizing, to mitigate potential losses.
No Guarantees: The accuracy and reliability of the indicator's signals cannot be guaranteed, as they are based on historical price data and past performance may not be indicative of future results.
Visible Range Volume Profile Heatmap [MyTradingCoder]The Visible Range Volume Profile Heatmap indicator offers a visually striking and insightful way to analyze trading volume within the visible price range of your chart. This tool goes beyond traditional volume profiles by displaying volume distribution as a heatmap, where color intensity represents the volume traded at each price level.
Key Features:
Dynamic Heatmap: Displays volume concentration using a color gradient, making it easy to spot areas of high and low trading activity.
Customizable Grid: Choose between auto-scaling or manual grid configuration to suit your analysis needs.
Flexible Color Schemes: Select from tri-tone or two-tone color palettes to represent bullish and bearish volume.
Point of Control (POC) Overlay: Highlights the price level with the highest trading volume, a critical reference point for traders.
Adjustable Transparency: Fine-tune the visibility of the heatmap to balance it with other chart elements.
Lookback Period: Customize the number of bars used for volume profile calculation.
How to Use the Visible Range Volume Profile Heatmap:
The Visible Range Volume Profile Heatmap is a powerful tool that can significantly enhance your market analysis when used effectively. To get the most out of this indicator, start by observing the overall pattern of the heatmap. Areas with darker colors represent higher volume concentration, indicating price levels where significant trading activity has occurred. These areas often serve as important support or resistance levels, as they represent prices where many traders have established positions.
Pay close attention to the Point of Control (POC), represented by a line running through the heatmap. This line marks the price level with the highest trading volume and often acts as a magnet for price action. Price tends to gravitate towards the POC, making it a crucial reference point for potential reversals or continuations.
When analyzing potential trades, consider how the current price relates to the volume distribution shown in the heatmap. If the price is approaching a high-volume area from below, it might face resistance; conversely, if it's approaching from above, that area might provide support. Breakouts beyond significant volume nodes can be particularly noteworthy, as they may signal a shift in market sentiment.
Use the heatmap in conjunction with your existing trading strategies. For example, if you're a trend follower, you might look for breakouts beyond major volume areas as confirmation of trend continuation. If you're a mean reversion trader, you might consider entries when price moves away from high-volume nodes, anticipating a return to these heavily traded levels.
The indicator can also help in identifying potential profit targets. As price moves away from one volume node, it often continues until it reaches the next significant volume area. These areas can serve as logical places to consider taking profits or adjusting your position.
For longer-term analysis, observe how the volume profile changes over time. Shifts in the distribution of volume can indicate evolving market dynamics. A broadening of the high-volume area might suggest increasing uncertainty, while a narrowing could indicate building consensus about price.
Settings Explained:
Auto Grid Configuration:
The "Auto Scale" option automatically adjusts the grid size based on the visible chart area. This ensures optimal visualization regardless of your chart's dimensions or zoom level.
Auto Scale Grid Size: Determines the total number of cells in the heatmap. A higher number provides more granular detail but may increase calculation time.
Auto Scale Grid Ratio: Adjusts the aspect ratio of the grid cells. A higher ratio creates wider, more rectangular cells, while a lower ratio results in more square-shaped cells. Experiment to find the best visual representation for your analysis.
Lookback Period:
The lookback setting determines how many columns (bars) of historical data the indicator uses to calculate the volume profile. A larger lookback will provide a more comprehensive view of historical volume distribution but may be slower to react to recent changes. A smaller lookback will be more responsive to recent volume patterns but may miss longer-term trends.
Manual Grid Configuration:
If you prefer more control over the grid layout, you can switch to manual configuration:
Column Width: Sets the number of price bars each column of the heatmap represents. A wider column aggregates more data, smoothing out the profile.
Number of Rows: Determines the vertical resolution of the heatmap. More rows provide finer price level detail but may make the overall pattern less distinct.
Tips for Optimization:
For short-term trading, use a smaller lookback and finer grid settings to capture recent market dynamics.
For longer-term analysis, increase the lookback and use wider columns to identify persistent volume patterns.
If the heatmap appears too blocky, increase the number of rows or decrease the column width.
If the heatmap is too granular, making patterns hard to discern, do the opposite.
Remember, the ideal settings often depend on your specific trading timeframe, the asset you're analyzing, and your personal analytical preferences. Don't hesitate to experiment with different configurations to find what works best for your trading style.
Conclusion
The Visible Range Volume Profile Heatmap is more than just an indicator—it's a versatile tool that enhances your ability to analyze and interpret market data. By transforming volume profiles into an intuitive, color-coded heatmap, this indicator allows you to quickly identify critical price levels where significant trading activity has occurred. Whether you're a day trader focused on short-term moves or a swing trader analyzing longer-term trends, the customizable settings of this tool provide the flexibility needed to adapt to various market conditions.
The ability to configure the grid layout, adjust the lookback period, and fine-tune the color and transparency settings ensures that the heatmap can be tailored to your specific trading strategy. By highlighting key areas of support and resistance, identifying potential breakouts, and pinpointing the Point of Control (POC), the heatmap gives you actionable insights that can enhance your decision-making process.
Incorporate the Visible Range Volume Profile Heatmap into your trading routine to gain a deeper understanding of market dynamics and to spot opportunities that might otherwise go unnoticed. Remember to experiment with the settings to find the configuration that best suits your analysis style, and use this powerful indicator in conjunction with your existing strategies for optimal results. With the right approach, this tool can become an indispensable part of your trading toolkit, helping you navigate the markets with greater confidence and precision.
Volume Distribution (Heat Map)This Pine Script indicator, "Volume Distribution (Heat Map)" is designed to visualize the distribution of volume across different price levels over a specified lookback period. Here's a detailed breakdown of its functionality and features:
Indicator Overview
User Inputs
Length: The lookback period for analysis, defaulting to 500 bars.
Source: The price source used for calculations (default is the close price).
Color Intensity: Adjusts the intensity of the heatmap colors, with a default value of 25.
Lines Width: The width of the plotted lines, with a default value of 10.
Main Color: The main color used for the heatmap (default is lime).
Logic
The script iterates through the number of bins, calculates the volume for each bin between highest and lowest prices for length period, and updates the corresponding bin in the freq array if the current bar is allowed.
If the current bar is the last bar, the script plots lines and labels based on the volume distribution.
Heatmap Lines:
Solid lines colored based on the volume in each bin, using a gradient from no color to the main color based on amount of volume.
Highest Volume Line:
A dashed red line indicating the bin with the highest volume.
Labels:
Labels for the highest and lowest prices and the volume at the highest volume bin.
Plots
Highest Price Plot: Plots the highest price within the lookback period if the current bar is within the allowed range.
Lowest Price Plot: Plots the lowest price within the lookback period if the current bar is within the allowed range.
Summary
This indicator provides a visual representation of where trading volume is concentrated across different price levels, forming a heatmap. The highest volume level is highlighted with a dashed red line and a label indicating the volume at that level. This can help traders identify significant price levels where trading activity is clustered.
The "Volume Distribution (Heat Map)" indicator is a valuable tool for traders looking to enhance their technical analysis by incorporating volume data into their price charts. It provides a clear and visual representation of where market participants are most active, aiding in better-informed trading decisions.
Volume Storm Trend [ChartPrime]The Volume Storm Trend (VST) indicator is a robust tool for traders looking to analyze volume momentum and trend strength in the market. By incorporating key volume-based calculations and dynamic visualizations, VST provides clear insights into market conditions.
Components:
Calculating the median of the source data.
Volume Power Calculation: The indicator calculates the "heat power" and "cold power" by applying an Exponential Moving Average (EMA) to the median of volume data arrays.
// ---------------------------------------------------------------------------------------------------------------------}
// 𝙄𝙉𝘿𝙄𝘾𝘼𝙏𝙊𝙍 𝘾𝘼𝙇𝘾𝙐𝙇𝘼𝙏𝙄𝙊𝙉𝙎
// ---------------------------------------------------------------------------------------------------------------------{
max_val = 1000
src = close
source = ta.median(src, len)
heat.push(src > source ? (volume > max_val ? max_val : volume) : 0)
heat.remove(0)
cold.push(src < source ? (volume > max_val ? max_val : volume) : 0)
cold.remove(0)
heat_power = ta.ema(heat.median(), 10)
cold_power = ta.ema(cold.median(), 10)
Visualization:
Gradient Colors: The indicator uses gradient colors to visualize bullish volume and bearish volume powers, providing a clear contrast between rising and falling trends.
Bars Fill Color: The color fill between high and low prices changes based on whether the heat power is greater than the cold power.
Bottom Line: A zero line with changing colors based on the dominance of heat or cold power.
Weather Symbols: Visual indicators ("☀" for hot weather and "❄" for cold weather) appear on the chart when the heat and cold powers crossover, helping traders quickly identify trend changes.
Inputs:
Source: The input data source, typically the closing price.
Median Length: The period length for calculating the median of the source. Default is 40.
Volume Length: The period length for calculating the average volume. Default is 3.
Show Weather: A toggle to display weather symbols on the chart. Default is false.
Temperature Type: Allows users to choose between Celsius (°C) and Fahrenheit (°F) for temperature display.
Show Weather Function:
The `Show Weather?` function enhances the VST indicator by displaying weather symbols ("☀" for hot and "❄" for cold) when there are significant crossovers between heat power and cold power. This feature adds a visual cue for potential market tops and bottoms. When the market heats to a high temperature, it often indicates a potential top, signaling traders to consider exiting long positions or preparing for a reversal.
Additional Features:
Dynamic Table Display: A table displays the current "temperature" on the chart, indicating market heat based on the calculated heat and cold powers.
The Volume Storm Trend indicator is a powerful tool for traders
looking to enhance their market analysis with volume and momentum insights, providing a clear and visually appealing representation of key market dynamics.
RSI Screener / Heatmap - By LeviathanThis script allows you to quickly scan the market by displaying the RSI values of up to 280 tickers at once and visualizing them in an easy-to-understand format using labels with heatmap coloring.
📊 Source
The script can display the RSI from a custom timeframe (MTF) and custom length for the following data:
- Price
- OBV (On Balance Volume)
- Open Interest (for crypto tickers)
📋 Ticker Selection
This script uses a different approach for selecting tickers. Instead of inputting them one by one via input.symbol(), you can now copy-paste or edit a list of tickers in the text area window. This approach allows users to easily exchange ticker lists between each other and, for example, create multiple lists of tickers by sector, market cap, etc., and easily input them into the script. Full credit to @allanster for his functions for extracting tickers from the text. Users can switch between 7 groups of 40 tickers each, totaling 280 tickers.
🖥️ Display Types
- Screener with Labels: Each ticker has its own color-coded label located at its RSI value.
- Group Average RSI: A standard RSI plot that displays the average RSI of all tickers in the group.
- RSI Heatmap (coming soon): Color-coded rows displaying current and historical values of tickers.
- RSI Divergence Heatmap (coming soon): Color-coded rows displaying current and historical regular/hidden bullish/bearish divergences for tickers.
🎨 Appearance
Appearance is fully customizable via user inputs, allowing you to change heatmap/gradient colors, zone coloring, and more.
MA Cross HeatmapThe Moving Average Cross Heatmap Created by Technicator , visualizes the crossing distances between multiple moving averages using a heat map style color coding.
The main purpose of this visualization is to help identify potential trend changes or trading opportunities by looking at where the moving averages cross over each other.
Key Features:
Can plot up to 9 different moving average with their cross lengths you set
Uses a heat map to show crossing distances between the MAs
Adjustable settings like crossing length percentage, color scheme, color ceiling etc.
Overlay style separates the heat map from the price chart
This is a unique way to combine multiple MA analysis with a visual heat map representation on one indicator. The code allows you to fine-tune the parameters to suit your trading style and preferences. Worth checking out if you trade using multiple moving average crossovers as part of your strategy.
Crypto Liquidation Heatmap [LuxAlgo]The Crypto Liquidation Heatmap tool offers real-time insights into the liquidations of the top cryptocurrencies by market capitalization, presenting the current state of the market in a visually accessible format. Assets are sorted in descending order, with those experiencing the highest liquidation values placed at the top of the heatmap.
Additional details, such as the breakdown of long and short liquidation values and the current price of each asset, can be accessed by hovering over individual boxes.
🔶 USAGE
The crypto liquidation heatmap tool provides real-time insights into liquidations across all timeframes for the top 29 cryptocurrencies by market capitalization. The assets are visually represented in descending order, prioritizing assets with the highest liquidation values at the top of the heatmap.
Different colors are used to indicate whether long or short liquidations are dominant for each asset. Green boxes indicate that long liquidations surpass short liquidations, while red boxes indicate the opposite, with short liquidations exceeding long liquidations.
Hovering over each box provides additional details, such as the current price of the asset, the breakdown of long and short liquidation values, and the duration for the calculated liquidation values.
🔶 DETAILS
🔹Crypto Liquidation
Crypto liquidation refers to the process of forcibly closing a trader's positions in the cryptocurrency market. It occurs when a trader's margin account can no longer support their open positions due to significant losses or a lack of sufficient margin to meet the maintenance requirements. Liquidations can be categorized as either a long liquidation or a short liquidation.
A long liquidation occurs when long positions are being liquidated, typically due to a sudden drop in the price of the asset being traded. Traders who were bullish on the asset and had opened long positions will face losses as the market moves against them.
On the other hand, a short liquidation occurs when short positions are being liquidated, often triggered by a sudden spike in the price of the asset. Traders who were bearish on the asset and had opened short positions will face losses as the market moves against them.
🔹Liquidation Data
It's worth noting that liquidation data is not readily available on TradingView. However, we recognize the close correlation between liquidation data, trading volumes, and asset price movements. Therefore, this script analyzes accessible data sources, extracts necessary information, and offers an educated estimation of liquidation data. It's important to emphasize that the presented data doesn't reflect precise quantitative values of liquidations. Traders and analysts should instead focus on observing changes over time and identifying correlations between liquidation data and price movements.
🔶 SETTINGS
🔹Cryptocurrency Asset List
It is highly recommended to select instruments from the same exchange with the same currency to maintain proportional integrity among the chosen assets, as different exchanges may have varying trading volumes.
Supported currencies include USD, USDT, USDC, USDP, and USDD. Remember to use the same currency when selecting assets.
List of Crypto Assets: The default options feature the top 29 cryptocurrencies by market capitalization, currently listed on the Binance Exchange. Please note that only crypto assets are supported; any other asset type will not be processed or displayed. To maximize the utility of this tool, it is crucial to heed the warning message displayed above.
🔹Liquidation Heatmap Settings
Position: Specifies the placement of the liquidation heatmap on the chart.
Size: Determines the size of the liquidation heatmap displayed on the chart.
🔶 RELATED SCRIPTS
Liquidations-Meter
Liquidation-Estimates
Liquidation-Levels
ATH Distance HeatmapThe "ATH Distance Heatmap" is a powerful visualization tool designed for traders and investors who seek to quickly assess the relative performance of assets against their All-Time Highs (ATH). By mapping the percentage distance of current prices from their historical peaks, this script provides a unique perspective on market sentiment, potential recovery opportunities, and overvaluation risks.
Key Features:
Visual Clarity: Utilize a color-coded heatmap to instantly recognize which assets are near or far from their ATHs. Colors transition smoothly from cool to warm tones, indicating smaller to larger distances respectively.
Real-Time Updates: The script updates dynamically with live market data, ensuring you have the most current information at your fingertips.
Versatile Application: Whether you're tracking stocks, cryptocurrencies, commodities, or indices, the "ATH Distance Heatmap" adapts to a wide array of assets, making it a versatile tool for your trading arsenal.
Insightful Analysis: Beyond mere visualization, this tool can help identify potential buying opportunities in assets that are significantly below their ATHs, or highlight caution for those nearing their peaks.
How to Use:
Configure Your Assets: Start by selecting the assets you wish to track. The script can be customized to monitor a broad market range or a specific segment.
Interpret the Colors: Use the color gradient to gauge the distance of each asset from its ATH. Cooler colors indicate assets closer to their ATH, while warmer colors highlight those further away.
Ideal for:
Traders looking for a quick visual guide to market trends and asset performance.
Investors aiming to capitalize on recovery opportunities or to evaluate entry and exit points.
Market analysts interested in a concise overview of asset health relative to historical performance.
Historical Correlation [LuxAlgo]The Historical Correlation tool aims to provide the historical correlation coefficients of up to 10 pairs of user-defined tickers starting from a user-defined point in time.
Users can choose to display the historical values as lines or the most recent correlation values as a heat map.
🔶 USAGE
This tool provides historical correlation coefficients, the correlation coefficient between two assets highlight their linear relationship and is always within the range (-1, 1).
It is a simple and easy to use statistical tool, with the following interpretation:
Positive correlation (values close to +1.0): the two assets move in sync, they rise and fall at the same time.
Negative correlation (values close to -1.0): the two assets move in opposite directions: when one goes up, the other goes down and vice versa.
No correlation (values close to 0): the two assets move independently.
The user must confirm the selection of the anchor point in order for the tool to be executed; this can be done directly on the chart by clicking on any bar, or via the date field in the settings panel.
For the parameter Anchor period , the user can choose between the following values NONE, HOURLY, DAILY, WEEKLY, MONTHLY, QUARTERLY and YEARLY. If NONE is selected, there will be no resetting of the calculations, otherwise the calculations will start from the first bar of the new period.
There is a wide range of trading strategies that make use of correlation coefficients between assets, some examples are:
Pair Trading: Traders may wish to take advantage of divergences in the price movements of highly positively correlated assets; even highly positively correlated assets do not always move in the same direction; when assets with a correlation close to +1.0 diverge in their behavior, traders may see this as an opportunity to buy one and sell the other in the expectation that the assets will return to the likely same price behavior.
Sector rotation: Traders may want to favor some sectors that are expected to perform in the next cycle, tracking the correlation between different sectors and between the sector and the overall market.
Diversification: Traders can aim to have a diversified portfolio of uncorrelated assets. From a risk management perspective, it is useful to know the correlation between the assets in your portfolio, if you hold equal positions in positively correlated assets, your risk is tilted in the same direction, so if the assets move against you, your risk is doubled. You can avoid this increased risk by choosing uncorrelated assets so that they move independently.
Hedging: Traders may want to hedge positions with correlated assets, from a hedging perspective, if you are long an asset, you can hedge going long a negative correlated asset or going short a positive correlated asset.
Traders generally need to develop awareness, a key point is to be aware of the relationships between the assets we hold or trade, the historical correlation is an invaluable tool in our arsenal which allows us to make better informed decisions.
On this chart we have an example of historical correlations for several futures markets.
We can clearly see how positively correlated the Nasdaq100 and Dow30 are with the SP500 over the whole period, or how the correlation between the Euro and the SP500 falls from almost +85% to almost -4% since 2021.
As we can see, correlations, like everything else in the market, are not static and vary over time depending on many factors, from macro to technical and everything in between.
🔹 Heatmap
The chart above shows the tool with the default settings and the Drawing Mode set to 'HEATMAP'.
We can see the current correlation between the assets, in this case the FX pairs.
The highest positive correlation is +90% (+0.90) between EURUSD and GBPUSD.
The highest negative correlation is -78% (-0.78) between EURUSD and USDJPY.
The pair with no correlation is AUDUSD and EURCAD with 1% (0.01)
On the above chart we can see the current correlations for the futures markets.
Currently, the assets that are less correlated to the SP500 are NaturalGas and the Euro, the more positive correlations are Nasdaq100 and Dow20, and the more negative correlations are the Yen, Treasury Bonds and 10-Year Notes.
🔶 DETAILS
🔹 Anchor Period
This chart shows the standard FX correlations with the Anchor Period set to `MONTHLY`.
We can clearly see how the calculations restart with the new month, in this case we can clearly see the differences between the correlations from month to month.
Let us look at the correlation coefficient between GBPUSD and USDJPY
In January, their correlation started at close to -100%, rose to close to +50%, only to fall to close to 0% and remain there for the second half of the month.
In February it was -90% in the first few days of the month and is now around -57%.
And between AUDUSD and EURCAD
Last month their correlation was negative for most of the month, reaching -70% and ending around -14%.
This month their correlation has never gone below +21% and at the time of writing is close to +53%.
🔶 SETTINGS
Anchor point: Starting point from which the tool is executed
Anchor period: At the beginning of each new period, the tool will reset the calculations
Pairs from 1 to 10: For each pair of tickers, you can: enable/disable the pair, select the color and specify the two tickers from which you wish to obtain the correlation
🔹 Style
Drawing Mode: Output style, `LINES` will show the historical correlations as lines, `HEATMAP` will show the current correlations with a color gradient from green for correlations near 1 to red for correlations near -1.
Open Liquidity Heatmap [BigBeluga]Open Liquidity Heatmap is an indicator designed to display accumulated resting liquidity on the chart.
Unlike any other liquidity heatmap, this aims to accumulate liquidity at specific levels that build up over time, showing larger areas of liquidity.
🔶 FEATURES
The indicator includes the following settings:
Lookback : Used to determine the range calculation of the heatmap.
Leverage : Leverage of the liquidation (Counted as % in price, Example: 4.5 will return a distance from price of 4.5%, indicating any possible resting liquidity in this range).
Levels : Amount of levels to display (Each level is counted as liquidity resting on the chart; fewer levels will return a bigger area of liquidity sitting on the chart).
Mode : Apply a color gradient from the minimum liquidation to the maximum liquidity level. Set the maximum color gradient value (Counted as volume).
Offset : Automatically determine the offset range of the Volume Profiles. Manual offset of the Volume Profiles.
🔶 CALCULATION
for i = 0 to step - 1
float plotter = na
switch i
0 =>
plotter := hs
=>
plotter := hs - diff * ( i )
cls.hm.gnL(plotter)
cls.vp.put(plotter, 0)
We calculate levels like a normal volume profile with steps, from the highest point within the lookback to the lowest one. Each level will contain the corresponding amount of volume that the candle has closed in that range.
As we can see in the image above, we add liquidity each time the distance in % from price is between two levels.
Unlike many liquidity indicators that provide a single candle liquidity heatmap, this aims to add up liquidity (volume) in already present levels.
This can be extremely useful to see which levels are likely to be more liquid and tend to get a bigger reaction to the price.
Imagine it like a range of levels that each time price revisits that area, a new position area is added; we add volume in that area each time price visits that zone. Liquidity builds up in those zones, causing a bigger reaction to the price once the price visits it.
This indicator is not the same as a single candle heatmap like many others. What is a single candle heatmap?
A single candle heatmap is when a level is created on every new candle, coloring the level based on the total volume of it.
This indicator, on the contrary, aims to provide a more specific use by adding up liquidity each time price visits it.
🔶 BASIC DEMOSTRATION
This is a basic demonstration of how we can spot high liquidity points overall using confluence:
We see the POC of the liquidation in a low volume area of the normal volume profile adding up as confluence.
Resistance from the POC Volume Profile suggesting price will go lower.
Major long open liquidity down.
As we can see, price takes out all the long liquidity and right after pumping, indicating that all the major liquidity got taken out.
Some key note to take is that a POC in the liquidation heatmap in a low volume area of the normal Volume Profile add confluence of a possible big reaction in that zone.
In the forex market, we suggest to use a low distance from price (Leverage) while in a crypto market you can use the one that fit the best the current timeframe.
🔶 CONCLUSION
This indicator aims to show open resting liquidity that had built up over time, showing the most amount of liquidation in specific areas in an aggregated way unlike many liquidation heatmap indicators that show single-level liquidation.
🔶 RELATED SCRIPT
[LCS] Bar HeatmapThe script is an overlay aimed at making price action within a range more comprehensible, i.e. what is the “story” that the band range is telling in relation to the price. You’ll see bars become brighter as they come near the upper or lower band, and dimmer around the average/middle of the two bands. This makes it easier to spot when the price is within an oversold or overbought area or when its experiencing a strong trend movement. The color shift from one to the other can also give a sense as to whether the price action is changing character (going from bullish to bearish or vice versa).
Settings are available for customization to the user's liking.
How to use:
1. Add the indicator.
2. Add another indicator to use as the source, such as Bollinger Bands, which provides upper and lower plots for a channel range.
3. Click the gear icon to access the indicator settings.
4. Mandatory: Select the Upper Band and Lower Band settings as the upper and lower plots from your source indicator of choice to define the range.
5. Save settings. You should now see bars on your chart.
6. Access the Chart Settings (not the indicator settings) and hide the Body, Borders, and Wick for the default candle bars to avoid overlap.
You may need to perform additional configuration steps in your source indicator to appropriately size the range of the upper and lower band plots for a meaningful visualization.
Volume Heatmap 2024 | NXT2017 Christmas EditionHi big players around the world,
I wish you a merry christmas time.
Today I have a nice present for you: a new volume heatmap indicator for free using!
HISTORY
My first volume heatmap project got a lot of feedback and a big demand. You can find it here:
In this time pinescript version 4 was the newest one and I worked the first time with arrays.
Today we have pinescript version 5 and some new features. This is why I tried again with matrix function and the results are better than I expected.
HOW IT WORKS
The indicator calculates similar like the volume profile. It looks back and every volume where the close price is on the same row area, the volume will cumulated. How much rows the new chart view is showing, you can choose manually.
The mind behind this is to find high volume levels, where high volume catch the price in a range or get function as support/resistance line.
PICTURES
I hope it helps for your trading. You are welcome to give some comments.
Merry christmas and best regards
NXT2017
RSI Heatmap Screener [ChartPrime]The RSI Heatmap Screener is a versatile trading indicator designed to provide traders and investors with a deep understanding of their selected assets' market dynamics. It offers several key features to facilitate informed decision-making:
█ Custom Asset Selection:
The user can choose up to 30 assets that you want to analyze, allowing for a tailored experience.
█ Adjustable RSI Length:
Customize your analysis by adjusting the RSI length to align with your trading strategy.
█ RSI Heatmap:
The heatmap feature uses various colors to represent RSI values:
█ Color coding for labels:
Grey: Signifies a neutral RSI, indicating a balanced market.
Yellow: Suggests overbought conditions, advising caution.
Pale Red: Indicates mild overbought conditions in a strong area.
Bright Red: Represents strong overbought conditions, hinting at a potential downturn.
Pale Green: Signals mild oversold conditions with signs of recovery.
Dark Green: Denotes full oversold conditions, with potential for a bounce.
Purple: Highlights extremely oversold conditions, pointing to an opportunity for a relief bounce.
█ Levels:
Central Plot and Zones: The central plot displays the average RSI of the selected assets, offering an overview of market sentiment. Overbought and oversold zones in red and green provide clear reference points.
█ Hover Labels:
Hover over an asset to access details on various indicators like VWAP, Stochastic, SMA, TradingView ranking, and Volume Rating. Bullish and bearish indicators are marked with ticks and crosses, and a fire emoji denotes heavily overextended assets.
█ TradingView Ranking:
Utilize the TradingView ranking metric to assess an asset's performance and popularity.
Thank you to @tradingview for this ranking metric.
█ Volume Rating:
Gain insights into trading volumes for more informed decision-making.
█ Oscillator at the Bottom:
The RSI average for the entire market, presented in a normalized format, offers a broader market perspective. Green indicates a favorable buying area, while red suggests market overextension and potential short or sell opportunities.
█ Heatmap Visualization:
Historical RSI values for each selected asset are displayed. Red indicates overbought conditions, while green signals oversold conditions, helping you spot trends and potential turning points.
This screener is designed to make entering the market simpler and more comprehensive for all traders and investors.
Volume and Price Z-Score [Multi-Asset] - By LeviathanThis script offers in-depth Z-Score analytics on price and volume for 200 symbols. Utilizing visualizations such as scatter plots, histograms, and heatmaps, it enables traders to uncover potential trade opportunities, discern market dynamics, pinpoint outliers, delve into the relationship between price and volume, and much more.
A Z-Score is a statistical measurement indicating the number of standard deviations a data point deviates from the dataset's mean. Essentially, it provides insight into a value's relative position within a group of values (mean).
- A Z-Score of zero means the data point is exactly at the mean.
- A positive Z-Score indicates the data point is above the mean.
- A negative Z-Score indicates the data point is below the mean.
For instance, a Z-Score of 1 indicates that the data point is 1 standard deviation above the mean, while a Z-Score of -1 indicates that the data point is 1 standard deviation below the mean. In simple terms, the more extreme the Z-Score of a data point, the more “unusual” it is within a larger context.
If data is normally distributed, the following properties can be observed:
- About 68% of the data will lie within ±1 standard deviation (z-score between -1 and 1).
- About 95% will lie within ±2 standard deviations (z-score between -2 and 2).
- About 99.7% will lie within ±3 standard deviations (z-score between -3 and 3).
Datasets like price and volume (in this context) are most often not normally distributed. While the interpretation in terms of percentage of data lying within certain ranges of z-scores (like the ones mentioned above) won't hold, the z-score can still be a useful measure of how "unusual" a data point is relative to the mean.
The aim of this indicator is to offer a unique way of screening the market for trading opportunities by conveniently visualizing where current volume and price activity stands in relation to the average. It also offers features to observe the convergent/divergent relationships between asset’s price movement and volume, observe a single symbol’s activity compared to the wider market activity and much more.
Here is an overview of a few important settings.
Z-SCORE TYPE
◽️ Z-Score Type: Current Z-Score
Calculates the z-score by comparing current bar’s price and volume data to the mean (moving average with any custom length, default is 20 bars). This indicates how much the current bar’s price and volume data deviates from the average over the specified period. A positive z-score suggests that the current bar's price or volume is above the mean of the last 20 bars (or the custom length set by the user), while a negative z-score means it's below that mean.
Example: Consider an asset whose current price and volume both show deviations from their 20-bar averages. If the price's Z-Score is +1.5 and the volume's Z-Score is +2.0, it means the asset's price is 1.5 standard deviations above its average, and its trading volume is 2 standard deviations above its average. This might suggest a significant upward move with strong trading activity.
◽️ Z-Score Type: Average Z-Score
Calculates the custom-length average of symbol's z-score. Think of it as a smoothed version of the Current Z-Score. Instead of just looking at the z-score calculated on the latest bar, it considers the average behavior over the last few bars. By doing this, it helps reduce sudden jumps and gives a clearer, steadier view of the market.
Example: Instead of a single bar, imagine the average price and volume of an asset over the last 5 bars. If the price's 5-bar average Z-Score is +1.0 and the volume's is +1.5, it tells us that, over these recent bars, both the price and volume have been consistently above their longer-term averages, indicating sustained increase.
◽️ Z-Score Type: Relative Z-Score
Calculates a relative z-score by comparing symbol’s current bar z-score to the mean (average z-score of all symbols in the group). This is essentially a z-score of a z-score, and it helps in understanding how a particular symbol's activity stands out not just in its own historical context, but also in relation to the broader set of symbols being analyzed. In other words, while the primary z-score tells you how unusual a bar's activity is for that specific symbol, the relative z-score informs you how that "unusualness" ranks when compared to the entire group's deviations. This can be particularly useful in identifying symbols that are outliers even among outliers, indicating exceptionally unique behaviors or opportunities.
Example: If one asset's price Z-Score is +2.5 and volume Z-Score is +3.0, but the group's average Z-Scores are +0.5 for price and +1.0 for volume, this asset’s Relative Z-Score would be high and therefore stand out. This means that asset's price and volume activities are notably high, not just by its own standards, but also when compared to other symbols in the group.
DISPLAY TYPE
◽️ Display Type: Scatter Plot
The Scatter Plot is a visual tool designed to represent values for two variables, in this case the Z-Scores of price and volume for multiple symbols. Each symbol has it's own dot with x and y coordinates:
X-Axis: Represents the Z-Score of price. A symbol further to the right indicates a higher positive deviation in its price from its average, while a symbol to the left indicates a negative deviation.
Y-Axis: Represents the Z-Score of volume. A symbol positioned higher up on the plot suggests a higher positive deviation in its trading volume from its average, while one lower down indicates a negative deviation.
Here are some guideline insights of plot positioning:
- Top-Right Quadrant (High Volume-High Price): Symbols in this quadrant indicate a scenario where both the trading volume and price are higher than their respective mean.
- Top-Left Quadrant (High Volume-Low Price): Symbols here reflect high trading volumes but prices lower than the mean.
- Bottom-Left Quadrant (Low Volume-Low Price): Assets in this quadrant have both low trading volume and price compared to their mean.
- Bottom-Right Quadrant (Low Volume-High Price): Symbols positioned here have prices that are higher than their mean, but the trading volume is low compared to the mean.
The plot also integrates a set of concentric squares which serve as visual guides:
- 1st Square (1SD): Encapsulates symbols that have Z-Scores within ±1 standard deviation for both price and volume. Symbols within this square are typically considered to be displaying normal behavior or within expected range.
- 2nd Square (2SD): Encapsulates those with Z-Scores within ±2 standard deviations. Symbols within this boundary, but outside the 1 SD square, indicate a moderate deviation from the norm.
- 3rd Square (3SD): Represents symbols with Z-Scores within ±3 standard deviations. Any symbol outside this square is deemed to be a significant outlier, exhibiting extreme behavior in terms of either its price, its volume, or both.
By assessing the position of symbols relative to these squares, traders can swiftly identify which assets are behaving typically and which are showing unusual activity. This visualization simplifies the process of spotting potential outliers or unique trading opportunities within the market. The farther a symbol is from the center, the more it deviates from its typical behavior.
◽️ Display Type: Columns
In this visualization, z-scores are represented using columns, where each symbol is presented horizontally. Each symbol has two distinct nodes:
- Left Node: Represents the z-score of volume.
- Right Node: Represents the z-score of price.
The height of these nodes can vary along the y-axis between -4 and 4, based on the z-score value:
- Large Positive Columns: Signify a high or positive z-score, indicating that the price or volume is significantly above its average.
- Large Negative Columns: Represent a low or negative z-score, suggesting that the price or volume is considerably below its average.
- Short Columns Near 0: Indicate that the price or volume is close to its mean, showcasing minimal deviation.
This columnar representation provides a clear, intuitive view of how each symbol's price and volume deviate from their respective averages.
◽️ Display Type: Circles
In this visualization style, z-scores are depicted using circles. Each symbol is horizontally aligned and represented by:
- Solid Circle: Represents the z-score of price.
- Transparent Circle: Represents the z-score of volume.
The vertical position of these circles on the y-axis ranges between -4 and 4, reflecting the z-score value:
- Circles Near the Top: Indicate a high or positive z-score, suggesting the price or volume is well above its average.
- Circles Near the Bottom: Represent a low or negative z-score, pointing to the price or volume being notably below its average.
- Circles Around the Midline (0): Highlight that the price or volume is close to its mean, with minimal deviation.
◽️ Display Type: Delta Columns
There's also an option to utilize Z-Score Delta Columns. For each symbol, a single column is presented, depicting the difference between the z-score of price and the z-score of volume.
The z-score delta essentially captures the disparity between how much the price and volume deviate from their respective mean:
- Positive Delta: Indicates that the z-score of price is greater than the z-score of volume. This suggests that the price has deviated more from its average than the volume has from its own average. Such a scenario could point to price movements being more significant or pronounced compared to the changes in volume.
- Negative Delta: Represents that the z-score of volume is higher than the z-score of price. This might mean that there are substantial volume changes, yet the price hasn't moved as dramatically. This can be indicative of potential build-up in trading interest without an equivalent impact on price.
- Delta Close to 0: Means that the z-scores for price and volume are almost equal, indicating their deviations from the average are in sync.
◽️ Display Type: Z-Volume/Z-Price Heatmap
This visualization offers a heatmap either for volume z-scores or price z-scores across all symbols. Here's how it's presented:
Each symbol is allocated its own horizontal row. Within this row, bar-by-bar data is displayed using a color gradient to represent the z-score values. The heatmap employs a user-defined gradient scale, where a chosen "cold" color represents low z-scores and a chosen "hot" color signifies high z-scores. As the z-score increases or decreases, the colors transition smoothly along this gradient, providing an intuitive visual indication of the z-score's magnitude.
- Cold Colors: Indicate values significantly below the mean (negative z-score)
- Mild Colors: Represent values close to the mean, suggesting minimal deviation.
- Hot Colors: Indicate values significantly above the mean (positive z-score)
This heatmap format provides a rapid, visually impactful means to discern how each symbol's price or volume is behaving relative to its average. The color-coded rows allow you to quickly spot outliers.
VOLUME TYPE
The "Volume Type" input allows you to choose the nature of volume data that will be factored into the volume z-score calculation. The interpretation of indicator’s data changes based on this input. You can opt between:
- Volume (Regular Volume): This is the classic measure of trading volume, which represents the volume traded in a given time period - bar.
- OBV (On-Balance Volume): OBV is a momentum indicator that accumulates volume on up bars and subtracts it on down bars, making it a cumulative indicator that sort of measures buying and selling pressure.
Interpretation Implications:
- For Volume Type: Regular Volume:
Positive Z-Score: Indicates that the trading volume is above its average, meaning there's unusually high trading activity .
Negative Z-Score: Suggests that the trading volume is below its average, signifying unusually low trading activity.
- For Volume Type: OBV:
Positive Z-Score: Signifies that “buying pressure” is above its average.
Negative Z-Score: Signifies that “selling pressure” is above its average.
When comparing Z-Score of OBV to Z-Score of price, we can observe several scenarios. If Z-Price and Z-Volume are convergent (have similar z-scores), we can say that the directional price movement is supported by volume. If Z-Price and Z-Volume are divergent (have very different z-scores or one of them being zero), it suggests a potential misalignment between price movement and volume support, which might hint at possible reversals or weakness.
Treasury Yields Heatmap [By MUQWISHI]▋ INTRODUCTION :
The “Treasury Yields Heatmap” generates a dynamic heat map table, showing treasury yield bond values corresponding with dates. In the last column, it presents the status of the yield curve, discerning whether it’s in a normal, flat, or inverted configuration, which determined by using Pearson's linear regression coefficient. This tool is built to offer traders essential insights for effectively tracking bond values and monitoring yield curve status, featuring the flexibility to input a starting period, timeframe, and select from a range of major countries' bond data.
_______________________
▋ OVERVIEW:
______________________
▋ YIELD CURVE:
It is determined through Pearson's linear regression coefficient and considered…
R ≥ 0.7 → Normal
0.7 > R ≥ 0.35 → Slight Normal
0.35 > R > -0.35 → Flat
-0.35 ≥ R > -0.7 → Slight Inverted
-0.7 ≥ R → Inverted
_______________________
▋ INDICATOR SETTINGS:
#Section One: Table Setting
#Section Two: Technical Setting
(1) Country: Select country’s treasury yields data
(2) Timeframe: Time interval.
(3) Fetch By:
(3A) Date: Retrieve data by beginning of date.
(3B) Period: Retrieve data by specifying the number of time series back.
Enjoy. Please let me know if you have any questions.
Thank you.
Machine Learning: MFI Heat Map [YinYangAlgorithms]Overview:
MFI Heat Maps are a visually appealing way to display the values of 29 different MFIs at the same time while being able to make sense of it. Each plot within the Indicator represents a different MFI value. The higher you get up, the longer the length that was used for this MFI. This Indicator also features the use of Machine Learning to help balance the MFI levels. It doesn’t solely rely upon Machine Learning but instead incorporates a growing length MFI averaged with the Machine Learning MFI at any given index.
For instance, say we are calculating the 10th plot from the bottom, the MFI would be an average of:
MFI(source, 11)
Machine Learning MFI at Index of 10
We do it this way as they both help smooth each other out without relying solely on just one calculation method.
Due to plot limitations, you are capped at 28 Plot Amounts within this indicator, but that is still quite a bit of information you can glean from a Heat Map.
The Machine Learning used in this indicator is of the K-Nearest Neighbor (KNN). It uses a Fast and Slow MFI calculation then sorts through them over Machine Learning Length and calculates the differences between them. It then slices off KNN length to create our Max/Min Distances allotted. It adds the average between Fast and Slow MFIs to a Viable Distances array if their distances are within the KNN Min/Max distance. It then averages all distances in the Viable Distances array and returns the result.
The result of the KNN Function is saved to another ML Data array whose length is that of Plot Amount (Heat Map Size). This way each Index of the ML Data array can be indexed according to the Heat Map Size.
The Average of the ML Data array is the MFI line (white) that you’ll see plotted on the Indicator. There is also the SMA of the MFI Average (orange) which is likewise plotted. These plots allow you to visualize where the ML MFI is sitting and can potentially be useful for seeing when the MFI Average and SMA cross over and under each other.
We’ve heard many people talk highly of RSI, but sadly not too many even refer to MFI. MFI oftentimes may be overlooked, especially with new traders who may not even know what it is. Essentially MFI is an RSI but it also incorporates Volume into its calculations, which in our opinion leads to a more accurate reading; afterall, what is price movement without Volume.
Tutorial:
You may be thinking, this Indicator looks appealing to the eye, but how do I benefit from it trading wise?
Before we get into our visual examples, let's talk briefly about what makes Heat Maps in general a useful tool for trading. Heat Maps give us the ability to visualize and understand lots of data while removing the clutter. We can understand the data of 29 different MFIs without having to look at and decipher 29 different MFI plots. When you overlay too many MFI lines on top of each other, they can be very difficult to read and oftentimes end up actually hindering your Technical Analysis. For this reason, we have a simple solution to this problem; Heat Maps. This MFI Heat Map allows you to easily know (in a relative %) what the MFI level is for varying lengths. For Instance, the First (bottom) plot indexes an MFI of (K(0) (loop of Plot Amount) + Smoothing Length (default 1)) = 1. Since this is indexing (usually) a very low length, it will change much quicker. Whereas the Last (top) plot indexes an MFI of (K(27) (loop of Plot Amount) + Smoothing Length (default 1)) = 28. This is indexing a much higher length of MFI which results in the MFI the higher you go up in the Heat Map to move much slower.
Heat Maps give us the ability to see changes happening over multiple MFIs at the same time, which can be very useful for seeing shifts in MFI / Momentum. Remember, MFI incorporates Volume, so even if the price goes up a lot, if there was low volume, the MFI won’t move as much as an RSI would. However, likewise, if there is high volume but low price movement, the MFI will move slightly more than the RSI.
Heat Maps change color based on their MFI level. If the MFI is >= 90 it is HOT (red), if the MFI <= 9 it is COLD (teal, think of ICE). Green represents an MFI of 50-59 and Dark Blue represents an MFI of 40-49. Green and Dark blue are the most common colors as all the others are more ‘Extreme’ MFI levels.
Okay, time to get to the Examples :
Since there is so much going on in Heat Maps, we’ve decided to focus this tutorial to this specific area and talk about individual locations before talking about it as a whole.
If you refer to the example above where there are 2 white circles; these white circles are highlighting a key location you’ll be wanting to identify within your Heat Maps, many things are happening here:
The MFI crossed over the SMA (bullish).
The Heat Map started changing from mid/dark Blue (30-50 MFI) to Green (50-59 MFI) around the midline (the 50% dashed like).
The Lower levels of the Heat Map are turning Yellow/Orange/Red (60-100 MFI).
The Upper Levels of the Heat Map are still Light Blue - Green (10-50 MFI).
The 4 Key points above, all point towards potential Bullish Momentum changes. You’re likely wondering, but why? Let's discuss about each one in more specific detail:
1. The MFI crossed over the SMA (bullish): What this tells us is that the current MFI Average is now greater than its average over the last (default) 16 bars. This means there's been a large amount of Money Flow (Price and Volume) recently (subjectively based on the last (default) 16 average). This is one of the leading Bullish / Bearish signals you will see within this Indicator. You can enable Signals within the Settings and/or even add Alerts for when these crossings occur.
2. The Heat Map started changing from mid/dark Blue (30-50 MFI) to Green (50-59 MFI) around the midline (the 50% dashed like): This shows us that the index’s in the mid (if using all 28 heat map plots it would be at 14) has already received some of this momentum change. If you look at the second white circle (right), you’ll also notice the higher MFI plot indexes are also green. This is because since their length is long they still have some momentum and strength from the first white circle (left). Just because the first white circle failed in its bullish push, doesn’t mean it didn’t achieve momentum that would later on help to push the price up.
3. The Lower levels of the Heat Map are turning Yellow/Orange/Red (60-100 MFI): It occurred somewhat in the left white circle, but mainly in the right white circle. This shows us the MFI is very high on the lower lengths, this may lead to the current, middle and higher length MFIs following suit soon. Remember it has to work its way up, the higher levels can’t go red unless the lower levels go red first and the higher levels can also lag quite a bit behind and take awhile to catch up, this is normal, expected and meant to happen. Vice versa is also true with getting higher levels to go cold (light teal (think of ICE)).
4. The Upper Levels of the Heat Map are still Light Blue - Green (10-50 MFI): You might think at first that this is a bad thing, but it's not! Remember you want to be Fearful when others are Greedy and Greedy when others are Fearful! You don’t want to buy when the higher levels have a high MFI, you want to buy when you see the momentum pushing up in the lower MFI levels (getting yellow/orange/red in the low levels) while it is still Cold in the higher levels (BLUE OR GREEN, nothing higher than green as it is already slightly too high). There will be many times that it is Yellow or possibly Orange in the high levels and the bullish push still happens, but this is much more risky! The key to trading is to minimize risks while maximizing potential.
Hopefully now you’re getting an idea of how to spot potential bullish momentum changes, but what about bearish momentum changes? Technically they are the exact opposite, so we don’t need to go into as much detail, but lets still take a look at a few examples:
In the example above we marked the 3 times where it was displaying overly bullish characteristics. We marked the bullish momentum occurring with arrows. If you look closely at the start of the arrow to where it finishes, you’ll notice how the heat (HOT)(RED) works its way up from the lower levels to the higher levels. We then see the MFI to SMA cross under. In all 3 of these examples the heat made it all the way to the top of the chart. These are all very bearish signals that represent a bearish momentum movement that may occur soon.
Also, please note, the level the MFI is at DOES matter! That line isn’t there simply for you to see when there are crosses over and under. The MFI is considered to be Overbought when it is greater than 70 (the upper white dashed line, it is just formatted to be on a different scale cause there are 28 plots, but it represents 70). The MFI is considered to be Oversold when it is less than 30 (the lower white dashed line).
If we look to the left a little here where a big drop in price occurred shortly after our MFI and SMA crossed, would we have been able to identify it using the Heat Maps? Likely, No. There was some color change in the lower levels a few bars prior that went yellow/orange/red but before this cross happened they all went back to Dark Blue. In the middle section when the cross happened it was only Green and Yellow and in the upper section we are Blue. This would be a very risky trade to go on as the only real Bearish Indication was the MFI to SMA cross under. Remember, you want to reduce risk, you don’t want to simply trade on everytime the MFI and SMA cross each other or you’ll be getting yourself into many risky trades based on false signals.
Based on what you’ve learned above, can you see the signs that are indicating where this white circle may have potential for a bullish momentum change?
Now that we are more zoomed in, you may also be noticing there are colors to the price bars. This can be disabled in the settings, but just so you know what they mean, let’s zoom in a little more and talk about it.
We’ve condensed the Indicator a bit so you can see the bars better here. The colors that are displayed on these bars are the Heat Map value for your MFI (the white line in the Indicator). This way you can better see when the Price is Hot and Cold. As you may see while looking, the colors generally go from cold to hot when bullish momentum is happening and hot to cold when bearish momentum is happening. We don’t recommend solely looking at the bars as indicators to MFI momentum change, as seeing the Heat Map will give you much more data; however it can be nice to see the Heat Map projected on the bars rather than trying to eyeball it yourself or hover over each bar specifically to see their levels.
We will conclude our Tutorial here. Hopefully this has given you some insight to how useful Heat Maps can be and why it works well with a Machine Learning (KNN) Model applied to the MFI.
PLEASE NOTE: You can adjust the line width for the Heat Map within the settings. If you condense the Indicator a lot or have a small screen, likely use a length of 1-2. If you have it stretched out or a large screen, a length of 2-3 will work nice. You just don’t want to have the lines overlapping or it defeats the purpose of a Heat Map. Also, the bigger the linewidth, generally you’ll want to increase the Transparency within the Settings also as it can get quite bright and hurt your eyes over time.
Settings:
MFI:
Show MFI and SMA Crossing Signals: MFI and SMA Crossing is one of the leading Bullish and Bearish Signals in this Indicator. You can also add alerts for these signals.
Plot Amount: How many plots are used in this Heat Map. (2 - 28).
Source: The Source to use in all MFI calculations.
Smooth Initial MFI Length: How much to smooth the Fast and Slow MFI calculation by. 1 = No smoothing.
MFI SMA Length: What length we smooth the MFI Average over to get our MFI SMA.
Machine Learning:
Average MFI data by adding a lookback to the Source: While populating our Heat Map with the MFI's, should use use the Source each MFI Length increase or should we also lookback a Source each MFI Length Increase.
KNN Distance Requirement: To be a valid KNN, it needs to abide by a Distance calculation. Generally only Max is used, but you can change it if it suits your trading style better.
Machine Learning Length: How much ML data should we store? The longer the length generally the smoother the result; which may not be as accurate for something like a Heat Map, so keeping this relatively low may lead to more accurate results.
KNN Length: How many KNN are used in the slice to calculate max/min distance allowed.
Fast Length: Fast MFI length used in KNN to calculate distances by comparing its distance with the Slow MFI Length.
Slow Length: Slow MFI length used in KNN to calculate distances by comparing its distance with the Fast MFI Length.
Smoothing Length: When populating our Heat Map, at what length do we start our MFI calculations with (A Higher value with result in a slower and more smoothed MFI / Heat Map).
Colors:
Change Bar Color: Change bar colors to MFI Avg Color.
Heat Map Transparency: If there isn't any transparency it can be a little hard on the eyes. The Greater the Line Width, generally the more transparency you'll want for your eyes.
Line Width: Set how wide the Heat Map lines are
MFI 90-100 Color: Color when the MFI is between these levels.
MFI 80-89 Color: Color when the MFI is between these levels.
MFI 70-79 Color: Color when the MFI is between these levels.
MFI 60-69 Color: Color when the MFI is between these levels.
MFI 50-59 Color: Color when the MFI is between these levels.
MFI 40-49 Color: Color when the MFI is between these levels.
MFI 30-39 Color: Color when the MFI is between these levels.
MFI 20-29 Color: Color when the MFI is between these levels.
MFI 10-19 Color: Color when the MFI is between these levels.
MFI 0-100 Color: Color when the MFI is between these levels.
If you have any questions, comments, ideas or concerns please don't hesitate to contact us.
HAPPY TRADING!
[Excalibur] Ehlers AutoCorrelation Periodogram ModifiedKeep your coins folks, I don't need them, don't want them. If you wish be generous, I do hope that charitable peoples worldwide with surplus food stocks may consider stocking local food banks before stuffing monetary bank vaults, for the crusade of remedying the needs of less than fortunate children, parents, elderly, homeless veterans, and everyone else who deserves nutritional sustenance for the soul.
DEDICATION:
This script is dedicated to the memory of Nikolai Dmitriyevich Kondratiev (Никола́й Дми́триевич Кондра́тьев) as tribute for being a pioneering economist and statistician, paving the way for modern econometrics by advocation of rigorous and empirical methodologies. One of his most substantial contributions to the study of business cycle theory include a revolutionary hypothesis recognizing the existence of dynamic cycle-like phenomenon inherent to economies that are characterized by distinct phases of expansion, stagnation, recession and recovery, what we now know as "Kondratiev Waves" (K-waves). Kondratiev was one of the first economists to recognize the vital significance of applying quantitative analysis on empirical data to evaluate economic dynamics by means of statistical methods. His understanding was that conceptual models alone were insufficient to adequately interpret real-world economic conditions, and that sophisticated analysis was necessary to better comprehend the nature of trending/cycling economic behaviors. Additionally, he recognized prosperous economic cycles were predominantly driven by a combination of technological innovations and infrastructure investments that resulted in profound implications for economic growth and development.
I will mention this... nation's economies MUST be supported and defended to continuously evolve incrementally in order to flourish in perpetuity OR suffer through eras with lasting ramifications of societal stagnation and implosion.
Analogous to the realm of economics, aperiodic cycles/frequencies, both enduring and ephemeral, do exist in all facets of life, every second of every day. To name a few that any blind man can naturally see are: heartbeat (cardiac cycles), respiration rates, circadian rhythms of sleep, powerful magnetic solar cycles, seasonal cycles, lunar cycles, weather patterns, vegetative growth cycles, and ocean waves. Do not pretend for one second that these basic aforementioned examples do not affect business cycle fluctuations in minuscule and monumental ways hour to hour, day to day, season to season, year to year, and decade to decade in every nation on the planet. Kondratiev's original seminal theories in macroeconomics from nearly a century ago have proven remarkably prescient with many of his antiquated elementary observations/notions/hypotheses in macroeconomics being scholastically studied and topically researched further. Therefore, I am compelled to honor and recognize his statistical insight and foresight.
If only.. Kondratiev could hold a pocket sized computer in the cup of both hands bearing the TradingView logo and platform services, I truly believe he would be amazed in marvelous delight with a GARGANTUAN smile on his face.
INTRODUCTION:
Firstly, this is NOT technically speaking an indicator like most others. I would describe it as an advanced cycle period detector to obtain market data spectral estimates with low latency and moderate frequency resolution. Developers can take advantage of this detector by creating scripts that utilize a "Dominant Cycle Source" input to adaptively govern algorithms. Be forewarned, I would only recommend this for advanced developers, not novice code dabbling. Although, there is some Pine wizardry introduced here for novice Pine enthusiasts to witness and learn from. AI did describe the code into one super-crunched sentence as, "a rare feat of exceptionally formatted code masterfully balancing visual clarity, precision, and complexity to provide immense educational value for both programming newcomers and expert Pine coders alike."
Understand all of the above aforementioned? Buckle up and proceed for a lengthy read of verbose complexity...
This is my enhanced and heavily modified version of autocorrelation periodogram (ACP) for Pine Script v5.0. It was originally devised by the mathemagician John Ehlers for detecting dominant cycles (frequencies) in an asset's price action. I have been sitting on code similar to this for a long time, but I decided to unleash the advanced code with my fashion. Originally Ehlers released this with multiple versions, one in a 2016 TASC article and the other in his last published 2013 book "Cycle Analytics for Traders", chapter 8. He wasn't joking about "concepts of advanced technical trading" and ACP is nowhere near to his most intimidating and ingenious calculations in code. I will say the book goes into many finer details about the original periodogram, so if you wish to delve into even more elaborate info regarding Ehlers' original ACP form AND how you may adapt algorithms, you'll have to obtain one. Note to reader, comparing Ehlers' original code to my chimeric code embracing the "Power of Pine", you will notice they have little resemblance.
What you see is a new species of autocorrelation periodogram combining Ehlers' innovation with my fascinations of what ACP could be in a Pine package. One other intention of this script's code is to pay homage to Ehlers' lifelong works. Like Kondratiev, Ehlers is also a hardcore cycle enthusiast. I intend to carry on the fire Ehlers envisioned and I believe that is literally displayed here as a pleasant "fiery" example endowed with Pine. With that said, I tried to make the code as computationally efficient as possible, without going into dozens of more crazy lines of code to speed things up even more. There's also a few creative modifications I made by making alterations to the originating formulas that I felt were improvements, one of them being lag reduction. By recently questioning every single thing I thought I knew about ACP, combined with the accumulation of my current knowledge base, this is the innovative revision I came up with. I could have improved it more but decided not to mind thrash too many TV members, maybe later...
I am now confident Pine should have adequate overhead left over to attach various indicators to the dominant cycle via input.source(). TV, I apologize in advance if in the future a server cluster combusts into a raging inferno... Coders, be fully prepared to build entire algorithms from pure raw code, because not all of the built-in Pine functions fully support dynamic periods (e.g. length=ANYTHING). Many of them do, as this was requested and granted a while ago, but some functions are just inherently finicky due to implementation combinations and MUST be emulated via raw code. I would imagine some comprehensive library or numerous authored scripts have portions of raw code for Pine built-ins some where on TV if you look diligently enough.
Notice: Unfortunately, I will not provide any integration support into member's projects at all. I have my own projects that require way too much of my day already. While I was refactoring my life (forgoing many other "important" endeavors) in the early half of 2023, I primarily focused on this code over and over in my surplus time. During that same time I was working on other innovations that are far above and beyond what this code is. I hope you understand.
The best way programmatically may be to incorporate this code into your private Pine project directly, after brutal testing of course, but that may be too challenging for many in early development. Being able to see the periodogram is also beneficial, so input sourcing may be the "better" avenue to tether portions of the dominant cycle to algorithms. Unique indication being able to utilize the dominantCycle may be advantageous when tethering this script to those algorithms. The easiest way is to manually set your indicators to what ACP recognizes as the dominant cycle, but that's actually not considered dynamic real time adaption of an indicator. Different indicators may need a proportion of the dominantCycle, say half it's value, while others may need the full value of it. That's up to you to figure that out in practice. Sourcing one or more custom indicators dynamically to one detector's dominantCycle may require code like this: `int sourceDC = int(math.max(6, math.min(49, input.source(close, "Dominant Cycle Source"))))`. Keep in mind, some algos can use a float, while algos with a for loop require an integer.
I have witnessed a few attempts by talented TV members for a Pine based autocorrelation periodogram, but not in this caliber. Trust me, coding ACP is no ordinary task to accomplish in Pine and modifying it blessed with applicable improvements is even more challenging. For over 4 years, I have been slowly improving this code here and there randomly. It is beautiful just like a real flame, but... this one can still burn you! My mind was fried to charcoal black a few times wrestling with it in the distant past. My very first attempt at translating ACP was a month long endeavor because PSv3 simply didn't have arrays back then. Anyways, this is ACP with a newer engine, I hope you enjoy it. Any TV subscriber can utilize this code as they please. If you are capable of sufficiently using it properly, please use it wisely with intended good will. That is all I beg of you.
Lastly, you now see how I have rasterized my Pine with Ehlers' swami-like tech. Yep, this whole time I have been using hline() since PSv3, not plot(). Evidently, plot() still has a deficiency limited to only 32 plots when it comes to creating intense eye candy indicators, the last I checked. The use of hline() is the optimal choice for rasterizing Ehlers styled heatmaps. This does only contain two color schemes of the many I have formerly created, but that's all that is essentially needed for this gizmo. Anything else is generally for a spectacle or seeing how brutal Pine can be color treated. The real hurdle is being able to manipulate colors dynamically with Merlin like capabilities from multiple algo results. That's the true challenging part of these heatmap contraptions to obtain multi-colored "predator vision" level indication. You now have basic hline() food for thought empowerment to wield as you can imaginatively dream in Pine projects.
PERIODOGRAM UTILITY IN REAL WORLD SCENARIOS:
This code is a testament to the abilities that have yet to be fully realized with indication advancements. Periodograms, spectrograms, and heatmaps are a powerful tool with real-world applications in various fields such as financial markets, electrical engineering, astronomy, seismology, and neuro/medical applications. For instance, among these diverse fields, it may help traders and investors identify market cycles/periodicities in financial markets, support engineers in optimizing electrical or acoustic systems, aid astronomers in understanding celestial object attributes, assist seismologists with predicting earthquake risks, help medical researchers with neurological disorder identification, and detection of asymptomatic cardiovascular clotting in the vaxxed via full body thermography. In either field of study, technologies in likeness to periodograms may very well provide us with a better sliver of analysis beyond what was ever formerly invented. Periodograms can identify dominant cycles and frequency components in data, which may provide valuable insights and possibly provide better-informed decisions. By utilizing periodograms within aspects of market analytics, individuals and organizations can potentially refrain from making blinded decisions and leverage data-driven insights instead.
PERIODOGRAM INTERPRETATION:
The periodogram renders the power spectrum of a signal, with the y-axis representing the periodicity (frequencies/wavelengths) and the x-axis representing time. The y-axis is divided into periods, with each elevation representing a period. In this periodogram, the y-axis ranges from 6 at the very bottom to 49 at the top, with intermediate values in between, all indicating the power of the corresponding frequency component by color. The higher the position occurs on the y-axis, the longer the period or lower the frequency. The x-axis of the periodogram represents time and is divided into equal intervals, with each vertical column on the axis corresponding to the time interval when the signal was measured. The most recent values/colors are on the right side.
The intensity of the colors on the periodogram indicate the power level of the corresponding frequency or period. The fire color scheme is distinctly like the heat intensity from any casual flame witnessed in a small fire from a lighter, match, or camp fire. The most intense power would be indicated by the brightest of yellow, while the lowest power would be indicated by the darkest shade of red or just black. By analyzing the pattern of colors across different periods, one may gain insights into the dominant frequency components of the signal and visually identify recurring cycles/patterns of periodicity.
SETTINGS CONFIGURATIONS BRIEFLY EXPLAINED:
Source Options: These settings allow you to choose the data source for the analysis. Using the `Source` selection, you may tether to additional data streams (e.g. close, hlcc4, hl2), which also may include samples from any other indicator. For example, this could be my "Chirped Sine Wave Generator" script found in my member profile. By using the `SineWave` selection, you may analyze a theoretical sinusoidal wave with a user-defined period, something already incorporated into the code. The `SineWave` will be displayed over top of the periodogram.
Roofing Filter Options: These inputs control the range of the passband for ACP to analyze. Ehlers had two versions of his highpass filters for his releases, so I included an option for you to see the obvious difference when performing a comparison of both. You may choose between 1st and 2nd order high-pass filters.
Spectral Controls: These settings control the core functionality of the spectral analysis results. You can adjust the autocorrelation lag, adjust the level of smoothing for Fourier coefficients, and control the contrast/behavior of the heatmap displaying the power spectra. I provided two color schemes by checking or unchecking a checkbox.
Dominant Cycle Options: These settings allow you to customize the various types of dominant cycle values. You can choose between floating-point and integer values, and select the rounding method used to derive the final dominantCycle values. Also, you may control the level of smoothing applied to the dominant cycle values.
DOMINANT CYCLE VALUE SELECTIONS:
External to the acs() function, the code takes a dominant cycle value returned from acs() and changes its numeric form based on a specified type and form chosen within the indicator settings. The dominant cycle value can be represented as an integer or a decimal number, depending on the attached algorithm's requirements. For example, FIR filters will require an integer while many IIR filters can use a float. The float forms can be either rounded, smoothed, or floored. If the resulting value is desired to be an integer, it can be rounded up/down or just be in an integer form, depending on how your algorithm may utilize it.
AUTOCORRELATION SPECTRUM FUNCTION BASICALLY EXPLAINED:
In the beginning of the acs() code, the population of caches for precalculated angular frequency factors and smoothing coefficients occur. By precalculating these factors/coefs only once and then storing them in an array, the indicator can save time and computational resources when performing subsequent calculations that require them later.
In the following code block, the "Calculate AutoCorrelations" is calculated for each period within the passband width. The calculation involves numerous summations of values extracted from the roofing filter. Finally, a correlation values array is populated with the resulting values, which are normalized correlation coefficients.
Moving on to the next block of code, labeled "Decompose Fourier Components", Fourier decomposition is performed on the autocorrelation coefficients. It iterates this time through the applicable period range of 6 to 49, calculating the real and imaginary parts of the Fourier components. Frequencies 6 to 49 are the primary focus of interest for this periodogram. Using the precalculated angular frequency factors, the resulting real and imaginary parts are then utilized to calculate the spectral Fourier components, which are stored in an array for later use.
The next section of code smooths the noise ridden Fourier components between the periods of 6 and 49 with a selected filter. This species also employs numerous SuperSmoothers to condition noisy Fourier components. One of the big differences is Ehlers' versions used basic EMAs in this section of code. I decided to add SuperSmoothers.
The final sections of the acs() code determines the peak power component for normalization and then computes the dominant cycle period from the smoothed Fourier components. It first identifies a single spectral component with the highest power value and then assigns it as the peak power. Next, it normalizes the spectral components using the peak power value as a denominator. It then calculates the average dominant cycle period from the normalized spectral components using Ehlers' "Center of Gravity" calculation. Finally, the function returns the dominant cycle period along with the normalized spectral components for later external use to plot the periodogram.
POST SCRIPT:
Concluding, I have to acknowledge a newly found analyst for assistance that I couldn't receive from anywhere else. For one, Claude doesn't know much about Pine, is unfortunately color blind, and can't even see the Pine reference, but it was able to intuitively shred my code with laser precise realizations. Not only that, formulating and reformulating my description needed crucial finesse applied to it, and I couldn't have provided what you have read here without that artificial insight. Finding the right order of words to convey the complexity of ACP and the elaborate accompanying content was a daunting task. No code in my life has ever absorbed so much time and hard fricking work, than what you witness here, an ACP gem cut pristinely. I'm unveiling my version of ACP for an empowering cause, in the hopes a future global army of code wielders will tether it to highly functional computational contraptions they might possess. Here is ACP fully blessed poetically with the "Power of Pine" in sublime code. ENJOY!