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?
The Centroid Torque Expansion strategy is a single-timeframe, trend-expansion expert advisor (EA) for MetaTrader 5 that builds its trading logic around a physics-inspired "torque" measurement instead of a conventional oscillator. At its core it uses an Exponential Moving Average (EMA) — a smoothed line that represents a rolling "equilibrium" price, often called the centroid — together with the Average True Range (ATR), a volatility gauge, to size its stops and targets. The trading style is best described as directional breakout / expansion trading: it tries to detect the onset of a leg that is driving price away from equilibrium.
Rather than reacting to a moving-average crossover or a fixed band, the strategy measures how fast price is pulling away from the EMA. It defines a per-bar quantity called torque — the product of price's distance from the centroid (the "lever arm") and its one-bar change (the "velocity"). Mathematically, that product is the rate of change of "deviation energy," a measure of how far price has stretched from its equilibrium. When torque is positive and rising, the deviation energy is growing, which the strategy interprets as a fresh directional expansion getting under way.
As an educational tool, Centroid Torque Expansion is well suited to traders who want to study how first-principles reasoning can be turned into concrete entry and exit rules. It is not a "set and forget" money tool; it is a framework for learning how volatility-adaptive thresholds, equilibrium models, and momentum confirmation can be combined. Beginners can use it to understand adaptive thresholds, while more experienced students can dissect how the exit logic ties directly back to the entry hypothesis.
How It Works
The strategy processes one completed bar at a time on the chart's primary timeframe. On each new bar it recomputes the centroid, the torque, an adaptive threshold, and the ATR, then checks for an entry or manages an open position.
Core calculations the strategy performs:
- Centroid (equilibrium): an EMA of closing prices over
CentroidPeriodbars. This is the moving "fair value" that price oscillates around. - Lever arm (r): the current close minus the centroid. A positive value means price sits above equilibrium; negative means below.
- Velocity (dv): the current close minus the previous close — the one-bar directional push.
- Torque (τ): lever arm × velocity. This is the per-bar rate of change of deviation energy. Positive torque means energy is growing (price expanding away from equilibrium); negative means energy is decaying (price relaxing back toward it).
- Smoothed torque (T): the average of the last
TorqueSmoothingtorque values, to reduce noise. - Adaptive threshold:
ThresholdK× the rolling standard deviation of torque over the lastStatWindowbars. Because it scales with recent volatility, the trigger self-adjusts to the market regime rather than using a fixed number.
The strategy signals a long entry when all of the following are true:
- The smoothed torque crosses above the adaptive threshold on this bar (it was at or below the threshold on the prior bar and is now above it) — a fresh onset of expansion.
- The lever arm r is positive (price is above equilibrium), selecting the upside.
- The current velocity dv is positive, confirming the push is upward.
The strategy signals a short entry when the mirror conditions hold: smoothed torque crosses above the adaptive threshold, the lever arm r is negative (price below equilibrium), and velocity dv is negative to confirm downward push.
Exit logic is tied directly to the same hypothesis. The strategy holds only one position at a time and closes it when the expansion is judged to be over:
- For a long, it exits when smoothed torque falls to zero or below (energy is no longer expanding) or when the lever arm r turns negative (price has recrossed back below the centroid).
- For a short, it exits when smoothed torque falls to zero or below or when the lever arm r turns positive (price has recrossed above the centroid).
Stop-loss and take-profit are volatility-based. When a trade opens, the strategy places:
- A stop-loss at
AtrStopMult× ATR away from entry. - A take-profit at
AtrTakeMult× ATR away from entry.
Because these distances are derived from ATR, they widen in volatile conditions and tighten in calm ones, so the risk framework adapts automatically. Note that a position can be closed either by the torque/centroid exit rules or by hitting the ATR stop/target — whichever occurs first.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| CentroidPeriod | 40 | 10 | 120 | Length of the EMA that defines the moving equilibrium (centroid). Longer values create a slower, smoother lever arm. |
| TorqueSmoothing | 8 | 2 | 30 | Window size (M) for averaging recent torque into the smoothed torque signal T. Larger values reduce noise but add lag. |
| StatWindow | 60 | 20 | 200 | Rolling window (L) used to estimate the standard deviation of torque for the adaptive threshold. Automatically clamped to be at least as large as TorqueSmoothing. |
| ThresholdK | 1.20 | 0.20 | 3.00 | Self-adapting z-score multiplier. Entry triggers when smoothed torque crosses above ThresholdK × sigma(torque). Higher values demand stronger expansion. |
| AtrPeriod | 14 | 5 | 40 | Number of bars used to calculate the Average True Range for dynamic stop and target sizing. |
| AtrStopMult | 2.00 | 0.50 | 5.00 | Stop-loss distance as a multiple of ATR. Larger values give the trade more room but increase risk per trade. |
| AtrTakeMult | 3.00 | 0.50 | 8.00 | Take-profit distance as a multiple of ATR. Combined with the stop multiple, this sets the reward-to-risk ratio. |
| Lots | 0.10 | 0.01 | 1.00 | Fixed trade size in lots for each position opened. |

