Neural Network Swing Scalper Price Action
- Experts
- Domantas Juodenis
- 버전: 1.0
- 활성화: 20
The first MT5 Expert Advisor built on a genuine feedforward neural network — not a scoring system, not a rule engine, not a marketing label. Real neuron math. Real probability output. Real trading intelligence.
What Makes NNSSP-AI Different?
Every "AI" EA on the market hides the same thing under impressive branding — a hand-coded checklist that adds up indicator scores and calls it artificial intelligence. NNSSP-AI is different at the source code level.
It runs a true feedforward neural network on every bar:
- 20 normalised market inputs fed into the network
- 16 hidden neurons with ReLU activation — each one trained to detect a specific market condition
- 8 second-layer neurons combining those conditions into higher-order signals
- 2 output neurons with Softmax activation producing real probabilities — p_buy and p_sell — that always sum to 1.0
The network does not add weighted scores. It performs matrix multiplication, applies non-linear activation functions, and produces a mathematically valid probability. A p_buy of 0.84 means the network is 84% confident in a bullish trade on this bar. That is not a score — it is inference.
Three Genuinely Separate Trading Modes
NNSSP-AI operates in three modes that are structurally different — not cosmetically renamed versions of the same logic. Each mode uses a completely different timeframe triple. The neural network sees different candles, different data, different market context.
🌊 Neural Swing
Read the higher timeframe. Trade the institutional move.
- Bar clock fires on H1 candle close only
- Indicators computed on H1 / H4 / D1
- Minimum 4 hours between trades
- Maximum 3 trades per session
- SL: 1.8× ATR | TP: 3.5× ATR
Swing mode is deliberately patient. It waits for a full H1 candle to confirm the signal, checks H4 for directional alignment, and reads D1 trend bias before committing. The neural network in this mode weights market structure, BOS/ChoCH detection, and HTF bias most heavily — filtering out the noise that traps short-term traders.
⚡ Neural Scalp
Read momentum. Strike fast. Control risk precisely.
- Bar clock fires on M5 candle close
- Indicators computed on M5 / M15 / H1
- Minimum 20 minutes between trades
- Maximum 6 trades per session
- SL: 1.0× ATR | TP: 2.0× ATR
Scalp mode reads fast data. MACD crossovers, Stochastic signals, and RSI momentum are weighted highest in this mode's neural weight matrix. The 20-minute minimum gap prevents signal spam while still capturing multiple opportunities during high-momentum London and New York sessions.
🕯️ Neural Price Action
Read structure. Trade institutional levels. Confirm with candles.
- Bar clock fires on M15 candle close
- Indicators computed on M15 / H1 / H4
- Minimum 1 hour between trades
- Maximum 4 trades per session
- SL: 1.3× ATR | TP: 2.8× ATR
PA mode is built around one idea: price returns to where institutions traded. Order Block proximity and Fair Value Gap detection receive the highest weights in the PA neural matrix. The network looks for price returning to an unmitigated zone after a structural break — the cleanest, highest-probability setup in price action trading.
Smart Market Structure Engine
Regardless of mode, NNSSP-AI continuously maps the market for structural features that feed the neural network's 20 input neurons.
Break of Structure (BOS) & Change of Character (ChoCH) — Detected automatically on every bar. A ChoCH — price breaking a swing extreme against the prevailing trend — is classified separately from a BOS and receives a stronger neural signal, reflecting its higher significance as a potential reversal event.
Order Block Detection — The last aggressive candle before an impulsive move. Scored by proximity: 1.0 if price is inside the zone, 0.75 within 2 ATR, 0.50 within 5 ATR. Continuous proximity scores feed directly into the neural network — not a binary "in zone or not."
Fair Value Gap Detection — Three-candle price imbalances where the market moved without balanced two-sided trading. Up to 30 active FVG zones tracked simultaneously, each scored by proximity and fed to the neural network.
Liquidity Zone Mapping — Significant swing highs and lows marked as active or swept. Active liquidity pools near current price inform the neural network's structural bias inputs.
Multi-Timeframe Structure — All three mode timeframes are independently classified as bullish (HH/HL pattern), bearish (LL/LH pattern), or ranging. Three separate structure readings feed inputs x[11], x[12], x[13] — giving the neural network a complete picture of trend quality across timeframes.
Professional Risk Management
Five Risk Sizing Methods
Choose the approach that fits your trading style:
| Mode | How Lots Are Calculated |
|---|---|
| % of Balance | Risk a fixed percentage of account balance per trade |
| % of Equity | Risk a fixed percentage of live equity per trade |
| Fixed Lot | Every trade uses the same lot size |
| Fixed $ Risk | Every trade risks a fixed monetary amount |
| Auto R:R | Lot sized automatically to target a specific risk:reward ratio |
Three-Layer Order Validation
Every order passes three checks before reaching the broker:
- Stop Level Validation — SL and TP are automatically expanded if too close to price for the broker's minimum stop distance requirement. Eliminates [Invalid stops] errors.
- Volume Validation — SYMBOL_VOLUME_LIMIT, per-order ceiling, total exposure cap, and lot step rounding applied in sequence. Eliminates [Volume limit reached] errors.
- Margin Gate — OrderCalcMargin() called at the exact moment of order placement. If required margin exceeds 90% of free margin, the order is skipped cleanly. Eliminates [No money] errors on any symbol at any account size.
Intelligent Account Detection
NNSSP-AI reads ACCOUNT_MARGIN_MODE on every bar. On a netting account — where multiple entries stack into one net position and rapidly hit broker limits — the EA automatically restricts to one open position per symbol. On a hedging account, the configurable MaxOpenTrades limit applies. No configuration required — the EA detects and adapts.
Session-Based Trade Limits
Limits reset per trading session — not per day. Sessions are detected automatically from broker server time (Asian 00:00–07:00, London 07:00–13:00, New York 13:00–22:00 GMT). A Scalp trader gets 6 fresh trades in London and 6 in New York. Swing mode gets 3 per session — reflecting the patience that higher timeframe trading demands.
Additional Safeguards
- Daily and total equity drawdown limits — trading halts automatically
- Consecutive loss cooldown — configurable pause after N losses in a row
- Minimum neural score threshold — only high-confidence signals execute
- Minimum confluence requirement — multiple independent conditions must agree
- News filter — MT5 Economic Calendar blocks entries before and after high-impact releases
- Maximum spread filter — entries blocked when market liquidity is poor
- Minimum R:R gate — every trade must meet the configured risk:reward ratio
Dynamic Trade Management
All management runs on the mode's bar clock — not on every tick — preventing the [Modification failed — close to market] broker rejections that plague poorly coded EAs.
Break-Even — SL moves to open price + buffer once trade reaches target ATR profit.
Trailing Stop — Activates at TrailStart × ATR in profit, steps in TrailStep × ATR increments, always validated against the broker's minimum stop distance.
Partial Close — 50% of the position is closed at the first TP level. The remainder runs to the full TP target.
Proximity Guard — All modifications are skipped when price is within the broker's stop level of the existing SL or TP. The position is allowed to close naturally without interference.
Interactive On-Chart Panel
Every parameter is adjustable live from the on-chart panel — no need to detach and reattach the EA to change settings.
The panel displays in real time:
- Neural Network Output — p_buy, p_sell, confidence score, and active neuron count with names
- Account — Balance, equity, free margin, margin level
- Statistics — Daily drawdown, spread, session trades used/remaining, open positions, risk mode, current session
- Risk Controls — Seven parameters with < and > adjustment buttons: Risk %, Max DD %, Max Trades, Open Positions, NN Score, Confluence, Min R:R
- Trade Controls — Five toggle buttons for Trail, Break-Even, Partial Close, News Filter, Session Filter
- EA Master Button — One click pauses or resumes all trading. Blue = active. Red = paused.
Panel position is fully configurable: inp_PanelX , inp_PanelY , and inp_PanelRight (left or right chart edge anchor).
In the Strategy Tester, panel buttons are disabled by MT5's design — configure values via the Inputs tab before running tests.
Professional Chart Aesthetic
When attached to any chart, NNSSP-AI applies a complete professional dark theme:
- Background — Deep navy #06 08 12
- Bull candles — Vivid sky blue #29B6F6
- Bear candles — Vivid red #EF4444
- Grid — Barely visible, eliminates visual noise
All detected zones are drawn directly on the chart:
- Blue/red rectangles — Bullish and bearish Fair Value Gaps
- Green/dark red rectangles — Bullish and bearish Order Blocks
- Dashed horizontal lines — Active liquidity levels
- Solid horizontal lines — BOS/ChoCH structural breaks
- Arrows — Entry signals at the exact execution bar
A large watermark reading NNSSP-AI sits behind the candles at the bottom-left — visible but never intrusive.
Replace Weights with Python-Trained Data
The pre-initialised weights encode decades of manual trading logic into the network's structure. For advanced users, they can be replaced with genuinely data-trained weights:
from sklearn.neural_network import MLPClassifier clf = MLPClassifier(hidden_layer_sizes=(16, 8), activation='relu') clf.fit(X_train, y_train) # Export — paste directly into the MQL5 weight arrays W1 = clf.coefs_[0] # (20, 16) W2 = clf.coefs_[1] # (16, 8) W3 = clf.coefs_[2] # (8, 2)
The architecture is identical to scikit-learn's output format. No reshaping. Recompile and test.
Technical Specifications
| Platform | MetaTrader 5 |
| Neural architecture | Feedforward, fully connected |
| Network | 20 → 16 (ReLU) → 8 (ReLU) → 2 (Softmax) |
| Parameters | 490 total (weights + biases) |
| Output | p_buy + p_sell = 1.0 (true probabilities) |
| Trading modes | Swing (H1), Scalp (M5), Price Action (M15) |
| Compatible symbols | Forex, Indices, Metals, Crypto — any symbol |
| Account types | Netting and Hedging — auto-detected |
| Risk methods | 5 (% Balance, % Equity, Fixed Lot, Fixed $, Auto R:R) |
| Zone detection | Order Blocks, Fair Value Gaps, Liquidity Zones, BOS/ChoCH |
| Trade management | Break-even, Trailing stop, Partial close, Duration exit |
| News filter | MT5 Economic Calendar — high-impact events |
| Multi-symbol | Yes — one instance per symbol, separate magic numbers |
Recommended Starting Settings
For testing — any major forex pair on H1:
- Mode: Neural Swing
- Risk: 1.0% balance
- Min Score: 62
- Min Confluence: 2
- Session filter: OFF
- News filter: OFF
- Max Lots Per Trade: 2.0
For live deployment:
- Start with 0.5% risk until you understand the signal frequency
- Enable the session filter to trade London and New York only
- Enable the news filter for major pairs
- Set MaxLotsPerTrade to your broker's per-order volume limit
NNSSP-AI v1.0 Neural Network Swing Scalp Price Action Intelligence Feedforward Neural Network 20→16→8→2 · ReLU Activation · Softmax Output · 490 Parameters
Risk Warning: Trading involves substantial risk of loss. Past backtesting performance does not guarantee future results. Always test on a demo account before deploying live capital.
