Hybrid SuBoChi EA
- Experts
-
Ahmad Farris Bin Jesry
Full-time trader, Grab driver, and freelance coder.
Driving while trading live markets taught me to keep charts clean. You don't need complicated setups.
You just need clear signals and proper market regime detection - Versão: 1.69
Hybrid SuBoChi is a standalone Expert Advisor that runs five independently configurable strategies from one chart. It combines SuBoChi direction with multi-timeframe analysis, breakout and retest checks, candlestick confirmation, and strategy-specific position management. The on-chart dashboard shows how many setups each strategy found, why entries were declined, and how positions closed.
The EA requires an MT5 hedging account. It compiles with the standard MQL5 trade library. Custom indicator files and separate custom .mqh files are unnecessary.
Strategy logic
Each strategy has its own magic number, position rules, and exit settings. This lets the EA manage a single entry, a grid basket, and a breakout trade independently on the same symbol.
| Strategy | How it enters | How it manages the position |
|---|---|---|
| S1 Single Entry | Opens a directional position after the shared entry checks pass. | Uses an ATR-based initial stop and a configurable profit ladder with up to 11 levels. |
| S2 Grid & Basket | Starts with a confirmed directional setup. Additional layers use an ATR-based distance from the latest layer. S2 is disabled by default. | Supports fixed or multiplied lot sizing, a lot cap, a weighted-average basket price, an optional shared basket stop, and staged basket targets. |
| S3 Signal Re-Entry | Looks for a fresh setup under its re-entry policy. It checks Geometric direction, Trend Slope alignment, and a closed-bar cross in that order. | Uses an optional ATR stop and a selectable ATR target. The signal-cycle policy and re-entry limit control repeated entries. |
| S4 RSI Scalper | Its native trigger is a closed-bar RSI crossover. The default period is 14 and the crossover level is 50. | Uses an ATR stop, a fixed target of 100 broker points, and separate point-based early profit-lock settings. |
| S5 Breakout Retest | Tracks a breakout level and waits for a retest. The default lookback is 20 bars and the setup expires after 10 bars. | Stores the breakout level and its ATR reference. Stop and target distances are ATR-based. |
Multi-timeframe entry and market structure
Multi-timeframe mode scans M5, M15, M30, H1, and H4 from one chart. In v1.58, M15, M30, H1, and H4 are enabled by default. Each setup is evaluated in its own timeframe, and that timeframe appears in its order comment. For example, an EA attached to M15 can open an H1 setup and record it as S3_Re-Entry_H1 .
SuBoChi supplies the primary direction. Where the strategy supports it, Trend Slope can supply a candidate direction when SuBoChi is neutral. The candidate still has to pass the applicable market score, timeframe, and price-structure checks. The volatility filter reports trend or flat conditions, and Trend Slope uses default fast and slow periods of 30 and 60.
The structure gate looks for a fresh breakout or a confirmed retest. It can wait when the setup was already used, the level fails to hold, or the price has moved too far from the entry area. The default maximum entry distance is 0.50 ATR, and the default shared retest tolerance is 0.30 ATR. A trend can remain intact while the EA waits for a fresh setup closer to the relevant level.
For S3, the sequence is Geometric → Trend Slope → closed-bar cross. The last check uses an 8/3/3 calculation with 20/80 zones. A BUY requires an upward cross after the preceding candle reaches the lower zone. A SELL requires a downward cross after the preceding candle reaches the upper zone. Recent qualifying crosses are checked to suppress consecutive signals in the same direction.
Candlestick pattern confirmation
The retest logic recognises 16 closed-candle patterns. For example, a bullish engulfing candle can confirm a BUY retest if the breakout level still holds and price remains within the permitted entry distance. A fresh breakout has its own setup path. Candlestick patterns are used for entry confirmation, while position exits follow the strategy’s own management rules.
| Bullish pattern | Bearish pattern |
|---|---|
| Bullish Engulfing | Bearish Engulfing |
| Three White Soldiers | Three Black Crows |
| Piercing Line | Dark Cloud Cover |
| Morning Doji | Evening Doji |
| Morning Star | Evening Star |
| Bullish Harami | Bearish Harami |
| Bullish Meeting Lines | Bearish Meeting Lines |
| Hammer | Hanging Man |
Stops, profit locks, and reversal protection
- Timeframe-specific ATR. Applicable risk distances use ATR from the setup timeframe. The EA stores an ATR reference for position management. The default risk ATR scale for applicable distances on new entries is 0.50.
- Early profit lock. The default ATR-based trigger is 0.50 ATR, with a lock of 0.15 ATR. S4 uses a 50-point trigger and a 20-point lock by default. The EA moves an existing stop only in the trade’s favour.
- Broker stop handling. The EA checks stop distances and rate-limits protection requests. If a stop update is rejected and the optional profit-close path is enabled, it can attempt a market close when the estimated net result meets the profit condition. The final result depends on the execution price and trading costs.
- Reversal protection. Two opposing closed SuBoChi candles can arm reversal protection. A fresh opposing RIEZX Trailing Stop change can then permit a close. Three opposing Trend Slope candles generate a warning. The EA verifies closure before clearing its reversal state.
- Recovery, news, and sideways conditions. Strategy-level recovery uses configurable ATR targets and protection levels. CHOP can block new entries during sideways conditions. The economic calendar filter can pause entries around configured events and can block new entries if calendar data is unavailable.
- Daily drawdown. The account dashboard displays daily drawdown and a configurable warning threshold. This gauge is for monitoring.
Hedging accounts and execution modes
The EA checks the account type at startup and stops initialization on netting accounts. On a hedging account, S1–S5 can hold separate positions on the same symbol. BUY and SELL positions can coexist when each side has a qualifying setup. An open position moving into a loss does not trigger an automatic hedge order.
Standard Mode executes in the confirmed setup direction. Reverse Mode validates the setup first, then sends the order in the opposite direction and recalculates the applicable initial stop and target for that side.
| Confirmed setup | Standard Mode | Reverse Mode |
|---|---|---|
| BUY | Opens BUY | Opens SELL |
| SELL | Opens SELL | Opens BUY |
To run both modes on the same account and symbol, attach the EA to two charts and give them separate InpBaseMagic ranges. Strategy identifiers are derived from InpBaseMagic + 1 through InpBaseMagic + 5 .
| Instance | InpEntryExecutionMode | InpBaseMagic | S1–S5 magic numbers |
|---|---|---|---|
| Chart 1 | STANDARD_MODE | 26112300 | 26112301 –`26112305` |
| Chart 2 | REVERSE_MODE | 26112400 | 26112401 –`26112405` |
Both instances can trade in opposite directions when the same setup passes on both charts. They evaluate their position limits and execution conditions independently, so one order can open later or only one instance may qualify. If Standard already has open trades, keep its existing magic range and assign a separate range to Reverse.
Dashboard and trade logs
I use the Account view to check balance, equity, floating P/L, daily drawdown, and upcoming news. The S1–S5 view is where I look when a strategy goes quiet or takes a trade I want to review.
For each strategy, the dashboard shows how many setups the EA found, how many became trades, and why entries were declined. That helps distinguish a setup that failed a signal check from one that reached the order stage but ran into a margin, stop-distance, or execution issue.
When a position closes, the dashboard records what closed it. A stop hit can be a loss, a breakeven exit, or a profitable exit after the stop moved. Take-profit, EA-initiated exits, manual closes, and stop-outs are recorded separately. The same view shows session and historical results by strategy, including net P/L, wins and losses, profit factor, and drawdown where applicable.
Entry-related logs and order comments identify the strategy and the actual setup timeframe. Examples include S1_Single_M15 , S2_Grid_M30 , S3_Re-Entry_H1 , S4_Scalper_M5 , and S5_Breakout_H4 . The EA can also draw trade levels and markers and send optional MT5 push notifications.
VPS recommendation
VPS with 2 vCPU cores and 2 GB of RAM is recommended as a starting point for one terminal. Resource usage with both modes running has yet to be benchmarked.
To run Standard Mode and Reverse Mode together, attach the EA to two charts on the same hedging account. Select one mode per chart and assign each instance a different InpBaseMagic .
On each chart, go to Expert Advisors → Properties → Inputs and find InpBaseMagic under v1.58 | Strategy Identity. For example, use 26112300 for Standard Mode and 26112400 for Reverse Mode.
| When | Work performed |
|---|---|
| On each tick | Checks open positions, profit locks, recovery, news, and CHOP. It also calls the signal calculation for each configured timeframe context. |
| When a candle closes | Recalculates Trailing Stop and RideTheTrend for the relevant context. With default settings and sufficient history, RideTheTrend can read up to 3,000 bars per context. Several timeframe closes can coincide. |
| During dashboard updates | A 5-second timer refreshes news, CHOP, and dashboard information. The S1–S5 view refreshes at most once every 2 seconds while visible. |
| During entry and protection checks | Logs setup decisions, rejects, fills, and protection events. The repetitive SuBoChi DEBUG output was removed. |
For a lighter chart, set InpRIEZXDrawIndicators=false . This disables the indicator drawings while keeping their calculations active. The dashboard can stay enabled during forward testing.
InpTradeM5=false disables new M5 entries. Some M5 calculations still run because the timeframe is processed before the entry eligibility check. The number of enabled entry timeframes therefore tells only part of the story when estimating VPS load.
Development history
| Version or stage | Main changes |
|---|---|
| v1.00 and early development | The project started with SuBoChi as its core directional concept. Later development split execution into strategies with their own entry, risk, and exit rules. |
| v1.34–v1.40 | Removed the BrainTrade entry and exit module, introduced the S4 RSI scalper, and developed shared volatility and Trend Slope checks. |
| v1.41–v1.48 | Moved to standalone builds and brought strategy statistics into the dashboard. Work in this stage also covered repeated debug output, reversal confirmation, retest expiry, and visibility into declined setups. |
| v1.49–v1.52 | Expanded multi-timeframe execution, tied risk ATR to the setup timeframe, improved order identification, and added earlier profit locking across strategies. |
| v1.53–v1.54 | Introduced Standard and Reverse execution modes and developed the structure, retest, and ATR-distance checks for entry. |
| v1.55 | Added closed-bar Geometric direction confirmation ahead of the Trend Slope check. |
| v1.56 | Expanded candlestick retest confirmation to all 16 patterns listed above. |
| v1.57 | Added the S3 closed-bar cross after Geometric and Trend Slope and updated the S3 entry label. |
| v1.58 | Applied strategy-name and setup-timeframe labels to entry-related logs and order comments across S1–S5. |
Installation
- Save Hybrid_SuBoChi_EA_v1.58_Standalone.mq5 in MQL5/Experts and compile it in MetaEditor.
- Attach the EA to a chart on an MT5 hedging account.
- Select the strategies and timeframes you want to evaluate. Set InpEntryExecutionMode and InpBaseMagic for each instance.
- For a VPS installation using the compiled build, place the .ex5 in MQL5/Experts .
Credits
The candlestick pattern families were adapted from the MetaQuotes CandlePatterns example. The Geometric confirmation was adapted from Geometric Signal Validator by phade. MetaQuotes CandlePatterns example · Geometric Signal Validator
