Blog / Strategy
Strategy

Phase Space Analog Projection

Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy — including backtests — does not guarantee future results. Never trade with money you cannot afford to lose.

What Is This Strategy?

Phase Space Analog Projection is a quantitative MetaTrader 5 Expert Advisor (EA) built on a single, unusual idea: treat the price chart not as a set of familiar patterns, but as the visible output of an unknown dynamical system. Instead of relying on classic indicators, chart patterns, or support and resistance, the strategy uses a technique borrowed from nonlinear time-series analysis called delay-coordinate embedding — reconstructing the market's recent "state" from a short window of log returns and then searching history for moments that looked geometrically similar. In plain terms, it is an analog forecasting system: it finds past situations that resemble the present one and studies what happened next.

The core tool here is the nearest-neighbour projection. The EA converts each bar's close-to-close move into a log return, stacks the most recent handful of returns into a small vector (the market's "position" in a reconstructed phase space), and then hunts for the closest historical matches. Each of those historical analogs already has a known future — the move that actually followed — so the strategy averages those realised futures, weighting closer matches more heavily, to build an expected forward return. This is a systematic, regime-adaptive trading style rather than a directional bias: the same machinery can lean with a trend in a persistent market or fade it in a mean-reverting one, depending entirely on what the historical analogs did next.

As a learning tool, Phase Space Analog Projection is best suited to traders who are curious about data-driven, model-free forecasting and who want to study how concepts from chaos theory and dynamical systems can be expressed in a mechanical trading rule. It is not a "set and forget" shortcut. It rewards users who understand its statistical assumptions, appreciate why it filters out low-confidence signals, and are comfortable studying how it behaves across different symbols and timeframes.

How It Works

The strategy processes one newly closed bar at a time and maintains a rolling library of historical bars to search through. On each new bar it performs the following steps:

Once a forecast passes those gates, the entry logic is straightforward:

Exit handling combines several protective layers:

phase space analog projection EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
EmbedDim 4 2 12 Embedding dimension — how many recent log returns define the market's state vector.
Neighbors 10 3 40 Number of nearest historical analogs (K) pooled into the projection.
Horizon 6 1 30 Forecast horizon in bars; the future move each analog is measured over.
ThresholdSigma 0.5 0.0 3.0 Signal threshold in volatility units; the forecast must clear ThresholdSigma × sigma × √Horizon.
MinAgreement 0.60 0.5 1.0 Minimum fraction of analogs that must agree with the projection's direction.
LibraryBars 1000 300 4000 Size of the searchable analog library, in retained bars.
AtrPeriod 14 7 40 Period of the Average True Range used for stops and targets.
AtrSlMult 2.0 0.8 5.0 Stop-loss distance as a multiple of ATR.
AtrTpMult 3.0 1.0 6.0 Take-profit distance as a multiple of ATR.
Lots 0.10 0.01 1.0 Fixed trade volume in lots.
phase space analog projection EA — MQL5 source code

Recommended Chart Settings

Phase Space Analog Projection is designed to run on a single primary timeframe and works on whatever chart it is attached to. It is intended for liquid instruments with continuous, mean-scaled price behaviour — major FX pairs, metals such as gold, stock indices, or major crypto pairs. Because the method needs a meaningful history to search, make sure enough bars are loaded to fill the analog library (governed by LibraryBars).

A common starting point for study is a mid-range timeframe such as H1 or M15 on a major pair, where there is enough data density to populate the phase space without excessive noise. There is no universally "correct" setting: the embedding dimension, horizon, and volatility threshold interact with the character of each market. Results will vary across different symbols, sessions, and market conditions, so treat any configuration as a hypothesis to be tested rather than a fixed recipe.

How to Install on MetaTrader 5

What to Consider Before Using This EA

The main strength of Phase Space Analog Projection is that it is model-free and self-adapting. It does not assume the market trends or reverts; it simply reports what historically followed states similar to the present one. The Theiler window and agreement gate are thoughtful safeguards that reduce the risk of projecting from one lucky, overlapping stretch of history or from an incoherent set of neighbours. The volatility-scaled threshold also helps the signal adjust as conditions change.

That said, the approach has real limitations worth understanding:

This is a strategy to study and stress-test, not to deploy blindly. Its value as an educational tool lies in showing how a rigorous, statistically defensible forecasting idea can be translated into mechanical rules.

Risk Management Tips

Sound risk management matters far more than any single strategy's logic. Consider these general principles as you study this EA:

Risk Warning

Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.

Downloads

← Back to Blog