RiskMosaic | SandiB V2Risk On/Off System
This indicator acts as a comprehensive framework that integrates a diverse range of indicators—spanning liquidity, sentiment, market volatility, and macroeconomic factors—to construct a holistic view of risk.
By blending these varied components, the system identifies shifts in risk-on and risk-off environments, providing a complete and dynamic assessment of global market conditions.
This allows for more informed decision-making by capturing both localized and broad market influences in real time, enabling proactive risk management and the ability to adapt to rapidly changing conditions.
Composition :
4 different categories - each one equal weight
-> Mix of Global & U.S Liquidity
-> Mix of different macro factors
-> Mix of Crypto and Commodities
-> Mix of Volatility & Risk Indicators
Colors description:
- Green = strong = full risk on sentiment/environment
- Red = weak = full risk off sentiment/environment
- Blue = recovery = medium risk on sentiment/environment
- Purple = contraction = medium risk of sentiment/environment
-> Colors are based on oscillator line:
- crossing over 0 or 0.4 = green
- crossing under 0 or -0.5 = red
- crossing over -0.35 = blue
- crossing under 0.35 = purple
Indicatori e strategie
Value at Risk [OmegaTools]The "Value at Risk" (VaR) indicator is a powerful financial risk management tool that helps traders estimate the potential losses in a portfolio over a specified period of time, given a certain level of confidence. VaR is widely used by financial institutions, traders, and risk managers to assess the probability of portfolio losses in both normal and volatile market conditions. This TradingView script implements a comprehensive VaR calculation using several models, allowing users to visualize different risk scenarios and adjust their trading strategies accordingly.
Concept of Value at Risk
Value at Risk (VaR) is a statistical technique used to measure the likelihood of losses in a portfolio or financial asset due to market risks. In essence, it answers the question: "What is the maximum potential loss that could occur in a given portfolio over a specific time horizon, with a certain confidence level?" For instance, if a portfolio has a one-day 95% VaR of $10,000, it means that there is a 95% chance the portfolio will not lose more than $10,000 in a single day. Conversely, there is a 5% chance of losing more than $10,000. VaR is a key risk management tool for portfolio managers and traders because it quantifies potential losses in monetary terms, allowing for better-informed decision-making.
There are several ways to calculate VaR, and this indicator script incorporates three of the most commonly used models:
Historical VaR: This approach uses historical returns to estimate potential losses. It is based purely on past price data, assuming that the past distribution of returns is indicative of future risks.
Variance-Covariance VaR: This model assumes that asset returns follow a normal distribution and that the risk can be summarized using the mean and standard deviation of past returns. It is a parametric method that is widely used in financial risk management.
Exponentially Weighted Moving Average (EWMA) VaR: In this model, recent data points are given more weight than older data. This dynamic approach allows the VaR estimation to react more quickly to changes in market volatility, which is particularly useful during periods of market stress. This model uses the Exponential Weighted Moving Average Volatility Model.
How the Script Works
The script starts by offering users a set of customizable input settings. The first input allows the user to choose between two main calculation modes: "All" or "OCT" (Only Current Timeframe). In the "All" mode, the script calculates VaR using all available methodologies—Historical, Variance-Covariance, and EWMA—providing a comprehensive risk overview. The "OCT" mode narrows the calculation to the current timeframe, which can be particularly useful for intraday traders who need a more focused view of risk.
The next input is the lookback window, which defines the number of historical periods used to calculate VaR. Commonly used lookback periods include 21 days (approximately one month), 63 days (about three months), and 252 days (roughly one year), with the script supporting up to 504 days for more extended historical analysis. A longer lookback period provides a more comprehensive picture of risk but may be less responsive to recent market conditions.
The confidence level is another important setting in the script. This represents the probability that the loss will not exceed the VaR estimate. Standard confidence levels are 90%, 95%, and 99%. A higher confidence level results in a more conservative risk estimate, meaning that the calculated VaR will reflect a more extreme loss scenario.
In addition to these core settings, the script allows users to customize the visual appearance of the indicator. For example, traders can choose different colors for "Bullish" (Risk On), "Bearish" (Risk Off), and "Neutral" phases, as well as colors for highlighting "Breaks" in the data, where returns exceed the calculated VaR. These visual cues make it easy to identify periods of heightened risk at a glance.
The actual VaR calculation is broken down into several models, starting with the Historical VaR calculation. This is done by computing the logarithmic returns of the asset's closing prices and then using linear interpolation to determine the percentile corresponding to the desired confidence level. This percentile represents the potential loss in the asset over the lookback period.
Next, the script calculates Variance-Covariance VaR using the mean and standard deviation of the historical returns. The standard deviation is multiplied by a z-score corresponding to the chosen confidence level (e.g., 1.645 for 95% confidence), and the resulting value is subtracted from the mean return to arrive at the VaR estimate.
The EWMA VaR model uses the EWMA for the sigma parameter, the standard deviation, obtaining a specific dynamic in the volatility. It is particularly useful in volatile markets where recent price behavior is more indicative of future risk than older data.
For traders interested in intraday risk management, the script provides several methods to adjust VaR calculations for lower timeframes. By using intraday returns and scaling them according to the chosen timeframe, the script provides a dynamic view of risk throughout the trading day. This is especially important for short-term traders who need to manage their exposure during high-volatility periods within the same day. The script also incorporates an EWMA model for intraday data, which gives greater weight to the most recent intraday price movements.
In addition to calculating VaR, the script also attempts to detect periods where the asset's returns exceed the estimated VaR threshold, referred to as "Breaks." When the returns breach the VaR limit, the script highlights these instances on the chart, allowing traders to quickly identify periods of extreme risk. The script also calculates the average of these breaks and displays it for comparison, helping traders understand how frequently these high-risk periods occur.
The script further visualizes the risk scenario using a risk phase classification system. Depending on the level of risk, the script categorizes the market as either "Risk On," "Risk Off," or "Risk Neutral." In "Risk On" mode, the market is considered bullish, and the indicator displays a green background. In "Risk Off" mode, the market is bearish, and the background turns red. If the market is neither strongly bullish nor bearish, the background turns neutral, signaling a balanced risk environment.
Traders can customize whether they want to see this risk phase background, along with toggling the display of the various VaR models, the intraday methods, and the break signals. This flexibility allows traders to tailor the indicator to their specific needs, whether they are day traders looking for quick intraday insights or longer-term investors focused on historical risk analysis.
The "Risk On" and "Risk Off" phases calculated by this Value at Risk (VaR) script introduce a novel approach to market risk assessment, offering traders an advanced toolset to gauge market sentiment and potential risk levels dynamically. These risk phases are built on a combination of traditional VaR methodologies and proprietary logic to create a more responsive and intuitive way to manage exposure in both normal and volatile market conditions. This method of classifying market conditions into "Risk On," "Risk Off," or "Risk Neutral" is not something that has been traditionally associated with VaR, making it a groundbreaking addition to this indicator.
How the "Risk On" and "Risk Off" Phases Are Calculated
In typical VaR implementations, the focus is on calculating the potential losses at a given confidence level without providing an overall market outlook. This script, however, introduces a unique risk classification system that takes the output of various VaR models and translates it into actionable signals for traders, marking whether the market is in a Risk On, Risk Off, or Risk Neutral phase.
The Risk On and Risk Off phases are primarily determined by comparing the current returns of the asset to the average VaR calculated across several different methods, including Historical VaR, Variance-Covariance VaR, and EWMA VaR. Here's how the process works:
1. Threshold Setting and Effect Calculation: The script first computes the average VaR using the selected models. It then checks whether the current returns (expressed as a negative value to signify loss) exceed the average VaR value. If the current returns surpass the calculated VaR threshold, this indicates that the actual market risk is higher than expected, signaling a potential shift in market conditions.
2. Break Analysis: In addition to monitoring whether returns exceed the average VaR, the script counts the number of instances within the lookback period where this breach occurs. This is referred to as the "break effect." For each period in the lookback window, the script checks whether the returns surpass the calculated VaR threshold and increments a counter. The percentage of periods where this breach occurs is then calculated as the "effect" or break percentage.
3. Dual Effect Check (if "Double" Risk Scenario is selected): When the user chooses the "Double" risk scenario mode, the script performs two layers of analysis. First, it calculates the effect of returns exceeding the VaR threshold for the current timeframe. Then, it calculates the effect for the lower intraday timeframe as well. Both effects are compared to the user-defined confidence level (e.g., 95%). If both effects exceed the confidence level, the market is deemed to be in a high-risk situation, thus triggering a Risk Off phase. If both effects fall below the confidence level, the market is classified as Risk On.
4. Risk Phases Determination: The final risk phase is determined by analyzing these effects in relation to the confidence level:
- Risk On: If the calculated effect of breaks is lower than the confidence level (e.g., fewer than 5% of periods show returns exceeding the VaR threshold for a 95% confidence level), the market is considered to be in a relatively safe state, and the script signals a "Risk On" phase. This is indicative of bullish conditions where the potential for extreme loss is minimal.
- Risk Off: If the break effect exceeds the confidence level (e.g., more than 5% of periods show returns breaching the VaR threshold), the market is deemed to be in a high-risk state, and the script signals a "Risk Off" phase. This indicates bearish market conditions where the likelihood of significant losses is higher.
- Risk Neutral: If the break effect hovers near the confidence level or if there is no clear trend indicating a shift toward either extreme, the market is classified as "Risk Neutral." In this phase, neither bulls nor bears are dominant, and traders should remain cautious.
The phase color that the script uses helps visualize these risk phases. The background will turn green in Risk On conditions, red in Risk Off conditions, and gray in Risk Neutral phases, providing immediate visual feedback on market risk. In addition to this, when the "Double" risk scenario is selected, the background will only turn green or red if both the current and intraday timeframes confirm the respective risk phase. This double-checking process ensures that traders are only given a strong signal when both longer-term and short-term risks align, reducing the likelihood of false signals.
A New Way of Using Value at Risk
This innovative Risk On/Risk Off classification, based on the interaction between VaR thresholds and market returns, represents a significant departure from the traditional use of Value at Risk as a pure risk measurement tool. Typically, VaR is employed as a backward-looking measure of risk, providing a static estimate of potential losses over a given timeframe with no immediate actionable feedback on current market conditions. This script, however, dynamically interprets VaR results to create a forward-looking, real-time signal that informs traders whether they are operating in a favorable (Risk On) or unfavorable (Risk Off) environment.
By incorporating the "break effect" analysis and allowing users to view the VaR breaches as a percentage of past occurrences, the script adds a predictive element that can be used to time market entries and exits more effectively. This **dual-layer risk analysis**, particularly when using the "Double" scenario mode, adds further granularity by considering both current timeframe and intraday risks. Traders can therefore make more informed decisions not just based on historical risk data, but on how the market is behaving in real-time relative to those risk benchmarks.
This approach transforms the VaR indicator from a risk monitoring tool into a decision-making system that helps identify favorable trading opportunities while alerting users to potential market downturns. It provides a more holistic view of market conditions by combining both statistical risk measurement and intuitive phase-based market analysis. This level of integration between VaR methodologies and real-time signal generation has not been widely seen in the world of trading indicators, marking this script as a cutting-edge tool for risk management and market sentiment analysis.
I would like to express my sincere gratitude to @skewedzeta for his invaluable contribution to the final script. From generating fresh ideas to applying his expertise in reviewing the formula, his support has been instrumental in refining the outcome.
RSI from Rolling VWAP [CHE]Introducing the RSI from Rolling VWAP Indicator
Elevate your trading strategy with the RSI from Rolling VWAP —a cutting-edge indicator designed to provide unparalleled insights and enhance your decision-making on TradingView. This advanced tool seamlessly integrates the Relative Strength Index (RSI) with a Rolling Volume-Weighted Average Price (VWAP) to deliver precise and actionable trading signals.
Why Choose RSI from Rolling VWAP ?
- Clear Trend Detection: Our enhanced algorithms ensure accurate identification of bullish and bearish trends, allowing you to capitalize on market movements with confidence.
- Customizable Time Settings: Tailor the time window in days, hours, and minutes to align perfectly with your unique trading strategy and market conditions.
- Flexible Moving Averages: Select from a variety of moving average types—including SMA, EMA, WMA, and more—to smooth the RSI, providing clearer trend analysis and reducing market noise.
- Threshold Alerts: Define upper and lower RSI thresholds to effortlessly spot overbought or oversold conditions, enabling timely and informed trading decisions.
- Visual Enhancements: Enjoy a visually intuitive interface with color-coded RSI lines, moving averages, and background fills that make interpreting market data straightforward and efficient.
- Automatic Signal Labels: Receive immediate bullish and bearish labels directly on your chart, signaling potential trading opportunities without the need for constant monitoring.
Key Features
- Inspired by Proven Tools: Building upon the robust foundation of TradingView's Rolling VWAP, our indicator offers enhanced functionality and greater precision.
- Volume-Weighted Insights: By incorporating volume into the VWAP calculation, gain a deeper understanding of price movements and market strength.
- User-Friendly Configuration: Easily adjust settings to match your trading preferences, whether you're a novice trader or an experienced professional.
- Hypothesis-Driven Analysis: Utilize hypothetical results to backtest strategies, understanding that past performance does not guarantee future outcomes.
How It Works
1. Data Integration: Utilizes the `hlc3` (average of high, low, and close) as the default data source, with customization options available to suit your trading needs.
2. Dynamic Time Window: Automatically calculates the optimal time window based on an auto timeframe or allows for fixed time periods, ensuring flexibility and adaptability.
3. Rolling VWAP Calculation: Accurately computes the Rolling VWAP by balancing price and volume over the specified time window, providing a reliable benchmark for price action.
4. RSI Analysis: Measures momentum through RSI based on Rolling VWAP changes, smoothed with your chosen moving average for enhanced trend clarity.
5. Actionable Signals: Detects and labels bullish and bearish conditions when RSI crosses predefined thresholds, offering clear indicators for potential market entries and exits.
Seamless Integration with Your TradingView Experience
Adding the RSI from Rolling VWAP to your TradingView charts is straightforward:
1. Add to Chart: Simply copy the Pine Script code into TradingView's Pine Editor and apply it to your desired chart.
2. Customize Settings: Adjust the Source Settings, Time Settings, RSI Settings, MA Settings, and Color Settings to align with your trading strategy.
3. Monitor Signals: Watch for RSI crossings above or below your set thresholds, accompanied by clear labels indicating bullish or bearish trends.
4. Optimize Your Trades: Leverage the visual and analytical strengths of the indicator to make informed buy or sell decisions, maximizing your trading potential.
Disclaimer:
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Get Started Today
Transform your trading approach with the RSI from Rolling VWAP indicator. Experience the synergy of momentum and volume-based analysis, and unlock the potential for more accurate and profitable trades.
Download now and take the first step towards a more informed and strategic trading journey!
For further inquiries or support, feel free to contact
Best regards
Chervolino
Inspired by the acclaimed Rolling VWAP by TradingView
Z-Scored Moving Average Suite [KFB Quant]Z-Scored Moving Average Suite
This indicator combines several types of moving averages—Simple, Exponential, and Weighted—with a Z-Score calculation to give a clearer understanding of price trends in relation to their historical averages. It is used to detect overbought (OB) and oversold (OS) conditions, allowing you to see when an asset is deviating significantly from its mean.
Key Components:
Moving Averages: The suite includes Simple (SMA), Exponential (EMA), and Weighted (WMA) Moving Averages. For each, a single, double, and triple version is calculated to smooth out noise.
Z-Score: The Z-Score measures how far the current price is from its moving average in terms of standard deviations, helping to highlight unusual price behavior.
Overbought and Oversold Levels:
- When the Z-Score crosses above a predefined threshold (1.5 by default), the asset is considered Overbought (OB).
- When the Z-Score drops below a certain level (-1.5 by default), the asset is seen as Oversold (OS).
Visualization:
- The histogram represents the average Z-Score of all the moving averages combined, colored based on bullish (blue) or bearish (brown) trends.
- Individual Z-Scores for each moving average type (SMA, EMA, WMA) are also plotted, providing further insight into the momentum and direction.
Signals:
- The table in the chart shows a summary of Z-Scores for each type of moving average. It also provides a quick glance at whether the asset is in a bullish or bearish phase, if the Z-Scores are rising or falling, and whether the asset is overbought or oversold.
This tool is highly customizable, with adjustable lengths for the moving averages and Z-Scores, making it a flexible addition to any trading strategy that relies on mean-reversion or trend analysis.
Disclaimer: This tool is provided for informational and educational purposes only and should not be considered as financial advice. Always conduct your own research and consult with a licensed financial advisor before making any investment decisions.
OBV based on MADescription:
This indicator calculates On-Balance Volume (OBV) based on the direction of a Simple Moving Average (SMA). Instead of using price movements, this OBV adds or subtracts volume depending on whether the SMA is rising or falling.
SMA-based OBV: When the SMA rises, the volume is added to the OBV. When the SMA falls, the volume is subtracted from the OBV. This allows traders to observe cumulative volume in relation to the wave patterns created by the SMA.
SMA Period: The period of the SMA can be customized, allowing traders to adjust it according to the wave size they want to observe.
While the cumulative volume indicator already exists, traders who analyze volume patterns can use this indicator to more easily conduct volume analysis across different wave sizes.
Inputs:
SMA Period: Defines the lookback period for calculating the Simple Moving Average (default is 25).
Ideal for:
Traders who want to analyze volume flow relative to moving average trends, rather than price movements. This can help identify underlying strength or weakness in market trends.
説明:
このインジケーターは、単純移動平均(SMA)の方向に基づいてオンバランス・ボリューム(OBV)を計算します。価格の動きではなく、SMAが上昇しているときは出来高を加算し、SMAが下降しているときは出来高を減算します。
SMA基準のOBV: SMAが上昇している場合はOBVに出来高が加算され、SMAが下降している場合は出来高が減算されます。これにより、SMAが作る波形に即した累積出来高を観察することができます。
SMA期間: トレーダーが見たい波のサイズ感に応じて、SMAの期間をカスタマイズできます。
既に累積出来高(Cumulative Volume)というインジケーターは存在しますが、波形を基に出来高を分析しているトレーダーは、このインジケーターを使うことで、様々なサイズの波形に即した出来高分析をより簡単に行うことができます。
入力項目:
SMA期間: 単純移動平均の計算に使用される期間を定義します(デフォルトは25)。
適しているトレーダー:
より波形に即した累積出来高分析を重視するトレーダーに最適です。
MB - Currency Strength ROCCurrency Strength ROC Enhanced is a technical indicator designed to measure and visualize the relative strength of different currencies in the foreign exchange market. Using a Rate of Change (ROC) approach and moving averages, this indicator provides valuable insights into the dynamics of currency strengths.
Key Features:
Relative Strength Measurement:
Calculates the strength of each currency relative to others, allowing you to identify which currencies are appreciating or depreciating.
Strength Histogram:
Presents normalized strength in a histogram format, making it easy to quickly see areas of positive (green) and negative (red) strength
Moving Averages:
Includes moving averages of normalized strength and trend, providing a clear view of the overall direction of strength over time.
Overbought and Oversold Zones:
Highlights critical levels of strength through horizontal lines, allowing traders to identify potential trend reversals.
Volume Trend Swing Points | viResearchVolume Trend Swing Points | viResearch
Conceptual Foundation and Innovation
The "Volume Trend Swing Points" script is designed to identify pivotal swing points in market trends by leveraging the Price Volume Trend (PVT) indicator. This unique approach combines price and volume movements to highlight moments when a market may experience a significant trend reversal. By detecting the highest and lowest points of the PVT over customizable periods, this script aims to provide traders with valuable insights into potential bullish or bearish market behavior.
The simplicity of the script, combined with its use of the PVT, offers an effective way for traders to anticipate key market swings based on both price and volume momentum.
Technical Composition and Calculation
The core of the "Volume Trend Swing Points" script is built around the Price Volume Trend (PVT) indicator, which adjusts price changes according to trading volume. The script focuses on identifying the highest and lowest values of the PVT over user-defined lookback periods:
Price Volume Trend (PVT): The PVT is used to calculate the momentum of price movements, taking volume into account. By incorporating both price and volume, the PVT offers a more dynamic and responsive indicator of trend direction compared to price alone.
Swing Point Detection: The script identifies the highest and lowest PVT values over user-defined lookback periods (x for highs and y for lows). When the current PVT matches either the highest or lowest value, it signals a potential trend reversal or continuation, depending on whether the high or low is detected.
Entry and Exit Signals: A long signal (bullish) is generated when the current PVT matches the highest value over the lookback period, while a short signal (bearish) is generated when the current PVT matches the lowest value. These signals can be visualized with alerts and background colors.
Features and User Inputs
The "Volume Trend Swing Points" script allows traders to customize several parameters to better suit their trading strategies and market conditions:
Lookback Periods (x and y): The script allows for two customizable lookback periods—one for detecting the highest PVT and another for the lowest. Adjusting these values can help refine the sensitivity of the swing points.
Bar Coloring: The script includes an optional setting to color the bars based on detected bullish or bearish trends, making it easier to visualize potential market shifts.
Background Colors: The background color changes dynamically based on whether a high or low swing point is detected, providing traders with a clear visual indication of potential trend reversals.
Alerts: The script includes alert conditions for both long and short signals, enabling traders to set notifications for when potential swing points are detected.
Practical Applications
The "Volume Trend Swing Points" script is ideal for traders who focus on price and volume dynamics when making trading decisions. Its application is particularly useful in the following scenarios:
Detecting Trend Reversals: By identifying the highest and lowest PVT values over a given period, the script can help traders spot potential reversal points, allowing for more timely entries or exits.
Confirming Trend Continuations: When the PVT continues to match the highest or lowest values, it may indicate that the trend is likely to continue, helping traders maintain their positions with greater confidence.
Volume-Based Trend Analysis: Since the script uses the PVT, it is particularly effective in markets where volume plays a significant role in driving price movements, offering insights that go beyond simple price-based indicators.
Advantages and Strategic Value
This script enhances traditional trend analysis by incorporating both price and volume through the PVT, providing a more comprehensive view of market momentum. The customizable lookback periods allow traders to adapt the script to different assets and timeframes, making it a versatile tool for swing trading and trend-following strategies.
The visual cues provided by bar coloring and background shading help traders quickly identify potential market shifts, improving decision-making speed and accuracy.
Summary and Usage Tips
The "Volume Trend Swing Points" script is a straightforward yet powerful tool for identifying market reversals and trend continuations based on both price and volume. By adjusting the lookback periods, traders can fine-tune the script to better suit their trading style and the assets they are monitoring. The visual and alert features further enhance the script's usability, making it easy to incorporate into a trading strategy.
Remember to backtest the script across various market conditions to better understand its performance. Past performance is not necessarily indicative of future results, so using this script in conjunction with other technical tools is recommended for optimal decision-making.
(MA-EWMA) with ChannelsHamming Windowed Volume-Weighted Bidirectional Momentum-Adaptive Exponential Weighted Moving Average
This script is an advanced financial indicator that calculates a Hamming Windowed Volume-Weighted Bidirectional Momentum-Adaptive Exponential Weighted Moving Average (MA-EWMA). It adapts dynamically to market conditions, adjusting key parameters like lookback period, momentum length, and volatility sensitivity based on price volatility.
Key Components:
Dynamic Adjustments: The indicator adjusts its lookback and momentum length using the ATR (Average True Range), making it more responsive to volatile markets.
Volume Weighting: It incorporates volume data, weighting the moving average based on the volume activity, adding further sensitivity to price movement.
Bidirectional Momentum: It calculates upward and downward momentum separately, using these values to determine the directional weighting of the moving average.
Hamming Window: This technique smooths the price data by applying a Hamming window, which helps to reduce noise in the data and enhances the accuracy of the moving average.
Channels: Instead of plotting a single line, the script creates dynamic channels, providing more context for support and resistance levels based on the market's behavior.
The result is a highly adaptive and sophisticated moving average indicator that responds dynamically to both price momentum and volume trends.
VIDYA with Dynamic Length Based on ICPThis script is a Pine Script-based indicator that combines two key concepts: the Instantaneous Cycle Period (ICP) from Dr. John Ehlers and the Variable Index Dynamic Average (VIDYA). Here's an overview of how the script works:
Components:
Instantaneous Cycle Period (ICP):
This part of the indicator uses Dr. John Ehlers' approach to detect the market cycle length dynamically. It calculates the phase of price movement by computing the in-phase and quadrature components of the price detrended over a specific period.
The ICP helps adjust the smoothing length dynamically, giving a real-time estimate of the dominant cycle in price action. The script uses a phase calculation, adjusts it for cycle dynamics, and smoothes it for more reliable readings.
VIDYA (Variable Index Dynamic Average):
VIDYA is a moving average that dynamically adjusts its smoothing length based on the market conditions, in this case, using the RSI (Relative Strength Index) as a weight.
The length of VIDYA is determined by the dynamically calculated ICP, allowing it to adapt to changing market cycles.
This indicator performs several recursive layers of VIDYA smoothing (applying VIDYA multiple times) to provide a more refined result.
Key Features:
Dynamic Length: The length for the VIDYA calculation is derived from the smoothed ICP value, meaning that the smoothing adapts to the detected cycle length in real-time, making the indicator more responsive to market conditions.
Multiple VIDYA Layers: The script applies multiple layers of VIDYA smoothing (up to 5 iterations), further refining the output to smooth out market noise while maintaining responsiveness.
Plotting: The final smoothed VIDYA value and the smoothed ICP length are plotted. Additionally, overbought (70) and oversold (30) horizontal lines are provided for visual reference.
Application:
This indicator helps identify trends, smooths out price data, and adapts dynamically to market cycles. It's useful for detecting shifts in momentum and trends, and traders can use it to identify overbought or oversold conditions based on dynamically calculated thresholds.
Optimized WaveletsThe script, High-Resolution Volume-Price Pressure Indicator with Wavelets, utilizes wavelet transforms and high-resolution data to analyze market pressure based on volume and price dynamics. The approach combines volume data from smaller timeframes (1 second) with non-linear transformation techniques to generate a refined view of market conditions. Here’s a detailed breakdown of how it works:
Key Components:
Wavelet Transform:
A wavelet function is applied to the price and volume data to capture patterns over a set time period. This technique helps identify underlying structures in the data that might be missed with traditional moving averages.
High-Resolution Data:
The indicator fetches 1-second high-resolution data for price movements and volume. This allows the strategy to capture granular price and volume changes, crucial for short-term trading decisions.
Normalized Difference:
The script calculates the normalized difference in price and volume data. By comparing changes over the selected length, it standardizes these movements to help detect sudden shifts in market pressure.
Sigmoid Transformation:
After combining the price and volume wavelet data, a sigmoid function is applied to smooth out the resulting values. This non-linear transformation helps highlight significant moves while filtering out minor fluctuations.
Volume-Price Pressure:
The up and down volume differences, together with price movements, are combined to create a "Volume-Price Pressure Score." The final indicator reflects the pressure exerted on the market by both buyers and sellers.
Indicator Plot:
The final transformed score is plotted, showing how price and volume dynamics, combined through wavelet transformation, interact. The indicator can be used to identify potential market turning points or pressure buildups based on volume and price movement patterns.
This approach is well-suited for traders looking for advanced signal detection based on high-frequency data and can provide insight into areas where typical indicators may lag or overlook short-term volatility.
Sweep + MSS# Sweep + MSS Indicator
This indicator identifies market sweeps and Market Structure Shifts (MSS) to help traders recognize potential trend changes and market manipulations.
How it works:
1. Sweep Detection:
- Identifies when price briefly moves beyond a recent high/low (pivot point) and then reverses.
- Bullish sweep: Price drops below a recent low, then closes above it.
- Bearish sweep: Price rises above a recent high, then closes below it.
2. Market Structure Shift (MSS):
- Occurs when price action invalidates a previous sweep level.
- Bullish MSS: Price closes above a bearish sweep level.
- Bearish MSS: Price closes below a bullish sweep level.
Key Features:
- Customizable pivot lookback length for sweep detection
- Minimum bar requirement after a sweep before MSS can trigger
- One MSS per sweep level to avoid multiple signals
- Visual representation with lines connecting sweep points to MSS triggers
- Emoji labels for easy identification (🐂-MSS for bullish, 🐻-MSS for bearish)
Logic Behind MSS:
The MSS aims to identify potential trend changes by recognizing when the market invalidates a previous sweep level. This often indicates a shift in market structure, suggesting that the previous trend may be weakening or reversing.
- A bullish MSS occurs when the price closes above a bearish sweep level, potentially signaling a shift from bearish to bullish sentiment.
- A bearish MSS occurs when the price closes below a bullish sweep level, potentially signaling a shift from bullish to bearish sentiment.
By requiring a minimum number of bars between the sweep and the MSS, the indicator helps filter out noise and focuses on more significant structural changes in the market.
This indicator can be a valuable tool for traders looking to identify potential trend changes and entry/exit points based on market structure analysis.
Merged Efficiency & Time-Based OscillatorThis indicator is a fusion of two key trading concepts: the Efficiency Ratio and the Time-to-Change RSI, designed to give a comprehensive analysis of market movement and trend sustainability.
Efficiency Ratio (ER): This part of the indicator measures how effectively the market is moving in a certain direction by comparing net price change to the total price movement over a set period. The ratio helps identify whether the market is trending smoothly or experiencing choppy, inefficient moves. A higher ratio indicates more efficient, directional movement, while a lower ratio suggests market noise or indecision.
Time-to-Change RSI: This section tracks both the duration and value of upward and downward price movements. It calculates how much time is spent in upward or downward trends (gain time vs. loss time) and the size of these price changes. The Time-to-Change RSI and the Value RSI provide insight into how long and how strongly the market has been moving in one direction, helping traders gauge potential shifts in momentum.
By merging these two indicators, the resulting oscillator offers a more dynamic signal that highlights both market efficiency and momentum. The combined output shows how efficiently the market is trending while also taking into account the time spent in these trends and the relative strength of price changes. This allows traders to detect possible trend reversals, overbought/oversold conditions, and shifts in market momentum.
The indicator plots the merged signal, as well as overbought and oversold thresholds.
Oversold and overbought levels seem to be really effective
UtilityLibrary "Utility"
A utility library for various trading tools such as signal generation, custom indicators, and multi-condition crossovers.
multiCrossover(source1, source2, threshold1, threshold2)
multiCrossover
@description Detects multi-condition crossovers between two sources with threshold filters.
Parameters:
source1 (float) : The first data series to compare.
source2 (float) : The second data series to compare.
threshold1 (float) : A value that source1 must exceed to trigger the crossover.
threshold2 (float) : A value that source2 must exceed to trigger the crossunder.
Returns: A tuple: (crossUp, crossDown) where crossUp is a boolean for upward crossover, and crossDown is for downward crossover.
macdCustom(source, fastLength, slowLength, signalLength, macdThresh)
macdCustom
@description Calculates custom MACD signals based on thresholds.
Parameters:
source (float) : The price data or input series.
fastLength (simple int) : The length of the fast EMA.
slowLength (simple int) : The length of the slow EMA.
signalLength (simple int) : The signal line length.
macdThresh (float) : A threshold for the MACD line to confirm buy/sell signals.
Returns: A tuple: (macdBuySignal, macdSellSignal) where macdBuySignal is true when MACD crosses above, and macdSellSignal is true when MACD crosses below the signal line.
combinedMacdRsi(source, fastLength, slowLength, signalLength, rsiLength, macdThresh, rsiThresh)
combinedMacdRsi
@description Generates combined signals from MACD and RSI indicators.
Parameters:
source (float) : The price data or input series.
fastLength (simple int) : The length of the fast EMA for MACD.
slowLength (simple int) : The length of the slow EMA for MACD.
signalLength (simple int) : The signal line length for MACD.
rsiLength (simple int) : The length of the RSI calculation.
macdThresh (float) : The threshold for MACD signals.
rsiThresh (float) : The threshold for RSI signals.
Returns: A tuple: (buySignal, sellSignal) where buySignal is generated when MACD is positive and RSI is below the threshold, and sellSignal when MACD is negative and RSI is above the threshold.
movingAverageCrossover(source, shortLength, longLength)
movingAverageCrossover
@description Detects crossovers between short-term and long-term moving averages.
Parameters:
source (float) : The price data or input series.
shortLength (int) : The length of the short-term moving average.
longLength (int) : The length of the long-term moving average.
Returns: A tuple: (crossUp, crossDown) where crossUp is true when the short-term MA crosses above the long-term MA, and crossDown when the reverse occurs.
BTC ETF Flow Trading SignalsTracks large money flows (500M+) across major Bitcoin ETFs (IBIT, BTCO, FBTC, ARKB, BITB)
Generates long/short signals based on institutional money movement
Shows flow trends and strength of movements
This script provides a foundation for comparing ETF inflows and Bitcoin price. The effectiveness of the analysis depends on the quality of the data and your interpretation of the results. Key levels of 500M and 350M Inflow/Outflow Enjoy
Collaboration with Vivid Vibrations
Enjoy & improve!
Highest Single-Day Percentage Change (Close to Close)This Pine Script is designed to calculate and display the largest percentage change in stock price between consecutive days' closing prices. Here's a high-level breakdown of what the script does:
Daily Percentage Change Calculation:
It calculates how much the stock price changed from the previous day's close to the current day's close. The change is expressed as a percentage of the previous day's closing price.
Tracking the Highest Change:
The script keeps track of the largest percentage increase or decrease it has encountered in the dataset (from previous close to current close). It updates the value if a new day exceeds the current largest recorded percentage change.
Visual Representation:
The daily percentage changes are plotted as a line graph, allowing you to see how the stock's price fluctuates from one day to the next.
A separate line is drawn to represent the highest percentage change detected so far.
If a day's price change matches the highest recorded change, a label appears on the chart to highlight that specific point.
Dynamic Updates:
The script is dynamic, meaning it continually updates as new data comes in. So, as new days are added to the chart, the script checks if the percentage change exceeds the previously highest recorded value.
Why This Is Useful:
For traders and investors: It provides a quick way to identify which day saw the most significant price movement, helping to spot major market events or volatility.
For historical analysis: You can quickly find the most extreme single-day price swings in a stock's historical data, which might be useful for understanding past market behavior or making predictions about future moves.
Saturn Retrograde PeriodsSaturn Retrograde Periods Visualizer for TradingView
This Pine Script visualizes all Saturn retrograde periods since 2009, including the current retrograde ending on November 15, 2024. The script overlays yellow boxes on your TradingView chart to highlight the exact periods of Saturn retrograde. It's a great tool for astrologically-inclined traders or those interested in market timing based on astrological events.
Key Features:
Full Historical Coverage: Displays Saturn retrograde periods from 2009 (the inception of Bitcoin) to the current retrograde ending in November 2024.
Customizable Appearance: You can easily adjust the color and opacity of the boxes directly from the script's settings window, making it flexible for various chart styles.
Visual Clarity: The boxes span the full vertical range of your chart, ensuring the retrograde periods are clearly visible over any asset, timeframe, or price action.
How to Use:
Add the script to your TradingView chart.
Adjust the color and opacity in the settings to suit your preferences.
View all relevant Saturn retrograde periods and analyze how these astrological events may align with price movements in your selected asset.
This script is perfect for traders and analysts who want to combine astrology with financial market analysis!
scripted by chat.gpt - version 1.0
High Volume Strikes - NovaTheMachineConverts your inputs into Horizontal Lines on a chart, Creates a table to indicate all known levels input & tell you how far away you are from each level.
This is a quality of life indicator, not a signal, or trend indicator.
In order for the indicator to plot the levels correctly, please use the following format (Where '$TICKER' is replaced by your instrument of choice such as ' AMEX:SPY ', and 'value' is a positive number with up to 2 decimal places, such as '123.45';
"$TICKER: Golden Strike:value, HVOL Upper:value, HVOL Lower:value, MVC:value, MVP:value, CVR Upper:value, CVR Lower:value, PVR Upper:value, PVR Lower:value, Block 1:value, Block 2:value, Block 3:value, Block 4:value, Block 5:value, Block 6:value"
These Key Levels described below, are values You must determine yourself via Options Chain Volume Analysis
MVC: Most Volume Call - Single Strike with Highest Volume Traded on Call Side
MVP: Most Volume Put - Single Strike with Highest Volume Traded on Put Side
Golden Strike: When MVC = MVP, otherwise = The Sum of (MVP + MVC)/2
HVOL Range: The Range in which Strikes are traded most on both Call & Put sides
PVR: The Total useful Range that is un-interrupted on both Call & Put sides
CVR: The Range of Strikes that is un-interrupted on both Call & Puts sides for the Next Expiry
Blocks: Individual Blocks that may be of significant Volume, on either Call or Put sides, outside the range of CVR & PVR
[EmreKb] Combined CandlesThis script combines multiple candlestick patterns into a single, unified candle when they are of the same type (bullish or bearish). Instead of displaying every individual candle on the chart, it merges consecutive candles based on their direction to simplify the visual analysis of price movements.
What It Does:
Combines Candles: If two or more consecutive candles are bullish (close price higher than open price) or bearish (close price lower than open price), the script merges them into a single candle, adjusting the high, low, and close values accordingly.
Displays Merged Candles: The merged candles are drawn on the chart. A green bar represents a bullish period, while a red bar represents a bearish period.
How It Works:
The script tracks whether each candle is bullish or bearish.
If a candle is the same type as the previous one, it updates the combined candle (adjusting the high, low, and close values).
When the type changes (from bullish to bearish or vice versa), it finalizes the current combined candle and starts a new one.
The merged candles are displayed on the chart at the end of the data series.
Use Case:
This script simplifies price action by grouping similar candles together, making it easier to identify trends and spot periods of sustained buying or selling pressure. It can help traders focus on the overall direction of the market rather than being distracted by small fluctuations between individual candles.
Wave Anchor IndicatorThe Wave Anchor Indicator is designed to mark the crossing of overbought and oversold levels of higher time frame momentum waves, based on the VuManChu Cipher B+Divergences Wave Trend Indicator. This tool is inspired by the TP Mint trading strategy, which relies heavily on the momentum waves of Market Cipher B or VuManChu Cipher B for identifying optimal entry and exit points.
Key Concept: Anchored Waves
In the TP Mint strategy, momentum waves in overbought (above 60) or oversold (below -60) conditions on higher time frames are considered "anchored." These anchored waves provide strong signals for entries and take-profit points when viewed on lower time frames. The Wave Anchor Indicator focuses on these anchor conditions to help traders make informed decisions by seeing higher time frame anchor states directly on the entry time frame chart.
How It Works
Labeling Signals:
- On lower time frames, such as the 15-minute chart, the indicator shows labels when higher
time frame momentum waves (1-hour and 4-hour) cross the overbought or oversold levels.
- Labels above price indicate overbought conditions, with green labels when the wave crosses
upward and red labels when crossing downward.
- Labels below price signal oversold conditions, with red for a downward cross and green for an
upward cross.
- Each label displays the time frame of the crossing momentum wave, providing context for
traders at a glance.
Time Frame Pairings:
- On the 15-minute time frame, the indicator tracks anchor conditions from the 1-hour and 4-
hour time frames.
- On the 1-hour chart, it monitors 4-hour and daily time frame anchor conditions.
Customization and Alerts
Flexible Display Options : Users can choose to display none, one, or both of the grouped higher time frame labels, depending on their strategy and preferences.
Alerts : The indicator also allows for custom alerts when a label appears, helping traders stay on top of key market movements without constantly monitoring the chart.
Use Cases
This indicator is ideal for traders who use momentum-based strategies across multiple time frames. It simplifies the process of identifying key entry and exit points by focusing on the anchor conditions from higher time frames, making it easier to execute the TP Mint strategy or similar methods.
Thank you to VuManChu and LazyBear for mamking the momentum wave code open source and allowing it’s use in this indicator.
Time Vertical LinesVLines - Time-Based Vertical Lines with Zones
This PineScript indicator creates vertical time lines with customizable zones between them. Perfect for marking trading sessions, key market times, or any time-based analysis.
Key Features:
- 5 configurable time lines
- 3 customizable zones (between lines 1-2, 2-3, and 4-5)
- Each zone features:
- Background shading
- Horizontal lines at high/low points
- Independent color controls
- Adjustable line styles and widths
- Time zone offset adjustment
- Option to show/hide historical lines
Installation Instructions:
1. Open TradingView's Pine Script Editor
2. Create a new script
3. Copy and paste the entire code
4. Add to Chart
Setup Guide:
1. Time Zone Adjustment:
- Find the "Time Zone Offset (Hours)" setting
- Adjust if lines appear at wrong times
- Example: If lines appear 3 hours early, set offset to 3
2. Basic Time Lines (1-3):
- Each line has settings for:
- Hour (0-23)
- Minute (0-59)
- Color
- Show/Hide toggle
3. Session Lines (4-5):
- Special lines typically used for session marking
- Same settings as basic lines
- Default red color to distinguish from other lines
4. Zone Customization:
Three separate zones are available:
- Zone 1-2 (between first and second lines)
- Zone 2-3 (between second and third lines)
- Zone 4-5 (between fourth and fifth lines)
Each zone can be customized with:
- Background color and transparency
- Horizontal line color
- Line style (Solid/Dashed/Dotted)
- Line width
- Individual show/hide toggles for zone and lines
5. Additional Settings:
- "Show Historical Lines" - toggle to show/hide lines on previous days
- Global line style and width settings for vertical lines
Suggested Uses:
1. Mark pre-market, market, and post-market sessions
2. Highlight specific trading windows
3. Track time-based support/resistance levels
4. Monitor price ranges during specific time periods
Tips:
- Start by setting just one zone to get familiar with the controls
- Use different colors for different sessions/time periods
- Adjust transparency to maintain chart visibility
- Use the show/hide toggles to focus on specific times
- The horizontal lines automatically mark the high/low range between time points
Sector Trend MapThe Sector Trend Map is a powerful tool designed to provide a sentiment heatmap for major market sectors. This indicator tracks the average trend direction across 11 key sectors, including Technology, Financials, Healthcare, Energy, and more. By monitoring each sector's sentiment, the Sector Trend Map helps traders quickly assess whether sectors are bullish or bearish, allowing for better-informed trading decisions.
This indicator plots a visual heatmap showing the sentiment strength for each sector on a scale from 0 to 100. The colors range from green for bullish sentiment to red for bearish sentiment. Additionally, it displays a real-time percentage of sectors that are bullish and bearish in a dynamic table located in the bottom right corner of the chart.
This indicator simplifies sector sentiment analysis by providing clear visual cues, making it easy to stay on top of market dynamics and make data-driven trading decisions.
Key Features:
Sentiment Heatmap: Displays a heatmap of sector sentiment ranging from bullish (green) to bearish (red).
Bullish/Bearish Percentages: A dynamic table showing the percentage of sectors that are bullish or bearish.
Tracks 11 Key Sectors: Monitors sectors such as Technology, Financials, Energy, Healthcare, and more.
Simple and Clear Visuals: Provides easy-to-read color coding for quick decision-making.
Customizable Moving Averages: Select between SMA, EMA, WMA, or DEMA for the trend calculation.
Market Hours Sensitivity: Indicator operates during regular market hours, ensuring relevance for day traders and active traders.
Overlay Sentiment Colors on Candles:
This feature allows you to overlay the sentiment (green for bullish, red for bearish) directly onto the price chart candles. You can enable or disable this option based on your preference.
How to Use the Sector Trend Map:
The heatmap is divided into different sectors. Each sector is colored based on its current sentiment:
🟢 Green (Bullish sentiment)
🔴 Red (Bearish sentiment)
Sentiment is calculated on a scale from 0 to 100, with 50 being the neutral point. Sectors above 50 are bullish, while sectors below 50 are bearish.
Bullish/Bearish Percentage Table:
A table is displayed in the bottom right corner of the screen, showing the percentage of sectors that are currently bullish and bearish.
Bullish %: The percentage of sectors above 50 on the sentiment scale.
Bearish %: The percentage of sectors below 50 on the sentiment scale.
Market Hours Activity:
The indicator only calculates and displays data during market hours (09:30 AM to 4:00 PM EST), ensuring it stays relevant to intraday trading. Outside of market hours, the indicator remains inactive.
Best Used For:
Intraday Traders: Get real-time sector sentiment during market hours and make better trading decisions based on sector strength or weakness.
Swing Traders: Monitor sector trends to spot shifts in market sentiment over time.
Sector Rotation Strategies: Use the indicator to identify which sectors are gaining or losing strength, aiding in sector rotation strategies.
Practical Example:
If 7 out of the 11 sectors display a bullish sentiment, the table will show 63.64% as bullish and 36.36% as bearish. The heatmap will show green sectors for those above the 50 sentiment threshold, allowing you to visually spot the sectors leading the market.
Personal Nested Fractal IndicatorThis script implements a nested fractal-based indicator that identifies potential buy and sell signals by analyzing fractal patterns in price action. It calculates larger and smaller fractal highs and lows and uses these patterns to confirm entry points. When smaller fractals appear within the range of larger fractals, the script generates buy or sell signals, which are plotted on the chart as visual markers. The logic is based on detecting price turning points through fractal analysis without any further complexity or additional filters.
Daily Volume Metrics BoxDaily Volume Metrics Box
A powerful tool for monitoring intraday trading metrics in real-time. This indicator provides a clean, customizable display of key market statistics that reset daily.
🔑 Key Features:
- Daily Volume Distribution - Track positive and negative volume separately
- Net Volume Analysis - Monitor the balance of buying vs selling volume
- Average Candle Size - Dynamic calculation of recent price movement magnitude
- Flexible Positioning - Place the metrics box in any corner of your chart
- Auto-Reset - All metrics automatically reset at the start of each trading day
- Current Date Display - Always know which day's data you're viewing
📊 Metrics Explained:
1. Avg Size: Average candle size over your specified lookback period
2. Pos Vol: Accumulated volume from up-moves during the current day
3. Neg Vol: Accumulated volume from down-moves during the current day
4. Net Vol: The difference between positive and negative volume (Pos Vol - Neg Vol)
⚙️ Customization Options:
- Number of candles for average (1-∞)
- Background color and transparency
- Text color
- Box position (Top/Bottom, Left/Right)
- Distance from chart edge (1-5 bars)
📌 Usage Tips:
- Use larger lookback periods for more stable average candle size
- Position the box where it won't interfere with your chart analysis
- Monitor net volume for potential trend strength confirmation
- Compare positive and negative volume for insight into price momentum
🔄 Daily Reset:
All volume metrics reset at the start of each trading day, ensuring you're always looking at current day data only.
Perfect for day traders, swing traders, and anyone who wants to monitor intraday market dynamics with clean, organized metrics.
Note: This indicator works best on intraday timeframes where volume data is available.