Neurotest
A simple feedforward neural network EA for MetaTrader 5 that uses a single hidden layer with ReLU activation to predict price direction from OHLCV data. It trains online during backtesting via momentum-based gradient descent, and opens buy/sell trades when the sigmoid output exceeds 0.6 or falls below 0.4 respectively. Risk management includes ATR-based dynamic stop loss, daily and total drawdown limits, and spread filtering.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
Not backtested yet — this EA could not be converted automatically.
Strategy analysis
The EA's strategy concept employs a simple 3-layer feedforward neural network (5 inputs, configurable hidden layer, 1 output) to learn price movement patterns from historical OHLCV candle data. Entry conditions are: buy when the sigmoid output exceeds 0.6, sell when it falls below 0.4, and no trade when between 0.4-0.6. Exit conditions rely on ATR-based dynamic stop loss and a 2:1 risk-reward take profit ratio, with no trailing stop or signal-based position closing logic. Position sizing is calculated from account equity and maximum risk percentage per trade, normalized to broker lot constraints including minimum/maximum lot and lot step. Money management enforces hard daily loss limit of 5% and total loss limit of 10%, with a penalty mechanism that reduces the learning rate when daily profit falls below the 1% target. However, the normalization logic has a critical flaw—computing min-max from a single sample forces all inputs to zero, and there is no check for existing positions in the same direction, which can lead to repeated trade entries on every tick.
Strengths
- Implements neural network-based adaptive trading signal generation, conceptually innovative
- Has a complete money management framework with daily/total drawdown limits and dynamic stop loss
- Uses ATR-based dynamic stop loss to adapt to market volatility with a reasonable 1:2 risk-reward ratio
- Model parameters can be persisted, allowing the EA to reuse trained weights after restart
- Includes spread filter to avoid entering trades in high-spread environments
Weaknesses
- Normalization logic is critically broken—computing min-max from a single sample normalizes all inputs to zero, making the network unable to learn effectively
- No existing position check, potentially opening repeated trades every tick, leading to uncontrolled position accumulation
- No new bar check means trading logic triggers every tick, causing redundant computation and potential duplicate orders
- Network architecture is overly simplistic (5 raw price inputs + single hidden layer with 5 neurons), insufficient to capture meaningful market patterns
- ATR indicator handle is created in GetDynamicStopLoss on every call without being released, causing resource leaks
- Training uses raw price levels instead of differenced data or returns, lacking stationarity which hinders network generalization
Possible improvements
- Fix normalization logic—use dataset-wide statistics (mean/std or global min-max) computed before training, and use differenced data or log returns instead of raw prices
- Add position existence check and new bar check to prevent repeated entries and unnecessary per-tick computation; move ATR handle creation to OnInit and release in OnDeinit
- Add validation set and early stopping to prevent overfitting; consider implementing a more robust optimizer (e.g., Adam) and more thoughtful network architecture design
Risk assessment
Overall risk: High risk
- No position check allows repeated trade entries every tick, leading to uncontrolled position accumulation
- Broken normalization logic makes neural network output meaningless, rendering trading decisions essentially random
- ATR handle resource leak may exhaust indicator handles during extended operation
- Training on raw prices instead of stationary series may cause the network to overfit to specific price levels
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
MaxRiskPerTrade | 1.0 | Maximum risk percentage per trade |
DailyLossLimit | 5.0 | Maximum daily loss percentage |
TotalLossLimit | 10.0 | Maximum total loss percentage |
MagicNumber | 12345 | EA identifier to distinguish orders |
EnableLogging | true | Enable verbose logging |
InitialLearningRate | 0.01 | Neural network initial learning rate |
HiddenLayerSize | 5 | Hidden layer neuron count |
MaxEpochs | 1 | Max training epochs per tick |
ModelFileName | neural_network.dat | Model save/load filename |
ATRPeriod | 14 | ATR period for dynamic stop loss |
MaxSpread | 20.0 | Maximum allowed spread in points |
Similar Machine Learning EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.