KDJ Expert Advisor
This EA trades based on the KDJ indicator (Stochastic variant with J-line), generating buy signals when K and D lines cross upward in oversold zones and sell signals when they cross downward in overbought zones. It uses the J-line as a confirming signal for momentum shifts and executes market orders with configurable lot sizing. The strategy aims to capture momentum reversals at extreme KDJ readings.
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.46% | +0.40% | 4.12% | 136 | 42.20% | 0.13 | 0.11 | 9 | +$0.09 | Reliable |
| GBPUSD | -1.30% | -1.13% | 6.49% | 134 | 45.90% | -0.20 | -0.20 | 7 | −$1.15 | Reliable |
| USDJPY | +2.38% | +2.07% | 3.98% | 132 | 53.00% | 0.47 | 0.60 | 4 | +$1.80 | Reliable |
| XAUUSD | -16.10% | -13.50% | 81.03% | 141 | 45.00% | 0.43 | -0.20 | 13 | −$13.26 | Reliable |
Profitable on 2 of 4 markets with reliable results.
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.
Against the other Momentum EAs with a reliable result on the same market: EURUSD: better than 63% of 68 · GBPUSD: better than 45% of 66 · USDJPY: better than 79% of 68 · XAUUSD: better than 47% of 75
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 46% | +3.47% 2026-04 | -2.05% 2026-03 |
| GBPUSD | 54% | +1.50% 2026-11 | -2.37% 2026-05 |
| USDJPY | 54% | +2.31% 2026-01 | -1.17% 2026-03 |
| XAUUSD | 31% | +111.00% 2026-03 | -21.43% 2026-08 |
From the backtest equity curve, sampled about every two days; only reliable results.
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
This EA uses the KDJ indicator as its core signal source, where KDJ is a variant of the Stochastic oscillator that adds a J-line (3K-2D) for increased sensitivity. Entry conditions are: for long positions, the K and D lines form a golden cross in the oversold zone (typically below 20) with the J-line turning upward from low levels; for short positions, the K and D lines form a death cross in the overbought zone (typically above 80) with the J-line turning downward from high levels. Exit conditions rely on reverse crossover signals or fixed stop-loss and take-profit settings. Position sizing uses a fixed lot approach, lacking dynamic sizing based on account balance or risk percentage. Money management is relatively simplistic, without equity proportion calculations or maximum position limits. The overall strategy is a typical momentum reversal trading system, suitable for ranging markets but likely to generate frequent false signals during strong trends.
Strengths
- The KDJ indicator's J-line increases signal sensitivity, capturing momentum shifts earlier
- Clear and concise strategy logic with highly configurable parameters for optimization and tuning
- Overbought/oversold zone filtering reduces false signals in ranging markets
- Entry conditions combining zone filtering with crossover confirmation provide reasonable reliability
- Relatively simple code structure, easy to understand and further develop
Weaknesses
- Fixed lot sizing lacks dynamic position management, unable to adjust risk exposure based on market volatility
- Default stop-loss and take-profit at zero may lead to unlimited loss risk
- KDJ tends to generate frequent false reversal signals in strong trending markets
- No new bar check mechanism, potentially opening multiple positions on the same bar
- Lack of spread filter may result in excessive entry costs in high-spread environments
Possible improvements
- Add dynamic position sizing based on account risk percentage, calculating lots from ATR or fixed risk ratio
- Implement new bar check and spread filter to prevent duplicate entries and high-cost entries
- Introduce a trend filter (e.g., moving average direction) to avoid counter-trend trading in strong trends
Risk assessment
Overall risk: Medium
- Default stop-loss and take-profit at zero poses unlimited loss risk
- No new bar check may cause duplicate position opening on the same bar
- Fixed lot sizing cannot adapt to different account sizes and market volatility
- No maximum position limit, potentially leading to overexposure in extreme conditions
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
LotSize | 0.1 | Base lot size per leg |
K_Period | 9 | K-line calculation period |
D_Period | 3 | D-line smoothing period |
J_Smooth | 3 | J-line smoothing period |
OverboughtLevel | 80 | Overbought threshold level |
OversoldLevel | 20 | Oversold threshold level |
StopLoss | 0 | Stop loss in points, 0 means no stop loss |
TakeProfit | 0 | Fixed take profit points (20 pts) |
Similar Momentum EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.