Market Memory Average (Zeiierman)█ Overview
Market Memory Average (Zeiierman) is a similarity-based market regime tool that scans historical price behavior to identify past conditions that closely resemble the current market state.
The script compares momentum, RSI, volatility, and relative volume to build a “market memory” model. It then extracts the internal momentum of the most similar historical states and blends them into a dynamic projection line.
The result is an adaptive average that reflects how the market has historically behaved when conditions looked like this, rather than relying on fixed formulas or traditional lagging averages.
█ How It Works
⚪ Market State Encoding
The script defines the current market using momentum (ROC), RSI, volatility (ATR%), and relative volume. These features describe how the market is behaving, not just price position.
⚪ Historical Similarity Scan
Each past bar is compared to the current state using a multi-feature distance model.
Closer matches receive higher weights through exponential decay:
similarity = 100 * exp(-distance * sensitivity)
⚪ Top Match Selection
The script ranks all historical states and keeps only the most similar ones. These represent past environments that closely resemble current conditions.
⚪ Memory Momentum
From each match, the script extracts its internal momentum (ROC).
A similarity-weighted average is then calculated:
avgMomentum = weightedMomentum / totalWeight
⚪ Market Memory Average
This averaged momentum is applied to the current price to form the line:
memoryLine = close * (1 + avgMomentum / 100)
The result reflects how similar market states have historically behaved.
⚪ Historical Match Zones
Optional boxes highlight where similar conditions occurred in the past, along with their similarity strength.
█ How to Use
⚪ Market Memory Average
Bullish color → market conditions align with historically positive momentum.
Bearish color → market conditions align with historically negative momentum.
Unlike traditional averages, this line is built from the similarity-weighted momentum of past market matches. The cloud and structure dynamically adapt based on how those historical conditions behaved.
This gives the line a context-driven, memory-based approach, rather than relying on fixed calculations. The result is a dynamic reference for directional bias and regime context, grounded in how the market has behaved under similar conditions before.
⚪ Study Historical Match Zones (Example 1)
The match boxes show where similar market conditions occurred in the past, based on momentum, volatility, RSI, and volume alignment.
Each box represents a moment where the market behaved as it does now.
These zones can help:
Visualize recurring structures: See how similar conditions previously formed, such as pullbacks, bottoms, or consolidation phases within a trend.
Identify behavioral clustering: When multiple matches appear around similar types of price action, it suggests the market frequently revisits this behavior.
Understand the current environment: By comparing where those matches occurred (trend, range, recovery), you can interpret what kind of phase the market is currently in.
Build a contextual bias: If most matches come from pullbacks and recoveries (as in the example), the current state aligns more with pause → stabilize → continue behavior, rather than reversal or breakdown conditions.
These zones provide context, not prediction, helping you understand how the market is behaving relative to its own history.
⚪ Study Historical Match Zones (Example 2)
In this example, the current market state most closely aligns with these two highlighted zones.
Both matches formed during bearish conditions:
The left match shows a rejection after a strong move up, with momentum quickly flipping into a sharp drop.
The right match shows a weak bounce inside a downtrend, where the price attempted to recover but continued lower.
Looking at the current state (circled area), the price is:
Breaking down aggressively
Moving similarly to those past rejection phases
This suggests the current behavior aligns more with rejection → continuation, rather than stabilization or reversal.
█ Settings
Historical Scan Depth: Controls how far back the script searches for similar market states.
Top Similar Matches: Determines how many historical matches influence the average.
Historical Pattern Length: Sets the width of the displayed historical match zones.
Similarity Sensitivity: Controls how strict the similarity comparison is.
RSI Length: Defines the oscillator component of the market state.
ATR Length: Controls volatility measurement used in both similarity and cloud calculations.
Volume MA Length: Defines how relative volume is calculated.
Average Smoothing: Controls the responsiveness of the Market Memory Average.
Slope Detection Length: Determines how trend direction is evaluated.
Cloud Spread: Controls how far the cloud extends from the line.
-----------------
Disclaimer
The content provided in my scripts, indicators, ideas, algorithms, and systems is for educational and informational purposes only. It does not constitute financial advice, investment recommendations, or a solicitation to buy or sell any financial instruments. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
Indicatore Pine Script®






















