Minibull algorithmic signal engine sp500 ea
- Experts
-
Yusuf Levent Aksun
logicalbullverify83bd38bf - Version: 2.2
- Activations: 5
# MiniBull Algorithmic Signal Engine
**A multi-timeframe trend + confirmation trading system for MetaTrader 5, verified on SPX500 with real backtest and forward-test data.**
Available as both a signal-only **indicator** (draws arrows, never trades) and a fully automated **Expert Advisor** (places real orders) — both share the exact same underlying signal logic, so what you see on the chart is what the EA acts on.
---
## How It Works
The system runs a four-stage pipeline on every closed H4 bar, regardless of which chart timeframe you attach it to:
### 1. Signal Scoring (7 timeframes)
Seven timeframes — M1, M5, M15, M30, H1, H4, D1 — are each scored independently on:
- **4 moving averages:** SMA(5), SMA(20), EMA(21), EMA(50), each compared against price (±1 point)
- **6 oscillators:** RSI(14), MACD(12,26,9), Stochastic(14,3,1), CCI(20), Williams %R(14), Momentum(10), each ±1 point
Each timeframe's score (−10 to +10) is bucketed into one of five classes (Strong Sell / Sell / Neutral / Buy / Strong Buy), then combined into a single weighted composite using fixed weights that favor the higher timeframes (M1: 5%, M5: 8%, M15: 12%, M30: 12%, H1: 18%, H4: 25%, D1: 30%).
### 2. Volatility-Adaptive Trend Filter (VAMA)
An H4 moving average whose period is not fixed — it shortens automatically during high volatility (more reactive) and lengthens during calm markets (less noise), based on where current ATR sits within its own recent history. This sets the dominant trend direction the composite signal must agree with.
### 3. M15 + H1 Confirmation
Both the M15 and H1 timeframes must independently agree with the VAMA direction before a signal is accepted. There is no partial confirmation — if either timeframe disagrees, or if either timeframe's data isn't available, the signal is rejected. This is a deliberate, strict design choice that mirrors the original strategy exactly rather than loosening it for more signals.
### 4. Trade Execution (EA only)
Once a signal clears all three filters, the EA opens a position with:
- Stop-loss and take-profit set as ATR multiples (independently configurable)
- Position size calculated from a percentage of account equity at risk (not a flat lot size)
- Optional daily trade count and consecutive-loss limits
---
## Two Modes, One Engine
| | **Faithful Mode** | **Flexible Mode (default)** |
|---|---|---|
| Lot sizing | Fixed 0.02 lot | % of equity risked per trade (configurable) |
| Stop-loss / take-profit | Fixed 1:1 ATR | Independently configurable ATR multiples |
| Re-entry | Only on a direction change | Optional — can re-enter once a prior trade closes |
| Purpose | Exact replica of the original signal-generation script | Tunable for your own risk tolerance and account size |
Switching between them is a single input (`InpFaithfulMode`) — no other settings change.
---
## Key Features
- **Risk-based position sizing.** Lot size is calculated from the stop-loss distance and a percentage of account equity, so it scales automatically with your balance instead of using a flat number regardless of account size.
- **Independently configurable risk:reward.** Stop-loss and take-profit are each set as their own ATR multiple — defaults are tuned to a 1:2.5 reward:risk ratio on SPX500, but every value is exposed as an input.
- **Live on-chart panel.** Shows running trade count, win/loss breakdown, win rate, real P/L (from actual closed deals, not an estimate), and how long the current signal direction has been held.
- **One-click Trading ON/OFF button.** Pause new trade entries instantly without removing the EA from the chart — any already-open position continues to run and resolve normally via its own stop-loss/take-profit.
- **Spread protection that scales correctly across instruments.** The maximum-spread filter is expressed as a percentage of price, not a fixed point count — this matters because "points" mean wildly different things across symbols (an index's normal spread in points can be 10x a forex pair's, even at a comparable real cost). A percentage threshold protects every instrument fairly.
- **Built-in optimizer scoring.** A custom `OnTester()` function combines profit factor, net profit, and drawdown into a single score for MetaTrader's Strategy Tester optimizer, and automatically rejects any parameter set with too few trades to be statistically meaningful — so the optimizer can't be fooled by a lucky small sample.
- **Full diagnostic breakdown.** An optional verbose logging mode reports exactly how many bars were rejected at each stage (no signal, failed trend filter, failed confirmation, blocked by risk limits, order-send failures) so a "zero trades" result is never a mystery.
---
## Verified Performance — SPX500
All figures below come from actual MetaTrader 5 Strategy Tester reports (every tick, real tick data), not an approximation.
| Metric | Backtest (2024.04 – 2025.10) | Forward / out-of-sample (2025.10 – 2026.07) |
|---|---|---|
| Net Profit | +$5,180 | +$7,656 |
| Profit Factor | 1.28 | 1.78 |
| Sharpe Ratio | 1.87 | 3.14 |
| Total Trades | 56 | 32 |
| Max Drawdown | 7.9% | 7.0% |
**Combined period (2024.04.03 – 2026.07.29):** 88 trades, +$12,836 net profit, starting from a $50,000 account, with a maximum drawdown of $4,078 (7.9%) — and the account recovered from every drawdown period to reach a new equity high, including through two multi-month drawdown stretches.
Every default parameter (VAMA period range, confirmation MA period, take-profit multiple) was chosen because it performed consistently on **both** the backtest and the out-of-sample forward window — not because it scored highest on the backtest alone. Several higher-scoring backtest-only combinations were deliberately rejected during tuning because their forward performance collapsed, a clear sign of curve-fitting.
---
## Important Notes & Limitations
- **This parameter set is tuned specifically for SPX500.** Testing on other instruments (NAS100, US30) with the same default settings produced inconsistent or losing results in at least one of the two test windows — a different instrument's price behavior requires its own optimization pass. Don't assume these defaults transfer to other symbols.
- **Broker-dependent.** All testing was performed against one broker's SPX500 price feed. A different broker's equivalent symbol (however named — US500, US500Cash, SPX500m, etc.) may have different spread, tick value, or price behavior. Test on your own broker's demo account before going live.
- **Past performance does not guarantee future results.** Backtest and forward-test results are historical simulations, not a promise of future profitability.
- **Test on a demo account first.** The EA places real market orders. Confirm behavior on a demo account before considering live use.
- **Chart timeframe doesn't affect signal logic** — the system always scans H4 internally regardless of which timeframe chart you attach it to. Attaching to H4 or H1 is recommended for the clearest visual match between the chart and the on-chart panel/log.
---
## Inputs Overview
The EA exposes 29 inputs, organized into seven groups:
1. **Mode** — Faithful vs. Flexible
2. **Signal Detection** — ATR period, VAMA min/max period, VAMA smoothing, confirmation MA period
3. **Trade Sizing** — risk %, fixed lot fallback, SL/TP multipliers, re-entry toggle
4. **Risk Limits** — max trades/day, max consecutive losses
5. **Order Settings** — magic number, slippage, max spread %
6. **Optimization** — minimum trade count for the optimizer's custom score
7. **Display & Logging** — on-chart panel, CSV trade log, verbose diagnostic logging
Every input includes an inline description explaining what it does and, where relevant, why its default value was chosen.
---
## Requirements
- MetaTrader 5
- A symbol with H4, H1, M15 (and lower) price history available from your broker
- Recommended: demo account for initial testing

