Mabuk Samudra MS
- Experts
- Rudi Rupian
- Versione: 3.0
- Attivazioni: 9
Mabuk Samudra V3 is a fully automated Expert Advisor for MetaTrader 5 that operates on a continuous tick-driven cycle. Every incoming tick triggers the following sequence in strict order.
1. Initialization & Safety Checks On startup, the EA loads symbol parameters, sets the magic number, configures trade deviation and order filling mode, and initialises RSI and CCI indicator handles. Persistent state — including maximum drawdown — is restored from global variables. A license and account lock check runs on every tick; if it fails, the EA halts immediately.
2. UI Refresh & Panel Sync The dashboard is redrawn each tick, displaying live account metrics (balance, equity, free margin, floating P/L, today's closed profit, maximum drawdown), spread, leverage, and indicator values. The lot size typed in the panel's edit box is synchronised into the EA's active lot variable on every tick.
3. Drawdown Tracking The EA continuously monitors total floating profit across all open positions. If the current floating loss is deeper than any previously recorded value, the maximum drawdown figure is updated.
4. Core Management Cycle (runs every tick, in order)
- DDR System — checks whether the combined profit of the oldest and newest open position of the same direction meets the configured gap target. If yes, both are closed simultaneously, reducing basket exposure without closing the entire grid.
- TP/SL Manager — calculates the volume-weighted average open price (BEP) across all positions of each direction, then sets or updates Take Profit and Stop Loss levels for every position accordingly. Single positions use their own TP/SL distances; averaging baskets use a separate BEP-based TP distance.
- Trailing Stop — once floating profit exceeds the configured start threshold, the Stop Loss of each position is moved progressively behind price, locking in gains while allowing the trade to run further.
5. Daily Limit Check After the core cycle, the EA evaluates total daily performance (closed deals + floating). If the profit target or loss limit for the day is reached, all positions are closed and all pending orders are deleted. The EA then skips further order activity for that tick.
6. Averaging / Martingale If an open position moves against entry, the EA places an additional order in the same direction at a configurable step distance from the last open price, using an increased lot size. Steps can follow either an auto-multiplied progression or a manually defined band table. This process repeats up to the configured maximum order count.
7. Pending Order Cleanup Outside the configured trading hours, or when a position already exists (non-hedging mode), any outstanding limit orders are deleted to prevent unintended new entries.
8. New Order Placement Before placing any order, the EA verifies: market is open, tick is fresh, spread is within limit, free margin is sufficient, and the configured trading hour window is active. Orders are sent with a 50-point deviation tolerance and a broker-adaptive filling mode (IOC preferred), with up to 3 automatic retries on retriable broker rejections.
