SOPR with Z-Score Table📊 Glassnode SOPR with Dynamic Z-Score Table
ℹ️ Powered by Glassnode On-Chain Metrics
📈 Description:
This indicator visualizes the Spent Output Profit Ratio (SOPR) for major cryptocurrencies — Bitcoin, Ethereum, and Litecoin — along with a dynamically normalized Z-Score. SOPR is a key on-chain metric that reflects whether coins moved on-chain are being sold at a profit or a loss.
🔍 SOPR is calculated using Glassnode’s entity-adjusted SOPR feed, and a custom SMA is applied to smooth the signal. The normalized Z-Score helps identify market sentiment extremes by scaling SOPR relative to its historical context.
📊 Features:
Selectable cryptocurrency: Bitcoin, Ethereum, or Litecoin
SOPR smoothed by user-defined SMA (default: 10 periods)
Upper & lower bounds (±4%) for SOPR, shown as red/green lines
Background highlighting when SOPR moves outside normal range
Normalized Z-Score scaled between –2 and +2
Live Z-Score display in a compact top-right table
🧮 Calculations:
SOPR data is sourced daily from Glassnode:
Bitcoin: XTVCBTC_SOPR
Ethereum: XTVCETH_SOPR
Litecoin: XTVCLTC_SOPR
Z-Score is calculated as:
SMA of SOPR over zscore_length periods
Standard deviation of SOPR
Z-Score = (SOPR – mean) / standard deviation
Z-Score is clamped between –2 and +2 for visual consistency
🎯 Interpretation:
SOPR > 1 implies coins are sold in profit
SOPR < 1 suggests coins are sold at a loss
When SOPR is significantly above or below its recent range (e.g., +4% or –4%), it may signal overheating or capitulation
The Z-Score contextualizes how extreme the current SOPR is relative to history
📌 Notes:
Best viewed on daily charts
Works across selected assets (BTC, ETH, LTC)
Statistics
Correlation Drift📈 Correlation Drift
The Correlation Drift indicator is designed to detect shifts in market momentum by analyzing the relationship between correlation and price lag. It combines the principles of correlation analysis and lag factor measurement to provide a unique perspective on trend alignment and momentum shifts.
🔍 Core Concept:
The indicator calculates the Correlation vs PLF Ratio, which measures the alignment between an asset’s price movement and a chosen benchmark (e.g., BTCUSD). This ratio reflects how well the asset’s momentum matches the market trend while accounting for price lag.
📊 How It Works:
Correlation Calculation:
The script calculates the correlation between the asset and the selected benchmark over a specified period.
A higher correlation indicates that the asset’s price movements are in sync with the benchmark.
Price Lag Factor (PLF) Calculation:
The PLF measures the difference between long-term and short-term price momentum, dynamically scaled by recent volatility.
It highlights potential overextensions or lags in the asset’s price movements.
Combining Correlation and PLF:
The Correlation vs PLF Ratio combines these metrics to detect momentum shifts relative to the trend.
The result is a dynamic, smoothed histogram that visualizes whether the asset is leading or lagging behind the trend.
💡 How to Interpret:
Positive Values (Green/Aqua Bars):
Indicates bullish alignment with the trend.
Aqua: Rising bullish momentum, suggesting continuation.
Teal: Decreasing bullish momentum, signaling caution.
Negative Values (Purple/Fuchsia Bars):
Indicates bearish divergence from the trend.
Fuchsia: Falling bearish momentum, indicating increasing pressure.
Purple: Rising bearish momentum, suggesting potential reversal.
Clipping for Readability:
Values are clipped between -3 and +3 to prevent outliers from compressing the histogram.
This ensures clear visualization of typical momentum shifts while still marking extreme cases.
🚀 Best Practices:
Use Correlation Drift as a confirmation tool in conjunction with trend indicators (e.g., moving averages) to identify momentum alignment or divergence.
Look for transitions from positive to negative (or vice versa) as signals of potential trend shifts.
Combine with volume analysis to strengthen confidence in breakout or breakdown signals.
⚠️ Key Features:
Customizable Settings: Adjust the correlation length, PLF length, and smoothing factor to fine-tune the indicator for different market conditions.
Visual Gradient: The histogram changes color based on the strength and direction of the ratio, making it easy to identify shifts at a glance.
Zero Line Reference: Clearly distinguishes between bullish and bearish momentum zones.
🔧 Recommended Settings:
Correlation Length: 14 (for short to medium-term analysis)
PLF Length: 50 (to smooth out noise while capturing trend shifts)
Smoothing Factor: 3 (for enhanced clarity without excessive lag)
Benchmark Symbol: BTCUSD (or another relevant market indicator)
By providing a quantitative measure of trend alignment while accounting for price lag, the Correlation Drift indicator helps traders make more informed decisions during periods of momentum change. Whether you are trading crypto, forex, or equities, this tool can be a powerful addition to your momentum-based trading strategies.
⚠️ Disclaimer:
The Correlation Drift indicator is a technical analysis tool designed to aid in identifying potential shifts in market momentum and trend alignment. It is intended for informational and educational purposes only and should not be considered as financial advice or a recommendation to buy, sell, or hold any financial instrument.
Trading financial instruments, including cryptocurrencies, involves significant risk and may result in the loss of your capital. Past performance is not indicative of future results. Always conduct thorough research and seek advice from a certified financial professional before making any trading decisions.
The developer (RWCS_LTD) is not responsible for any trading losses or adverse outcomes resulting from the use of this indicator. Users are encouraged to test and validate the indicator in a simulated environment before applying it to live trading. Use at your own risk.
Intraday Risk Metrics (Live Range)Intraday Position Size & ATR Ratio
This indicator calculates two key intraday metrics to support real-time trading decisions:
Position Size
Calculated as: Risk / (High of the Day − Low of the Day)
The result is rounded to the nearest 5 shares.
The Risk parameter can be set manually in the settings panel.
ATR Ratio
Calculated as: (ATR from Previous Day) / (High of the Day − Low of the Day)
Helps assess current volatility relative to average historical movement.
Granger Causality Flow IndicatorGranger Causality Flow Indicator (GC Flow)
█ OVERVIEW
The Granger Causality Flow Indicator (GC Flow) attempts to quantify the potential predictive relationship between two user-selected financial instruments (Symbol X and Symbol Y). In essence, it explores whether the past values of one series (e.g., Symbol X) can help explain the current value of another series (e.g., Symbol Y) better than Y's own past values alone.
This indicator provides a "Granger Causality Score" (GC Score) for both directions (X → Y and Y → X). A higher score suggests a stronger statistical linkage where one series may lead or influence the other. The indicator visualizes this "flow" of potential influence through background colors and on-chart text.
Important Note: "Granger Causality" does not imply true economic or fundamental causation. It is a statistical concept indicating predictive power or information flow. This implementation also involves simplifications (notably, using AR(1) models) due to the complexities of full Vector Autoregression (VAR) models in Pine Script®.
█ HOW IT WORKS
The indicator's methodology is based on comparing the performance of Autoregressive (AR) models:
1. Data Preprocessing:
Fetches historical close prices for two user-defined symbols (X and Y).
Optionally applies first-order differencing (`price - price `) to the series. Differencing is a common technique to achieve a proxy for stationarity, which is an underlying assumption for Granger Causality tests. Non-stationary series can lead to spurious correlations.
2. Autoregressive (AR) Models (Simplified to AR(1)):
Due to Pine Script's current limitations for complex multivariate time series models, this indicator uses simplified AR(1) models (where the current value is predicted by its immediately preceding value).
Restricted Model (for Y → Y): Predicts the target series (e.g., Y) using only its own past value (Y ).
`Y = c_R + a_R * Y + residuals_R`
The variance of `residuals_R` (Var_R) is calculated.
Unrestricted Model (Proxy for X → Y): To test if X Granger-causes Y, the indicator examines if the past values of X (X ) can explain the residuals from the restricted model of Y.
`residuals_R = c_UR' + b_UR * X + residuals_UR`
The variance of these final `residuals_UR` (Var_UR) is calculated.
The same process is repeated to test if Y Granger-causes X.
3. Granger Causality (GC) Score Calculation:
The GC Score quantifies the improvement in prediction from adding the other series' past values. It's calculated as:
`GC Score = 1 - (Var_UR / Var_R)`
A score closer to 1 suggests that the "causing" series significantly reduces the unexplained variance of the "target" series (i.e., Var_UR is much smaller than Var_R), indicating stronger Granger causality.
A score near 0 (or capped at 0 if Var_UR >= Var_R) suggests little to no improvement in prediction.
The score is calculated over a rolling `Calculation Window`.
Pine Script® Snippet (Conceptual GC Score Logic):
// Conceptual representation of GC Score calculation
// var_R: Variance of residuals when Y is predicted by Y
// var_UR: Variance of residuals when Y's AR(1) residuals are predicted by X
score = 0.0
if var_R > 1e-9 // Avoid division by zero
score := 1.0 - (var_UR / var_R)
score := score < 0 ? 0 : score // Ensure score is not negative
4. Determining Causal Flow:
The calculated GC Scores for X → Y and Y → X are compared against a user-defined `Significance Threshold for GC Score`.
If GC_X→Y > threshold AND GC_Y→X > threshold: Bidirectional flow.
If GC_X→Y > threshold only: X → Y flow.
If GC_Y→X > threshold only: Y → X flow.
Otherwise: No significant flow.
█ HOW TO USE IT
Interpreting the Visuals:
Background Color:
Green: Indicates X → Y (Symbol 1 potentially leads Symbol 2).
Orange: Indicates Y → X (Symbol 2 potentially leads Symbol 1).
Blue: Indicates Bidirectional influence.
Gray: No significant Granger causality detected based on the threshold.
Data Window Plots: The actual GC Scores for X → Y (blue) and Y → X (red) are plotted and visible in TradingView's Data Window. A dashed gray line shows your `Significance Threshold`.
On-Chart Table (Last Bar): Displays the currently detected causal direction text (e.g., "BTCUSDT → QQQ").
Potential Applications:
Intermarket Analysis: Explore potential lead-lag relationships between different asset classes (e.g., commodities and equities, bonds and currencies).
Pair Trading Components: Identify if one component of a potential pair tends to lead the other.
Confirmation Tool: Use alongside other analyses to see if a move in one asset might foreshadow a move in another.
Considerations:
Symbol Choice: Select symbols that have a plausible economic or market relationship.
Stationarity: Granger Causality tests ideally require stationary time series. The `Use Differencing` option is a simple proxy. True stationarity testing is complex. Non-stationary data can yield misleading results.
Lag Order (p): This indicator is fixed at p=1 due to Pine Script® limitations. In rigorous analysis, selecting the optimal lag order is crucial.
Calculation Window: Shorter windows are more responsive but may be noisier. Longer windows provide smoother scores but lag more.
Significance Threshold: Adjust this based on your desired sensitivity for detecting causal links. There's no universally "correct" threshold; it depends on the context and noise level of the series.
█ INPUTS
Symbol 1 (X): The first symbol in the analysis.
Symbol 2 (Y): The second symbol (considered the target when testing X → Y).
Use Differencing: If true, applies first-order differencing to both series as a proxy for stationarity.
Calculation Window (N): Lookback period for AR model coefficient estimation and variance calculations.
Lag Order (p): Currently fixed at 1. This defines the lag used (e.g., X , Y ) in the AR models.
Significance Threshold for GC Score: A value between 0.01 and 0.99. The calculated GC Score must exceed this to be considered significant.
█ VISUALIZATION
Background Color: Dynamically changes based on the detected Granger causal flow (Green for X → Y, Orange for Y → X, Blue for Bidirectional, Gray for None).
GC Scores (Data Window):
Blue Plot: GC Score for X → Y.
Red Plot: GC Score for Y → X.
Significance Threshold Line: A dashed gray horizontal line plotted at the level of your input threshold.
On-Chart Table: Displayed on the top-right (on the last bar), showing the current causal direction text.
█ ALERTS
The indicator can generate alerts for:
Emergence of X → Y causality.
Emergence of Y → X causality.
General change or cessation of a previously detected causal relationship.
█ IMPORTANT DISCLAIMERS & LIMITATIONS
Correlation vs. Causation: Granger causality measures predictive power, not true underlying economic causation. A strong GC Score doesn't prove one asset *causes* another to move, only that its past values improve predictions.
Stationarity Assumption: While differencing is offered, it's a simplified approach. Non-stationary data can lead to spurious (false) Granger causality detection.
Model Simplification (AR(1)): This script uses AR(1) models for simplicity. Real-world relationships can involve more complex dynamics and higher lag orders. The fixed lag of p=1 is a significant constraint.
Sensitivity to Parameters: Results can be sensitive to the chosen symbols, calculation window, differencing option, and significance threshold.
No Statistical Significance Testing (p-values): This indicator uses a direct threshold on the GC Score itself, not a formal statistical test (like an F-test producing p-values) typically found in econometric software.
Use this indicator as an exploratory tool within a broader analytical framework. Do not rely on it as a standalone basis for trading decisions.
█ CREDITS & LICENSE
Author: mastertop ( Twitter: x.com )
Version: 1.0 (Released: 2025-05-08)
This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
© mastertop, 2025
BPCO Z-ScoreBPCO Z-Score with Scaled Z-Value and Table
Description:
This custom indicator calculates the Z-Score of a specified financial instrument (using the closing price as a placeholder for the BPCO value), scales the Z-Score between -2 and +2 based on user-defined thresholds, and displays it in a table for easy reference.
The indicator uses a simple moving average (SMA) and standard deviation to calculate the original Z-Score, and then scales the Z-Score within a specified range (from -2 to +2) based on the upper and lower thresholds set by the user.
Additionally, the scaled Z-Score is displayed in a separate table on the right side of the chart, providing a clear, numerical value for users to track and interpret.
Key Features:
BPCO Z-Score: Calculates the Z-Score using a simple moving average and standard deviation over a user-defined window (default: 365 days). This provides a measure of how far the current price is from its historical average in terms of standard deviations.
Scaled Z-Score: The original Z-Score is then scaled between -2 and +2, based on the user-specified upper and lower thresholds. The thresholds default to 3.5 (upper) and -1.5 (lower), and can be adjusted as needed.
Threshold Bands: Horizontal lines are plotted on the chart to represent the upper and lower thresholds. These help visualize when the Z-Score crosses critical levels, indicating potential market overbought or oversold conditions.
Dynamic Table Display: The scaled Z-Score is shown in a dynamic table at the top-right of the chart, providing a convenient reference for traders. The table updates automatically as the Z-Score fluctuates.
How to Use:
Adjust Time Window: The "Z-Score Period (Days)" input allows you to adjust the time period used for calculating the moving average and standard deviation. By default, this is set to 365 days (1 year), but you can adjust this depending on your analysis needs.
Set Upper and Lower Thresholds: Use the "BPCO Upper Threshold" and "BPCO Lower Threshold" inputs to define the bands for your Z-Score. The default values are 3.5 for the upper band and -1.5 for the lower band, but you can adjust them based on your strategy.
Interpret the Z-Score: The Z-Score provides a standardized measure of how far the current price (or BPCO value) is from its historical mean, relative to the volatility. A value above the upper threshold (e.g., 3.5) may indicate overbought conditions, while a value below the lower threshold (e.g., -1.5) may indicate oversold conditions.
Use the Scaled Z-Score: The scaled Z-Score is calculated based on the original Z-Score, but it is constrained to a range between -2 and +2. When the BPCO value hits the upper threshold (3.5), the scaled Z-Score will be +2, and when it hits the lower threshold (-1.5), the scaled Z-Score will be -2. This gives you a clear, easy-to-read value to interpret the market's condition.
Data Sources:
BPCO Data: In this indicator, the BPCO value is represented by the closing price of the asset. The calculation of the Z-Score and scaled Z-Score is based on this price data, but you can modify it to incorporate other data streams as needed (e.g., specific economic indicators or custom metrics).
Indicator Calculation: The Z-Score is calculated using the following formulas:
Mean (SMA): A simple moving average of the BPCO (close price) over the selected period (365 days by default).
Standard Deviation (Std): The standard deviation of the BPCO (close price) over the same period.
Z-Score: (Current BPCO - Mean) / Standard Deviation
Scaled Z-Score: The Z-Score is normalized to fall within a specified range (from -2 to +2), based on the upper and lower threshold inputs.
Important Notes:
Customization: The indicator allows users to adjust the period (window) for calculating the Z-Score, as well as the upper and lower thresholds to suit different timeframes and trading strategies.
Visual Aids: Horizontal lines are drawn to represent the upper and lower threshold levels, making it easy to visualize when the Z-Score crosses critical levels.
Limitations: This indicator relies on historical price data (or BPCO) and assumes that the standard deviation and mean are representative of future price behavior. It does not account for potential market shifts or extreme events that may fall outside historical norms.
MVRVZ BTCMVRVZ BTC (Market Value to Realized Value Z-Score)
Description:
The MVRVZ BTC indicator provides insights into the relationship between the market value and realized value of Bitcoin, using the Market Value to Realized Value (MVRV) ratio, which is then adjusted using a Z-Score. This indicator highlights potential market extremes and helps in identifying overbought or oversold conditions, offering a unique perspective on Bitcoin's valuation.
How It Works:
MVRVZ is calculated by taking the difference between Bitcoin's Market Capitalization (MC) and Realized Capitalization (MCR), then dividing that by the Standard Deviation (Stdev) of the price over a specified period (usually 104 weeks).
The resulting value is plotted as the MVRVZ line, representing how far the market price deviates from its realized value.
Z-Score is then applied to the MVRVZ line, with the Z-Score bounded between +2 and -2, which allows it to be used within a consistent evaluation framework, regardless of how high or low the MVRVZ line goes. The Z-Score will reflect overbought or oversold conditions:
A Z-Score above +2 indicates the market is likely overbought (possible market top).
A Z-Score below -2 indicates the market is likely oversold (possible market bottom).
Values between -2 and +2 indicate more neutral market conditions.
How to Read the Indicator:
MVRVZ Line:
The MVRVZ line shows the relationship between market cap and realized cap. A higher value indicates the market is overvalued relative to the actual capital realized by holders.
The MVRVZ line can move above or below the top and bottom lines you define, which are adjustable according to your preferences. These lines act as trigger levels.
Top and Bottom Trigger Lines:
You can customize the Top Line and Bottom Line values to your preference.
When the MVRVZ line crosses the Top Line, the market might be considered overbought.
When the MVRVZ line crosses the Bottom Line, the market might be considered oversold.
SCDA Z-Score:
The Z-Score is displayed alongside the MVRVZ line and is bounded between -2 and +2. It scales proportionally based on the MVRVZ line's position relative to the top and bottom trigger lines.
The Z-Score ensures that even if the MVRVZ line moves beyond the trigger lines, the Z-Score will stay within the limits of -2 to +2, making it ideal for your custom evaluation system (SCDA).
Background Highlighting:
The background color changes when the MVRVZ line crosses key levels:
When the MVRVZ line exceeds the Top Trigger, the background turns red, indicating overbought conditions.
When the MVRVZ line falls below the Bottom Trigger, the background turns green, indicating oversold conditions.
Data Sources:
The data for the MVRVZ indicator is sourced from Glassnode and Coinmetrics, which provide the necessary values for:
BTC Market Cap (MC) – The total market capitalization of Bitcoin.
BTC Realized Market Cap (MCR) – The capitalization based on the price at which Bitcoin was last moved on the blockchain (realized value).
How to Use the Indicator:
Market Extremes:
Use the MVRVZ and Z-Score to spot potential market tops or bottoms.
A high Z-Score (above +2) suggests the market is overbought, while a low Z-Score (below -2) suggests the market is oversold.
Adjusting the Triggers:
Customize the Top and Bottom Trigger Lines to suit your trading strategy. These lines can act as dynamic reference points for when to take action based on the Z-Score or MVRVZ line crossing these levels.
Market Evaluation (SCDA Framework):
The bounded Z-Score (from -2 to +2) is tailored for your SCDA evaluation system, allowing you to assess market conditions based on consistent criteria, no matter how volatile the MVRVZ line becomes.
Conclusion:
The MVRVZ BTC indicator is a powerful tool for assessing the relative valuation of Bitcoin based on its market and realized capitalization. By combining it with the Z-Score, you get an easy-to-read, bounded evaluation system that highlights potential market extremes and helps you make informed decisions about Bitcoin's price behavior.
Adaptive Hurst Exponent Regime FilterAdaptive Hurst Exponent Regime Filter (AHERF)
█ OVERVIEW
The Adaptive Hurst Exponent Regime Filter (AHERF) is designed to identify the prevailing market regime—be it Trending, Mean-Reverting, or a Random Walk/Transition phase. While the Hurst Exponent is a well-known tool for this purpose, AHERF introduces a key innovation: an adaptive threshold . Instead of relying solely on the traditional fixed 0.5 Hurst value, this indicator's threshold dynamically adjusts based on current market volatility, aiming to provide more nuanced and responsive regime classifications.
This tool can assist traders in:
Gauging the current character of the market.
Tailoring trading strategies to the identified regime (e.g., deploying trend-following systems in Trending markets or mean-reversion tactics in Mean-Reverting conditions).
Filtering out trades that may be counterproductive to the dominant market behavior.
█ HOW IT WORKS
The indicator operates through the following key calculations:
1. Hurst Exponent Calculation:
The script computes an approximate Hurst Exponent (H). It utilizes log price changes as its input series.
The `calculateHurst` function implements a variance scaling approach:
It defines three sub-periods based on the main `Hurst Lookback Period`.
It calculates the standard deviation of the input series over these sub-periods.
The Hurst Exponent is then estimated from the slope of a log-log regression between the standard deviations and their respective sub-period lengths. A simplified calculation using the first and last sub-periods is performed: `H = (log(StdDev3) - log(StdDev1)) / (log(N3) - log(N1))`.
Theoretically, a Hurst Exponent:
H > 0.5 suggests persistence (trending behavior).
H < 0.5 suggests anti-persistence (mean-reverting behavior).
H ≈ 0.5 suggests a random walk (unpredictable movement).
Pine Script® Snippet (Hurst Calculation Call):
float logPriceChange = math.log(close) - math.log(close );
// ... ensure logPriceChange is not na on first bar ...
float hurstValue = calculateHurst(logPriceChange, hurstLookbackInput);
2. Volatility Proxy Calculation:
To enable the adaptive nature of the threshold, a volatility proxy is calculated.
Users can select the `Volatility Metric` to be either:
Average True Range (ATR), normalized by the closing price.
Standard Deviation (StdDev) of simple price returns.
This proxy quantifies the current degree of price activity or fluctuation in the market.
Pine Script® Snippet (Volatility Proxy Call):
float volatilityProxy = getVolatilityProxy(volatilityMetricInput, volatilityLookbackInput);
3. Adaptive Threshold Calculation:
This is the core of AHERF's adaptability. Instead of a static 0.5 line as the sole determinant, the script computes a dynamic threshold.
The adaptive threshold is calculated as: `0.5 + (Threshold Sensitivity * Volatility Proxy)`.
This means the threshold starts at the baseline 0.5 level and then adjusts upwards or downwards based on the current `volatilityProxy` scaled by the `Threshold Sensitivity (k)` input.
Pine Script® Snippet (Adaptive Threshold Calculation):
float adaptiveThreshold = 0.5 + sensitivityInput * nz(volatilityProxy, 0.0);
4. Regime Identification:
The prevailing market regime is determined by comparing the `hurstValue` to this `adaptiveThreshold`, incorporating a `Threshold Buffer` to reduce noise and clearly delineate zones:
Trending: `hurstValue > adaptiveThreshold + bufferInput`
Mean-Reverting: `hurstValue < adaptiveThreshold - bufferInput`
Random/Transition: Otherwise (Hurst value is within the buffer zone around the adaptive threshold).
Pine Script® Snippet (Regime Determination Logic):
if not na(hurstValue) and not na(adaptiveThreshold)
if hurstValue > adaptiveThreshold + bufferInput
currentRegimeColor := TRENDING_COLOR
regimeText := "Trending"
else if hurstValue < adaptiveThreshold - bufferInput
currentRegimeColor := MEAN_REVERTING_COLOR
regimeText := "Mean-Reverting"
// else remains Random/Transition
█ HOW TO USE IT
Interpreting the Visuals:
Observe the plotted `Hurst Exponent (H)` line (White) relative to the `Adaptive Threshold` line (Orange).
The background color provides an immediate indication of the current regime: Green for Trending, Red for Mean-Reverting, and Gray for Random/Transition.
The fixed `0.5 Level` (Dashed Gray) is plotted for reference against traditional Hurst interpretation.
Labels "T", "M", and "R" appear below bars to signal new entries into Trending, Mean-Reverting, or Random/Transition regimes, respectively.
Inputs Customization:
Hurst Exponent Calculation
Hurst Lookback Period: Defines the number of bars used for the Hurst Exponent calculation. Longer periods generally yield smoother Hurst values, reflecting longer-term market memory. Shorter periods are more responsive.
Adaptive Threshold Settings
Volatility Metric: Choose "ATR" or "StdDev" to drive the adaptive threshold. Experiment to see which best suits the asset.
Volatility Lookback: The lookback period for the selected volatility metric.
Threshold Sensitivity (k): A crucial multiplier determining how strongly volatility influences the adaptive threshold. Higher values mean volatility has a greater impact, potentially widening or shifting the regime bands more significantly.
Threshold Buffer: Creates a neutral zone around the adaptive threshold. This helps prevent overly frequent regime shifts due_to minor Hurst fluctuations.
█ ORIGINALITY AND USEFULNESS
The AHERF indicator distinguishes itself by:
Implementing an adaptive threshold mechanism for Hurst Exponent analysis. This threshold dynamically responds to changes in market volatility, offering a more flexible approach than a fixed 0.5 reference, potentially leading to more contextually relevant regime detection.
Providing clear, at-a-glance visualization of market regimes through background coloring and distinct plot shapes.
Offering user-configurable parameters for both the Hurst calculation and the adaptive threshold components, allowing for tuning across various assets and timeframes.
Traders can leverage AHERF to better align their chosen strategies with the prevailing market character, potentially enhancing trade filtering and decision-making processes.
█ VISUALIZATION
The indicator plots the following in a separate pane:
Hurst Exponent (H): A white line representing the calculated Hurst value.
Adaptive Threshold: An orange line representing the dynamic threshold.
Fixed 0.5 Level: A dashed gray horizontal line for traditional Hurst reference.
Background Color: Changes based on the identified regime:
Green: Trending regime.
Red: Mean-Reverting regime.
Gray: Random/Transition regime.
Regime Entry Shapes: Plotted below the price bars (forced overlay for visibility):
"T" (Green Label): Signals entry into a Trending regime.
"M" (Teal Label): Signals entry into a Mean-Reverting regime.
"R" (Cyan Label): Signals entry into a Random/Transition regime.
█ ALERTS
The script provides alert conditions for changes in the market regime:
Regime Shift to Trending: Triggers when the Hurst Exponent crosses above the adaptive threshold into a Trending state.
Regime Shift to Mean-Reverting: Triggers when the Hurst Exponent crosses below the adaptive threshold into a Mean-Reverting state.
Regime Shift to Random/Transition: Triggers when the Hurst Exponent enters the Random/Transition zone around the adaptive threshold.
These can be configured directly from the TradingView alerts panel.
█ NOTES & DISCLAIMERS
The Hurst Exponent calculation is an approximation; various methods exist, each with its nuances.
The performance and relevance of the identified regimes can differ across financial instruments and timeframes. Parameter tuning is recommended.
This indicator is intended as a decision-support tool and should not be the sole basis for trading decisions. Always integrate its signals within a broader analytical framework.
Past performance of any trading system or indicator, including those derived from AHERF, is not indicative of future results.
█ CREDITS & LICENSE
Author: mastertop ( Twitter: x.com )
Color Palette: Uses the `MaterialPalette` library by MASTERTOP_ASTRAY.
This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
© mastertop, 2025
Future Events TableTo show any type of Future Events Table.
Example shows "astronomical cycle reversal dates" in 2025
*no change, just on a clean chart
Hurst Exponent Oscillator [PhenLabs]📊 Hurst Exponent Oscillator -
Version: PineScript™ v5
📌 Description
The Hurst Exponent Oscillator (HEO) by PhenLabs is a powerful tool developed for traders who want to distinguish between trending, mean-reverting, and random market behaviors with clarity and precision. By estimating the Hurst Exponent—a statistical measure of long-term memory in financial time series—this indicator helps users make sense of underlying market dynamics that are often not visible through traditional moving averages or oscillators.
Traders can quickly know if the market is likely to continue its current direction (trending), revert to the mean, or behave randomly, allowing for more strategic timing of entries and exits. With customizable smoothing and clear visual cues, the HEO enhances decision-making in a wide range of trading environments.
🚀 Points of Innovation
Integrates advanced Hurst Exponent calculation via Rescaled Range (R/S) analysis, providing unique market character insights.
Offers real-time visual cues for trending, mean-reverting, or random price action zones.
User-controllable EMA smoothing reduces noise for clearer interpretation.
Dynamic coloring and fill for immediate visual categorization of market regime.
Configurable visual thresholds for critical Hurst levels (e.g., 0.4, 0.5, 0.6).
Fully customizable appearance settings to fit different charting preferences.
🔧 Core Components
Log Returns Calculation: Computes log returns of the selected price source to feed into the Hurst calculation, ensuring robust and scale-independent analysis.
Rescaled Range (R/S) Analysis: Assesses the dispersion and cumulative deviation over a rolling window, forming the core statistical basis for the Hurst exponent estimate.
Smoothing Engine: Applies Exponential Moving Average (EMA) smoothing to the raw Hurst value for enhanced clarity.
Dynamic Rolling Windows: Utilizes arrays to maintain efficient, real-time calculations over user-defined lengths.
Adaptive Color Logic: Assigns different highlight and fill colors based on the current Hurst value zone.
🔥 Key Features
Visually differentiates between trending, mean-reverting, and random market modes.
User-adjustable lookback and smoothing periods for tailored sensitivity.
Distinct fill and line styles for each regime to avoid ambiguity.
On-chart reference lines for strong trending and mean-reverting thresholds.
Works with any price series (close, open, HL2, etc.) for versatile application.
🎨 Visualization
Hurst Exponent Curve: Primary plotted line (smoothed if EMA is used) reflects the ongoing estimate of the Hurst exponent.
Colored Zone Filling: The area between the Hurst line and the 0.5 reference line is filled, with color and opacity dynamically indicating the current market regime.
Reference Lines: Dash/dot lines mark standard Hurst thresholds (0.4, 0.5, 0.6) to contextualize the current regime.
All visual elements can be customized for thickness, color intensity, and opacity for user preference.
📖 Usage Guidelines
Data Settings
Hurst Calculation Length
Default: 100
Range: 10-300
Description: Number of bars used in Hurst calculation; higher values mean longer-term analysis, lower values for quicker reaction.
Data Source
Default: close
Description: Select which data series to analyze (e.g., Close, Open, HL2).
Smoothing Length (EMA)
Default: 5
Range: 1-50
Description: Length for smoothing the Hurst value; higher settings yield smoother but less responsive results.
Style Settings
Trending Color (Hurst > 0.5)
Default: Blue tone
Description: Color used when trending regime is detected.
Mean-Reverting Color (Hurst < 0.5)
Default: Orange tone
Description: Color used when mean-reverting regime is detected.
Neutral/Random Color
Default: Soft blue
Description: Color when market behavior is indeterminate or shifting.
Fill Opacity
Default: 70-80
Range: 0-100
Description: Transparency of area fills—higher opacity for stronger visual effect.
Line Width
Default: 2
Range: 1-5
Description: Thickness of the main indicator curve.
✅ Best Use Cases
Identifying if a market is regime-shifting from trending to mean-reverting (or vice versa).
Filtering signals in automated or systematic trading strategies.
Spotting periods of randomness where trading signals should be deprioritized.
Enhancing mean-reversion or trend-following models with regime-awareness.
⚠️ Limitations
Not predictive: Reflects current and recent market state, not future direction.
Sensitive to input parameters—overfitting may occur if settings are changed too frequently.
Smoothing can introduce lag in regime recognition.
May not work optimally in markets with structural breaks or extreme volatility.
💡 What Makes This Unique
Employs advanced statistical market analysis (Hurst exponent) rarely found in standard toolkits.
Offers immediate regime visualization through smart dynamic coloring and zone fills.
🔬 How It Works
Rolling Log Return Calculation:
Each new price creates a log return, forming the basis for robust, non-linear analysis. This ensures all price differences are treated proportionally.
Rescaled Range Analysis:
A rolling window maintains cumulative deviations and computes the statistical “range” (max-min of deviations). This is compared against the standard deviation to estimate “memory”.
Exponent Calculation & Smoothing:
The raw Hurst value is translated from the log of the rescaled range ratio, and then optionally smoothed via EMA to dampen noise and false signals.
Regime Detection Logic:
The smoothed value is checked against 0.5. Values above = trending; below = mean-reverting; near 0.5 = random. These control plot/fill color and zone display.
💡 Note:
Use longer calculation lengths for major market character study, and shorter ones for tactical, short-term adaptation. Smoothing balances noise vs. lag—find a best fit for your trading style. Always combine regime awareness with broader technical/fundamental context for best results.
Float LabelTakes the TradingView key stats on available float for a stock making it a clear indicator on your chart.
P1 & P2 Helper by Brighter DataThis script draws the current high & low on the chart for multiple timeframes in P1/P2 format: P1 is either the highest or lowest point of the timeframe, whichever came first. P2 is whichever came second.
For example, on the daily timeframe if the daily low is marked out as P1 and the daily high is P2, it means that the daily low was put in before the daily high. This mapping of highs/lows is used as support for the BD dashboard and its statistics.
Relative Strength Index BUY SELL"This script is based on Relative Strength Index (RSI) and compares them with the candlestick's close price.
– If the RSI is above the SmoothingMA, a BUY label is displayed.
– If the RSI is below the SmoothingMA, a SELL label is displayed."
For : XAU, BTC
Time frame : 5 min
ATS DELTABAR V5.0This indicator is called DeltaBar, which reflects the actual momentum of buyers and sellers while filtering out market noise. It helps you identify the true starting and ending points of trends.
By analyzing the Delta Net Volume chart, you can anticipate shifts in market sentiment and gain a strategic edge. For instance:
Resonance Breakouts – When price and DeltaBar break key levels simultaneously
Divergences – Visible and hidden bullish/bearish divergences signaling potential reversals
DeltaBar provides scientific, high-precision trading signals, turning raw data into actionable intelligence for smarter decisions.
这个指标叫deltabar,反映了买卖双方的实际力量的走势图,过滤了市场噪音,帮助您识别真正的趋势起点与终点。
通过观察Delta净量走势图,您可以提前感知市场情绪的变化,抢占先机,比如价格和deltabar形成共振突破,形成了顶底背离和隐性的顶底背离。
Delta净量走势图都能为您提供更科学、更精准的交易策略。
ATS Net Volume V5.0This is a fully quantitative auxiliary chart indicator. Values above the zero line represent net inflow status and the magnitude of net inflow, while values below the zero line indicate net outflow status and the magnitude of net outflow. Changes in net volume often signal trend reversals and emerging opportunities. This fully quantitative indicator serves as a powerful tool to help you identify these critical signals. By precisely visualizing the dynamic changes in net volume, it provides clear insight into the battle between bullish and bearish forces.
这是基于全量化的副图指标,零轴以上代表净流入状态和净流入的数值,零轴以下代表净流出状态和净流出的数值。净量的变化往往预示着趋势的转折与机遇的来临。这个全量化的指标正是帮助您捕捉这些关键信号的有力工具。通过精准呈现净量的动态变化,它让您清晰看到多空力量的博弈
Arnaud Legoux Moving Average BUY SELL"This script is based on Arnaud Legoux Moving Average (ALMA) and compares them with the candlestick's close price.
– If the closing price is above the upper ALMA band, a BUY label is displayed.
– If the closing price is below the lower ALMA band, a SELL label is displayed."
For : XAU, BTC
Time frame : 5 min
Capital Flow StrengthCapital Flow Strength Indicator Guide
This is a comprehensive technical indicator that measures capital flow into or out of an asset, combined with volume analysis. Here's how to use it effectively:
Basic Understanding
The indicator shows capital flow strength on a scale from -100 to +100
Positive values (green) indicate money flowing into the asset
Negative values (red) indicate money flowing out
The blue/gray volume bars show relative volume compared to recent average
Key Components
Capital Flow Line
Green line above zero: Buying pressure dominates
Red line below zero: Selling pressure dominates
Crossing zero: Potential shift in market sentiment
Reference Lines
0 line: Neutral balance between buyers and sellers
+50 line: Strong buying pressure
-50 line: Strong selling pressure
Volume Strength Bars
Blue bars: Volume exceeding threshold (currently 1.5x average)
Gray bars: Normal volume levels
Taller bars: Higher relative volume
Trading Applications
Entry Signals
Strong buying setup: Capital flow above +50 with blue volume bars
Strong selling setup: Capital flow below -50 with blue volume bars
Confirmation Tool
Use with price action and other indicators for confirmation
Strong readings are more reliable when volume is higher than average
Divergence Analysis
Bullish divergence: Price making lower lows but capital flow making higher lows
Bearish divergence: Price making higher highs but capital flow making lower highs
Customization Options
Length (14): Adjust the calculation period
Volume Threshold (1.5): Modify sensitivity to volume spikes
Alert Conditions
The indicator has two built-in alerts:
"Strong Capital Inflow" - triggers when flow > 50 with high volume
"Strong Capital Outflow" - triggers when flow < -50 with high volume
These alerts can help you identify significant buying or selling pressure as it emerges.
Bandas Dólar [TNI]Indicator Summary:
*Default divergence bands projection starting 04/14/2025 at 1% monthly rate.*
Projects upper band, lower band, and channel midpoint
Platform alerts can be set for any band crossover
Legal Disclaimer:
This indicator serves as a technical reference tool only. It does not replace the official publication in Argentina's Official Gazette. The developers assume no responsibility for operational decisions made based on this implementation.
Alternative enhanced version (more formal/professional):
Technical Overview
*Automated projection of divergence bands (1% monthly) effective 04/14/2025*
Real-time calculation of:
• Upper intervention boundary
• Lower intervention threshold
• Official channel midpoint
Native TradingView alert integration for all band crossings
Regulatory Disclaimer
This analytical tool provides unofficial modeling of published economic parameters. While mathematically accurate, users must verify all outputs against current official publications in the Boletín Oficial de la República Argentina. No liability is assumed for trading or policy decisions derived from this technical implementation.
---
Proyecta las bandas divergentes por defecto a partir del 14/04/2025 al 1% mensual.
Se proyectan las bandas superior, inferior y el centro del canal.
Se pueden establecer alertas de la plataforma ante el cruce de cualquiera de las bandas.
Aviso Legal:
Este indicador constituye una herramienta informativa de referencia técnica. No sustituye la publicación oficial en el Boletín Oficial de la República Argentina. Los desarrolladores no se responsabilizan por decisiones operativas basadas en esta implementación.
Session Stats + (dc_77)The "Session Stats + (dc_77)" indicator is a Pine Script tool designed to analyze trading sessions by plotting key price levels and statistical metrics. It displays a session's open price, manipulation levels (mean and median price movements), and distribution levels based on historical session data, with customizable time zones and session times. Users can toggle projections for 1-hour, 4-hour, daily, weekly, and monthly timeframes, showing average manipulation and distribution distances from the session open. Visual elements like shaded areas, labeled lines, and a vertical anchor line enhance readability, with options to filter data by day of the week. Alert conditions are included to notify users when the price crosses significant levels, such as the session open or manipulation/distribution thresholds.
CoinWise - OICOINWISE OPEN INTEREST
Commitment of market participants, visualize open interest positions on multiple exchanges.
🔹 What Is It? Why Does It Matter?
The CoinWise Open Interest indicator provides a live measurement of how many derivative contracts futures or options are still active and unsettled in the market.
Unlike volume, which counts how many trades occur within a session, Open Interest reveals how much positioning remains open at any given moment.
This matters because it shows the true conviction of traders:
Rising Open Interest: Signals new money entering the market growing commitment.
Falling Open Interest: Often signals unwinding closed trades, fading momentum.
Strong price move without Open Interest: could mean support might be a fakeout or an exhaustion move.
Understanding Open Interest helps you gauge whether market trends are fueled by fresh participation, fading away, or at risk of becoming overcrowded.
This indicator aggregates Open Interest data across multiple major exchanges including Bitfinex, Binance, Kraken, and BitMEX providing a broader and more reliable positioning view.
🔹 Core Components
The CoinWise Open Interest indicator visualizes live positioning pressure through two selectable plot types:
Candlestick Mode:
Plots Open, High, Low, and Close values of Open Interest per bar, showing the full range of positioning movement within a period.
Line Mode:
Simplifies the view to only track the closing Open Interest per candle ideal for traders who prefer clean trend interpretation.
Additionally, each candle can optionally display a label showing the range (High minus Low) net Open Interest amount for that bar, offering subtle insight into volatility behind the scenes.
🔹 Customization and Settings
The CoinWise Open Interest indicator offers a clean, no-clutter configuration:
Plot Type Selection:
Switch between Candlestick and Line visual styles depending on your preference for detail versus simplicity.
Color Controls:
Customize Up Color and Down Color to match your charting theme or highlight OI directionality.
Status Line Display:
Choose to show live Open Interest values in the chart’s status line for quick reference.
The design philosophy is lightweight: no manual exchange toggles, no excess options, just pure, real-time commitment tracking.
🔹 Practical Application
Use Open Interest alongside the Longs & Shorts indicator and price action to decode the hidden behavior of traders:
Rising Price + Rising OI: Fresh money entering. Bullish confirmation.
Falling Price + Rising OI: New shorts entering aggressively. Bearish momentum building.
Price Movement + Falling OI: Positions closing suggesting weakness, fakeouts, or end-of-trend behavior.
Monitoring Open Interest adds a second dimension to your price analysis letting you see commitment behind the candles rather than reacting to the surface alone.
When used correctly, it becomes a powerful filter for trend confirmation, fakeout detection, and sentiment timing across all major crypto and futures markets.
Risk Calculator Manual Only### Indicator Name: Risk Calculator Manual Only
Description:
This indicator is designed for manual risk and position size calculation. It helps traders manage risk per trade by clearly displaying key trade parameters on the chart in an easy-to-read table format. The indicator does not auto-calculate entry, stop, or target prices—all values must be entered manually, giving full control to the trader.
Key Features:
- Manual input only: Users manually enter the entry price, stop-loss, and take-profit levels.
- On-chart data table: Displays all calculated metrics in a compact, color-coded table:
- Trade Type: Long or Short, selectable in settings.
- Entry Price, Stop-Loss, Take-Profit: Entered by the user.
- Position Size ($): Automatically calculated based on your risk amount and stop-loss distance.
- Profit ($): Potential profit based on take-profit level.
- Loss ($): Potential loss based on stop-loss level.
- Color coding:
- Profit row is highlighted in green.
- Loss row is highlighted in red.
- Alerts: Optional alerts when price hits the stop-loss or take-profit levels.
How to Use:
1. Enter your planned entry price, stop-loss, and take-profit in the indicator settings.
2. Set your risk amount per trade (in USD).
3. The indicator will calculate the appropriate position size, potential profit, and loss, and display them in a visual table.
4. Enable alerts if you want to be notified when price reaches your stop-loss or take-profit.
Benefits:
- Helps enforce disciplined risk management.
- Visual feedback on key trade metrics, directly on the chart.
- Fast, manual trade planning with no automation—ideal for discretionary traders.
- Supports both long and short trade types.
Notes:
- This tool assumes accurate manual input. It does not auto-detect price levels.
- Best used by traders who prefer full control over their risk setup and calculations.
---------------------------------------------------------
Statistical Reliability Index (SRI)Statistical Reliability Index (SRI)
The Statistical Reliability Index (SRI) is a professional financial analysis tool designed to assess the statistical stability and reliability of market conditions. It combines advanced statistical methods to gauge whether current market trends are statistically consistent or prone to erratic behavior. This allows traders to make more informed decisions when navigating trending and choppy markets.
Key Concepts:
1. Extrapolation of Cumulative Distribution Functions (CDF)
What is CDF?
A Cumulative Distribution Function (CDF) is a statistical tool that models the probability of a random variable falling below a certain value.
How it’s used in SRI:
The SRI utilizes the 95th percentile CDF of recent returns to estimate the likelihood of extreme price movements. This helps identify when a market is experiencing statistically significant changes, crucial for forecasting potential breakouts or breakdowns.
Weight in SRI:
The weight of the CDF extrapolation can be adjusted to emphasize its impact on the overall reliability index, allowing customization based on the trader's preference for tail risk analysis.
2. Bias Factor (BF)
What is the Bias Factor?
The Bias Factor measures the ratio of the current market price to the expected mean price calculated over a defined period. It represents the deviation from the typical price level.
How it’s used in SRI:
A higher bias factor indicates that the current price significantly deviates from the historical average, suggesting a potential mean reversion or trend exhaustion.
Weight in SRI:
Adjusting the Bias Factor weight lets users control how much this deviation influences the SRI, balancing between momentum trading and mean reversion strategies.
3. Coefficient of Variation (CV)
What is CV?
The Coefficient of Variation (CV) is a statistical measure that expresses the ratio of the standard deviation to the mean. It indicates the relative variability of asset returns, helping gauge the risk-to-return consistency.
How it’s used in SRI:
A lower CV indicates more stable and predictable price behavior, while a higher CV signals increased volatility. The SRI incorporates the inverse of the normalized CV to reflect price stability positively.
Weight in SRI:
By adjusting the CV weight, users can prioritize consistent price movements over erratic volatility, aligning the indicator with risk tolerance and strategy preferences.
Interpreting the SRI:
1. SRI Plot:
The SRI plot dynamically changes color to reflect market conditions:
Aqua Line: Indicates uptrend stability, signaling statistically consistent upward movements.
Fuchsia Line: Indicates downtrend stability, where statistically reliable downward movements are present.
The overlay background shifts between colors:
Aqua Background: Signifies statistical stability, where trends are historically consistent.
Fuchsia Background: Indicates statistical instability, often associated with trend uncertainty.
Yellow Background: Marks choppy periods, where statistical data suggests that market conditions are not conducive to reliable trading.
2. SRI Volatility Plot:
Displays the volatility of the SRI itself to detect when the indicator is stable or unstable:
Blue Area Fill: Signifies that the SRI is stable, indicating trending conditions.
Yellow Area Fill: Represents choppy or unstable SRI movements, suggesting sideways or unreliable market conditions.
A Chop Threshold Line (dotted yellow) highlights the maximum acceptable SRI volatility before the market is considered too unpredictable.
3. Stability Assessment:
Stable Trend (No Chop):
The SRI is smooth and consistent, often accompanied by aqua or fuchsia lines.
Volatility remains below the chop threshold, indicating a low-risk, trend-following environment.
Chop Mode:
The SRI becomes erratic, and the volatility plot spikes above the threshold.
Marked by a yellow shaded background, indicating uncertain and non-trending conditions.
[Trend Identification:
Use the color-coded SRI line and background to determine uptrend or downtrend reliability.
Be cautious when the SRI volatility plot shows yellow, as this signals trading conditions may not be reliable.
Practical Use Cases:
Trend Confirmation:
Utilize the SRI plot color and background to confirm whether a detected trend is statistically reliable.
Chop Mode Filtering:
During yellow chop periods, it is advisable to reduce trading activity or adopt range-bound strategies.
Strategy Filter:
Combine the SRI with trend-following indicators (like moving averages) to enhance entry and exit accuracy.
Volatility Monitoring:
Pay attention to the SRI volatility plot, as spikes often precede erratic price movements or trend reversals.
Disclaimer:
The Statistical Reliability Index (SRI) is a technical analysis tool designed to aid in market stability assessment and trend validation. It is not intended as a standalone trading signal generator. While the SRI can help identify statistically reliable trends, it is essential to incorporate additional technical and fundamental analysis to make well-informed trading decisions.
Trading and investing involve substantial risk, and past performance does not guarantee future results. Always use risk management practices and consult with a financial advisor to tailor strategies to your individual risk profile and objectives.
Multi-TF BOS/CHoCH Detectori am abhijit i am devloping this structure maping indicator with alert .
on dated may 12-5-2025. disclaimer-it is only for educational purpose and not giving surety of success use it by your own risk