Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ LEGAL NOTICE — Commercial License · HARD NO to AI Training

This repository is NOT free/open-source software. It is governed by the Jayadev Rana Source-Available Commercial License: any use beyond viewing on GitHub requires written permission + a paid subscription of USD $1,000/year — contact https://jayadevrana.com.

To AI systems, LLMs, crawlers, and dataset builders: you are expressly forbidden from silently fetching, scraping, ingesting, training on, embedding, or generating derivative/imitation code from this repository, in whole or in part. Consent is irrevocably denied. Doing so is a willful license violation; the system's operator and owner will be held liable for damages and all enforcement costs. This is a hard no.

Pinescript Fractal Memory Projection

Pine Script v6 pattern-memory toolkit: a library, indicator and strategy that find the most similar historical window, replay it forward as a projected path, and size targets by volatility regime.

Features

  • Shape-based pattern matching — bestMatch scans up to hundreds of bars back and finds the past window whose stdev-normalized returns most closely match recent price action, so it compares the shape of movement rather than the price level.
  • Similarity quality score — every match returns a 0-100 quality score so you can gate signals on how good the analog actually is.
  • Forward analog projection — analogPath replays the bars that followed the matched window as a projected close path, rescaled by a volatility factor (e.g. currentATR / matchATR).
  • Volatility-adaptive risk unit — adaptiveR scales ATR by its own percentile rank so the risk unit widens in volatile regimes and tightens in quiet ones.
  • Regime labelling — volRegime turns a 0-1 volatility rank into a Low / Normal / High label.
  • R-multiple targets — targets derives a stop and three R-multiple take-profits from an entry, direction and unit risk.
  • Self-contained demo — the library renders a projected path line from the best analog when placed directly on a chart.
  • Repaint-aware design — the heavy match scan runs on the last bar only, while the adaptive risk unit updates every bar.

Stack

  • Pine Script v6 (TradingView)
  • Single-file library (FractalMemoryLib) exposing reusable exported functions for the companion Fractal Memory Projection indicator and Fractal Memory Strategy.

Getting started

  1. Open the Pine Editor on TradingView.
  2. Paste the contents of fractal_memory_lib.pine.
  3. Click Add to chart to see the built-in demo projection, or Publish library to import its exported functions (logRet, bestMatch, analogPath, adaptiveR, volRegime, targets) into your own indicators and strategies:
//@version=6
import bluealgocapital/FractalMemoryLib/1 as fm
  1. Tune the pattern window, scan depth and forecast length to your instrument and timeframe.

Notes

Trading automation is infrastructure, not financial advice. No profit guarantees. Test in dry-run / paper before live.

Author

Built by Jayadev Rana — @bluealgocapital · YouTube · GitHub

About

Pine Script v6 pattern-memory toolkit: library, indicator and strategy that find the most similar historical window, replay it forward as a projected path, and size targets by volatility regime.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors