OPEN-SOURCE SCRIPT
Fractal Memory Projection [Jayadev Rana]

Fractal Memory Projection searches price history for the moment that most resembles the present, then shows what happened next - drawn on your chart as 50 lighter ghost candles ahead of the current bar - together with trend-flip BUY and SELL signals and volatility-adaptive targets.
HOW THE FORECAST WORKS
The last 30 closes are converted to normalized log returns (the pattern window). The script scans up to 750 past bars and scores every historical window of the same length by mean squared distance, so the comparison is about the shape of movement, not price level. The bars that followed the best match are replayed forward from the current close, rescaled by the ratio of current ATR to ATR at the match, and drawn as 50 semi-transparent ghost candles beyond the last bar. The panel reports the match similarity, how many bars ago it occurred, and the net forecast direction.
The projection is a statistical analog - a look at how the most similar past episode unfolded - not a prediction or a guarantee. It is display-only and never affects historical values, so nothing repaints.
BUY AND SELL SIGNALS
An ATR trailing stop tracks the trend. When it flips direction, a BUY or SELL label prints - by default only when the ghost-candle forecast agrees with the flip direction (toggle available). Alerts are included for both signals.
VOLATILITY-ADAPTIVE TARGETS
Target spacing is not fixed. A unit of risk R equals ATR multiplied by (0.8 + ATR percentile rank over 200 bars), so quiet markets produce tighter targets and volatile markets produce wider ones. Each signal sets TP1, TP2 and TP3 at 1R, 2R and 3R and a stop loss at 1.2R (adjustable). Only the most recent trade's levels are kept on the chart to stay clean.
PANEL
Match quality percent, bars since the match, volatility regime (Low, Normal, High), forecast direction, and current trend side.
SETTINGS
Pattern window, scan depth, forecast length, ghost candle colors, ATR length, trail multiplier, forecast-agreement filter, stop multiplier, and panel position are all configurable.
NOTES
Works on any symbol and timeframe with enough history (at least scan depth plus forecast length bars). This is an analysis tool, not financial advice. Test on your own data and manage risk before trading.
HOW THE FORECAST WORKS
The last 30 closes are converted to normalized log returns (the pattern window). The script scans up to 750 past bars and scores every historical window of the same length by mean squared distance, so the comparison is about the shape of movement, not price level. The bars that followed the best match are replayed forward from the current close, rescaled by the ratio of current ATR to ATR at the match, and drawn as 50 semi-transparent ghost candles beyond the last bar. The panel reports the match similarity, how many bars ago it occurred, and the net forecast direction.
The projection is a statistical analog - a look at how the most similar past episode unfolded - not a prediction or a guarantee. It is display-only and never affects historical values, so nothing repaints.
BUY AND SELL SIGNALS
An ATR trailing stop tracks the trend. When it flips direction, a BUY or SELL label prints - by default only when the ghost-candle forecast agrees with the flip direction (toggle available). Alerts are included for both signals.
VOLATILITY-ADAPTIVE TARGETS
Target spacing is not fixed. A unit of risk R equals ATR multiplied by (0.8 + ATR percentile rank over 200 bars), so quiet markets produce tighter targets and volatile markets produce wider ones. Each signal sets TP1, TP2 and TP3 at 1R, 2R and 3R and a stop loss at 1.2R (adjustable). Only the most recent trade's levels are kept on the chart to stay clean.
PANEL
Match quality percent, bars since the match, volatility regime (Low, Normal, High), forecast direction, and current trend side.
SETTINGS
Pattern window, scan depth, forecast length, ghost candle colors, ATR length, trail multiplier, forecast-agreement filter, stop multiplier, and panel position are all configurable.
NOTES
Works on any symbol and timeframe with enough history (at least scan depth plus forecast length bars). This is an analysis tool, not financial advice. Test on your own data and manage risk before trading.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。