Recommended Chart Settings
Centroid Torque Expansion is a single-timeframe strategy — every calculation uses the chart's own timeframe, so you simply attach it to the timeframe you want it to trade. The default parameters (a 40-bar centroid and a 60-bar statistics window) are geared toward capturing intraday-to-swing expansion legs, which historically makes timeframes such as M15, M30, or H1 a reasonable starting point for study.
For the instrument, the strategy is symbol-agnostic and can be applied to major forex pairs (for example EUR/USD or GBP/USD) as well as other liquid CFD markets. Because the adaptive threshold scales with each market's own volatility, the logic can transfer across instruments — but the ideal parameter values will differ. Results will vary considerably across different symbols, timeframes, and market conditions, so treat any single configuration as a hypothesis to be tested, not a fixed recommendation. Always validate settings on historical data and a demo account before considering them further.
How to Install on MetaTrader 5
- Download the
.ex5file from the link below. - Copy it to your MT5
MQL5\Expertsfolder. - Restart MetaTrader 5 or refresh the Navigator panel.
- Drag the EA onto a chart matching the recommended symbol and timeframe.
- Configure the input parameters and enable Algo Trading.
What to Consider Before Using This EA
Strengths of the approach. The most distinctive feature of Centroid Torque Expansion is its self-adapting threshold. By expressing the entry trigger as a multiple of the recent standard deviation of torque, the strategy raises its bar during volatile regimes and lowers it during quiet ones, instead of relying on a fixed constant that quickly goes stale. Its exit logic is also unusually coherent: positions are closed on the same physical reasoning that opened them — when the expansion stops growing or price falls back through equilibrium — rather than on an unrelated rule. The ATR-based stops and targets add a further layer of volatility adaptation.
Known limitations. Expansion and breakout strategies, by design, tend to perform best when markets actually trend or make sustained directional moves. In range-bound or choppy conditions, torque can repeatedly poke above the threshold only for price to snap back toward equilibrium, producing a string of small losing trades — a classic "whipsaw" problem for breakout systems. The strategy also trades one position at a time and uses a fixed lot size, so it does not scale exposure to account equity or pyramid into strong moves. Because it acts only on completed bars, entries are inherently slightly delayed relative to intrabar price action, and the smoothed-torque averaging adds a little more lag in exchange for fewer false signals.
Where it may underperform. Very low-volatility instruments or timeframes may generate a torque standard deviation so small that the adaptive threshold becomes noisy, while news-driven gaps can move price past ATR-based stops before they fill at the intended level. None of these are unique flaws of this EA — they are general realities of systematic trading — but they matter when you evaluate whether the logic fits a given market. Approach the strategy as a study of adaptive-threshold expansion trading rather than a finished product, and expect to spend meaningful time testing before drawing conclusions.
Risk Management Tips
Sound risk management is what separates disciplined study from gambling. Whatever strategy you examine, the following educational principles apply:
- Position sizing: Keep each trade small relative to your account. A common educational guideline is to risk no more than 1–2% of account equity per trade. Note that this EA uses a fixed lot size, so you may need to adjust the
Lotsinput to align with your account and the ATR-based stop distance. - Test on a demo account first: Run the strategy on a demo or simulated account until you understand how it behaves across trending, ranging, and volatile phases before considering any live use.
- Understand drawdown: Every strategy experiences losing streaks. Study the maximum peak-to-trough decline in equity so you know what a normal rough patch looks like and can avoid abandoning a plan at the worst moment.
- Use stops deliberately: The ATR-based stop-loss is there for protection. Widening it carelessly to avoid being stopped out can dramatically increase the loss on any single trade.
- Avoid over-optimization: Tuning parameters until they fit historical data perfectly ("curve fitting") often produces settings that fail on new data. Prefer robust ranges over a single "perfect" value.
- Only risk what you can afford to lose: Never allocate money needed for living expenses or financial obligations to leveraged trading.
Treat this EA as a learning laboratory: change one parameter at a time, observe the effect, and build an understanding of why the strategy behaves as it does.
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
- Expert Advisor: CentroidTorqueExpansion.ex5 (0 downloads)
- Source Code: CentroidTorqueExpansion.mq5 (0 downloads)
- Documentation: CentroidTorqueExpansion.pdf (0 downloads)