FibonacciRetracement
This EA uses ZigZag indicator to identify swing highs and lows, then constructs Fibonacci retracement levels on the most recent ZigZag leg. It enters buy trades when price crosses above Fibonacci support levels in an uptrend, and sell trades when price crosses below Fibonacci resistance levels in a downtrend, with stop-loss and take-profit based on Fibonacci extension.
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 | — | — | — | — | — | Not convertible yet |
| GBPUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| USDJPY | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| XAUUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
Why this EA never traded: no entry rule survived the conversion.
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 strategy concept is based on Fibonacci retracement theory, assuming that price retraces to specific Fibonacci ratio levels within a trend before continuing in the original direction. Entry conditions: in an uptrend, buy when the close price breaks above the 23.6%, 38.2%, 61.8%, or 76.4% retracement level while the previous bar's close was below that level; in a downtrend, sell when the close price breaks below those retracement levels while the previous bar's close was above. Exit conditions: stop-loss is set at a fixed point distance (StopLossLevel parameter) from the entry price, and take-profit is set at the Fibo00 level plus TakeProfitAt multiplied by FiboBASE (Fibonacci extension). Position sizing uses a fixed lot size (TradeValue parameter) with no dynamic position adjustment mechanism. Money management lacks maximum drawdown control, maximum position limits, and risk-per-trade percentage calculation, relying solely on fixed stop-loss and take-profit. Trend determination is performed by the CheckTrend function comparing the relative heights of the four most recent ZigZag pivot points.
Strengths
- Based on the classic Fibonacci retracement theory with clear and understandable logic
- Uses ZigZag indicator to automatically identify swing pivots, avoiding subjective judgment
- Has explicit stop-loss and take-profit mechanisms, not leaving risk entirely naked
- Trend filter mechanism avoids frequent trading in ranging markets
- Trade pause control (CloseBarPause) prevents immediate re-entry after stop-loss
Weaknesses
- CheckTrend function is declared as returning bool but actually returns int values (-1, 0, 1), a serious type mismatch bug
- In the sell condition block, the print message says 'Buy condition is TRUE' instead of 'Sell', a copy-paste error
- TradeCheck function case 2 (sell) is never reachable because the passed parameter is -1 not 2
- Fixed lot sizing with no dynamic adjustment based on account equity or volatility
- Stop-loss of only 15 points is extremely tight and prone to being stopped out in volatile markets
- OnTrade function's StringFind return value check is incorrect - should compare with -1, not use as boolean
Possible improvements
- Fix CheckTrend return type to int, fix TradeCheck sell branch case value from 2 to -1, and correct all copy-paste errors
- Add dynamic position sizing based on ATR or account risk percentage, and implement maximum drawdown protection and maximum position limits
- Add spread filter and slippage protection to avoid entering trades in high-spread environments, and add new bar detection to prevent duplicate trades on the same bar
Risk assessment
Overall risk: High risk
- CheckTrend returns int but is declared as bool, potentially causing trend detection failure or undefined behavior
- TradeCheck's sell branch (case 2) is unreachable, so sell signals will never actually place orders
- Fixed 15-point stop-loss is too tight and easily triggered by normal market noise
- No spread filter means entering during high-spread conditions significantly increases trading costs
- No new bar check means duplicate trade requests could be sent on the same bar
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
ExtDepth | 12 | ZigZag indicator depth parameter |
ExtDeviation | 5 | ZigZag deviation parameter |
ExtBackStep | 3 | ZigZag backstep parameter |
TradeValue | 1 | Trading lot size |
StopLossLevel | 15 | Stop loss distance in points |
TakeProfitAt | 0.2 | Take profit at Fibonacci extension multiple |
SafetyBuffer | 1 | Safety buffer from bar close to Fibonacci level (points) |
TrendPrecision | -5 | Distance threshold between current and previous high/low |
CloseBarPause | 5 | Minimum bar interval between close and next trade |
LevelColor | clrBlack | Fibonacci level line color |
Similar Mean Reversion EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.