Exp_LinearRegSlopeV2
This EA trades based on the slope of a linear regression line, using the ColorLinearRegSlope_V2 custom indicator. It opens buy positions when the regression slope turns positive and sell positions when it turns negative, with configurable smoothing methods and price types. Entry signals are confirmed on new bars by comparing current and previous indicator buffer values for crossover detection.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
| Symbol | P&L | Annual | Max DD | Trades | Win rate | Sharpe | Recovery | Losing streak | Per trade | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| EURUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Custom indicator approximated |
| GBPUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Custom indicator approximated |
| USDJPY | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Custom indicator approximated |
| XAUUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Custom indicator approximated |
Converted from MQL5 to Python and run with the same rules for every EA. Positions use MT5 lot sizes (100,000 units per FX lot, 100 oz per gold lot) with 1:100 leverage, one order at a time, and a stop-out below 10% of the starting balance. Sharpe is computed from the equity curve. Results marked as unreliable are shown for completeness only.
Blow-up risk: No blow-up pattern found
None of the usual blow-up patterns were found in the code, and the account was not stopped out in our backtests. That is not a guarantee: any EA can lose money.
High: stopped out in our backtest, or martingale/grid sizing without a stop loss. Elevated: martingale or grid sizing with a stop loss, or several positions at once without a stop loss. What the label means and what we found →
Strategy analysis
The core concept of this strategy is using the slope of a linear regression line to determine market trend direction — a positive slope indicates an uptrend while a negative slope indicates a downtrend. Entry conditions are triggered when the upper buffer crosses above the lower buffer (buy signal) or when the lower buffer crosses above the upper buffer (sell signal), with the previous bar already being in the corresponding trend state as confirmation. Exit conditions rely on fixed Stop Loss and Take Profit settings in points, and positions are also closed when a reverse signal appears (e.g., a long position is closed when a sell signal emerges). Position sizing is controlled via the MM parameter, where negative values represent fixed lot sizes and positive values represent deposit-proportional sizing. Money management leverages standard functions from the TradeAlgorithms library for order execution, including maximum price deviation control to limit slippage. The strategy also implements a signal conflict resolution mechanism that cancels all trading signals when buy and sell signals appear simultaneously, preventing contradictory dual-direction entries.
Strengths
- Uses linear regression slope for trend determination, which has a stronger statistical foundation than simple moving average crossovers
- Supports 10 smoothing methods and 9 price types, offering high parameter flexibility to adapt to different market conditions
- Implements signal conflict resolution that cancels all signals when contradictory buy/sell signals appear simultaneously
Weaknesses
- Fixed Stop Loss and Take Profit in points ignore market volatility (ATR), leading to inconsistent performance across varying volatility regimes
- Lacks spread filter and trading session filter, potentially executing trades during high-spread or unfavorable trading hours
- Depends on external indicator file ColorLinearRegSlope_V2 and two include libraries, increasing deployment complexity with no error recovery
Possible improvements
- Replace fixed SL/TP with ATR-based dynamic stops to adapt to varying volatility environments
- Add spread filter and trading session controls to prevent entries during unfavorable trading conditions
Risk assessment
Overall risk: Medium
- No spread filter may cause unfavorable fills and additional slippage losses during high-spread periods
- When MM is negative, fixed lot sizing lacks dynamic adjustment based on account balance changes
- Depends on custom indicator and external libraries; handle creation failure only prints a warning but EA continues running without signals
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
MM | -0.1 | Deposit fraction or lot size; negative=fixed lot |
StopLoss_ | 1000 | Stop loss in points |
TakeProfit_ | 2000 | Take profit in points |
Deviation_ | 10 | Max price slippage deviation (points) |
BuyPosOpen | true | Allow buy position opening |
SellPosOpen | true | Allow opening sell positions |
BuyPosClose | true | Allow closing buy positions |
SellPosClose | true | Allow closing sell positions |
InpInd_Timeframe | PERIOD_H4 | Vortex indicator timeframe |
SlMethod | MODE_SMA | Smoothing method |
SlLength | 12 | Smoothing depth |
SlPhase | 15 | Smoothing parameter (JJMA range -100 to +100) |
IPC | PRICE_CLOSE | Price constant type |
TriggerShift | 1 | Trigger bar shift |
SignalBar | 1 | Bar index for entry signal |
Similar Trend Following EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.