EA-1389 · Trend Following

Exp_EF_distance

This EA trades based on the EF_distance indicator, which measures the efficiency of price movement to detect trend direction. It opens buy positions when the EF_distance values indicate an upward trend (Value[0]>Value[1]<Value[2]) and sell positions when they indicate a downward trend, with an optional Flat-Trend volatility filter in the full version.

Open the interactive view (equity curve, symbol switch)

Key facts

RiskMedium
Rating★★★☆☆
TypeTrading EA
TimeframesH1, H4, D1
IndicatorsEF_distance, Flat-Trend, StDev, ATR
AuthorCopyright © 2012, Nikolay Kositsin

Backtest results (H1, about 1 year)

Not backtested yet — this EA could not be converted automatically.

Strategy analysis

The strategy concept is based on the EF_distance indicator, which measures the efficiency of price movement to determine trend strength and direction. Entry conditions for buy positions require the EF_distance values to show a descending pattern over the prior two bars (Value[1]<Value[2]) with the current bar reversing upward (Value[0]>Value[1]), and the full version additionally requires the Flat-Trend volatility indicator to meet or exceed the configured volatility threshold. Sell entry conditions are the mirror opposite, requiring an ascending pattern that reverses downward. Exit conditions are triggered by opposing signals — a long position is closed when a sell signal appears and vice versa, with fixed StopLoss and TakeProfit in points. Position sizing is controlled by the MM parameter, where negative values represent fixed lot sizes and positive values represent a share of the deposit. Money management is handled through the TradeAlgorithms.mqh library functions, but there is no dynamic adjustment of stop-loss, take-profit, or trailing stop mechanism. The full version (exp_ef_distance.mq5) adds the Flat-Trend indicator as a volatility filter, only allowing entries when market volatility is sufficient, which improves signal quality.

Strengths

  • Full version combines a volatility filter to avoid frequent entries in low-volatility choppy markets
  • Uses new bar detection (CIsNewBar) to prevent duplicate trades within the same bar
  • Provides independent toggle switches for buy/sell opening and closing, offering high flexibility
  • Supports automatic lot sizing based on deposit share, aiding money management
  • Dual-indicator confirmation mechanism reduces false signals

Weaknesses

  • Stop-loss and take-profit are fixed points without dynamic adjustment based on market volatility (ATR), which may be inappropriate across varying market conditions
  • Lacks a trailing stop mechanism, so profitable positions may give back most gains during pullbacks
  • No spread filter, which can lead to slippage losses on instruments with wide spreads
  • EF_distance indicator logic is opaque, making parameter optimization lack intuitive guidance
  • Signal generation logic is simplistic, relying on comparison of only 3 bars of indicator values, which may produce frequent false reversal signals

Possible improvements

  • Replace fixed stop-loss/take-profit with ATR-based dynamic levels to adapt risk management to market volatility
  • Add a trailing stop feature to protect accumulated profits from significant pullbacks
  • Add spread and slippage filters to avoid opening positions when spreads are excessively wide
  • Add maximum position count limits and maximum drawdown protection to prevent excessive losses in extreme market conditions

Risk assessment

Overall risk: Medium

  • Fixed stop-loss/take-profit does not adapt to market volatility — stop may be too wide in low volatility and take-profit too small in high volatility
  • Lacks trailing stop, so winning positions can retrace significantly into loss territory
  • No spread filter or maximum drawdown protection mechanism
  • When MM parameter is negative (fixed lot), small accounts may result in excessive leverage

Evaluation scores

Code quality3.0
Strategy logic3.0
Risk management2.0
Robustness3.0
Innovation2.0
Documentation2.0
Overall2.5

Parameters

ParameterDefaultDescription
MM-0.1Money management percentage for lot calculation
StopLoss_1000Stop loss in points
TakeProfit_2000Take profit in points
Deviation_10Max price deviation in points
BuyPosOpentrueAllow buying
SellPosOpentrueAllow selling
BuyPosClosetrueAllow closing long positions
SellPosClosetrueAllow closing short positions
InpInd_TimeframePERIOD_H4Indicator timeframe
SignalBar1Bar index for entry signal
XLength10EF_distance smoothing depth
Power2.0EF_distance averaging power
IPCPRICE_CLOSEPrice constant type
StDevPeriod20Standard deviation period (full version)
StDev_MethodMODE_LWMAStandard deviation smoothing method (full version)
StDevLength5Standard deviation smoothing depth (full version)
StDevPhase15Standard deviation smoothing phase (full version)
ATRPeriod20ATR period (full version)
ATR_MethodMODE_LWMAATR smoothing method (full version)
ATRLength5ATR smoothing depth (full version)
ATRPhase15ATR smoothing phase (full version)
VolatilV3Volatility threshold for trade execution (full version)

Similar Trend Following EAs

Backtests are historical simulations and do not guarantee future results. Not financial advice.

Get the weekly Arena report

One email a week: ranking changes, new signals and new research. No spam; unsubscribe any time.