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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.