Recency-Weighted Market Memory w/ Quantile-Based Drift This indicator combines market memory, recency-weighted drift, quantile-based volatility analysis, momentum (RoC) filtering, and historical correlation checks to generate dynamic forecasts of possible future price levels. It calculates bullish and bearish forecast lines at each horizon, reflecting how the price might behave based on historical similarities.
Trading Concepts & Mathematical Foundations Explained 1) Market Memory Concept: Markets tend to repeat past behaviors under similar conditions. By identifying historical market states that closely match current conditions, we predict future price movements based on what happened historically.
Calculation Steps:
We select a historical lookback window (for example, 210 bars). Each historical bar within this window is evaluated to see if its conditions match the current market. Conditions include: Correlation between price change and bullish/bearish volume changes (over a user-defined correlation lookback period). Momentum (Rate of Change, RoC) measured over a separate lookback period. Only bars closely matching current conditions (within user-defined tolerance percentages) are included. 2) Recency-Weighted Drift Concept: Recent market movements often influence future direction. We assign more importance to recent bars to capture the current market bias effectively.
Calculation Steps:
Consider recent price changes between opens and closes for a user-defined drift lookback (for example, last 20 bars). Give higher weight to recent bars (the most recent bar gets the highest weight, and weights decrease progressively for older bars). Average these weighted changes separately for upward and downward movements, then combine these averages to calculate a final drift percentage relative to the current price. 3) Correlation Filtering Concept: Price changes often correlate strongly with bullish or bearish volume activity. By using historical correlation comparisons, we focus only on past market states with similar volume-price dynamics.
Calculation Steps:
Compute current correlations between price changes and bullish/bearish volume over the user-defined correlation lookback. Evaluate each historical bar to see if its correlation closely matches the current correlation (within a user-specified percentage tolerance). Only historical bars meeting this correlation criterion are selected. 4) Momentum (RoC) Filtering Concept: Two market periods may exhibit similar correlation structures but differ in how fast prices move (momentum). To ensure true similarity, momentum is checked as an additional filter.
Calculation Steps:
Compute the current Rate of Change (RoC) over the specified RoC lookback. For each candidate historical bar, calculate its historical RoC. Only include historical bars whose RoC closely matches the current RoC (within the RoC percentage tolerance). 5) Quantile-Based Volatility and Drift Amplification Concept: Quantiles (such as the 95th, 50th, and 5th percentiles) help gauge if current prices are near historical extremes or the median. Quantile bands measure volatility expansions and contractions.
Calculation Steps:
Calculate the 95%, 50%, and 5% quantiles of price over the quantile lookback period. Add and subtract multiples of the standard deviation to these quantiles, creating upper and lower bands. Measure the bands' widths relative to the current price as volatility indicators. Determine the active quantile (95%, 50%, or 5%) based on proximity to the current price (within a percentage tolerance). Compute the rate of change (RoC) of the active quantile to detect directional bias. Combine volatility and quantile RoC into a scaling factor that amplifies or dampens expected price moves. 6) Expected Value (EV) Computation & Forecast Lines Concept: We forecast future prices based on how similarly-conditioned historical periods performed. We average historical moves to estimate the expected future price.
Calculation Steps:
For each forecast horizon (e.g., 1 to 27 bars ahead), collect all historical price moves that passed correlation and RoC filters. Calculate average historical moves for bullish and bearish cases separately. Adjust these averages by applying recency-weighted drift and quantile-based scaling. Translate adjusted percentages into absolute future price forecasts. Draw bullish and bearish forecast lines accordingly. Indicator Inputs & Their Roles Correlation Tolerance (%) Adjusts how strictly the indicator matches historical correlation. Higher tolerance includes more matches, lower tolerance selects fewer but closer matches.
Price RoC Lookback and Price RoC Tolerance (%) Controls how momentum (speed of price moves) is matched historically. Increasing tolerance broadens historical matches.
Drift Lookback (bars) Determines the number of recent bars influencing current drift estimation.
Quantile Lookback Period and Std Dev Multipliers Defines quantile calculation and the size of the volatility bands.
Quantile Contact Tolerance (%) Sets how close the current price must be to a quantile for it to be considered "active."
Forecast Horizons Specifies how many future bars to forecast.
Continuous Forecast Lines Toggles between drawing continuous lines or separate horizontal segments for each forecast horizon.
Practical Trading Applications Bullish & Bearish EV Lines These forecast lines indicate expected price levels based on historical similarity. Green indicates positive expectations; red indicates negative.
Momentum vs. Mean Reversion Wide quantile bands and high drift suggest momentum, while extremes may signal possible reversals.
Filtering Non-Relevant Historical Data By using both correlation and RoC filtering, irrelevant past periods are excluded, enhancing forecast reliability.
Multi-Timeframe Suitability Adaptable parameters make this indicator suitable for different trading styles and timeframes.
Complementary Tool This indicator provides probabilistic projections rather than direct buy or sell signals. Combine it with other trading signals and analyses for optimal results.
Important Considerations While historically-informed forecasts are valuable, market behavior can evolve unpredictably. Always manage risks and use supplementary analysis.
Experiment extensively with input settings for your specific market and timeframe to optimize forecasting performance.
Summary The Recency-Weighted Market Memory w/ Quantile-Based Drift indicator uniquely merges multiple sophisticated concepts, delivering dynamic, historically-informed price forecasts. By combining historical similarity, adaptive drift, momentum filtering, and quantile-driven volatility scaling, traders gain an insightful perspective on future price possibilities.
Feel free to experiment, explore, and enjoy this powerful addition to your trading toolkit!
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Para acesso rápido no gráfico, adicione esse script para seus favoritos — saiba mais aqui.
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Para acesso rápido no gráfico, adicione esse script para seus favoritos — saiba mais aqui.
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.