FlowmaskEA
- Experts
- Version: 1.10
Overview
Flowmask EA is a single-pair, single-timeframe expert advisor built around cumulative volume delta (CVD) divergence. It detects when price makes a new swing high or low that the underlying volume flow does not confirm, and optionally requires or rewards an absorption bar (high volume, compressed range) as extra confluence before entering. Position sizing and risk are handled entirely in percentage terms, with a real broker-side stop loss on every trade.
How It Works
- On every closed bar, the EA reconstructs a cumulative volume delta series from tick volume and candle direction.
- It scans for fractal swing highs/lows in price and compares the two most recent matching swings against the CVD series.
- A bearish divergence (higher price high, lower CVD high) triggers a sell signal; a bullish divergence (lower price low, higher CVD low) triggers a buy signal.
- The bar that triggers the signal is checked for absorption (volume spike with compressed range versus ATR). Depending on settings, absorption is either mandatory or grants a position-size bonus.
- Position size is calculated from account equity and ATR-based stop distance so that every trade risks the same percentage of equity.
- A protective stop loss is placed on every trade at trade open, clamped to the broker's freeze/stop level and current spread.
- Once floating profit reaches an activation threshold (percentage of trade-entry balance), a ratcheting profit lock arms and trails upward only, closing the full position if profit pulls back below the current threshold. All of this is evaluated once per closed bar, never intrabar.
Inputs
General
- Magic_Number: unique identifier used to tag and track this EA's trades
CVD Divergence
- CVD_LookbackBars: number of historical bars scanned for swing pivots
- CVD_SwingLookback: number of bars on each side required to confirm a fractal swing
- CVD_MaxPivotAge: maximum bar distance allowed between the two compared swing pivots
- CVD_PivotFreshnessBars: how recent the latest swing pivot must be to still trigger a signal
Absorption
- Require_Absorption: if enabled, absorption becomes a mandatory entry filter instead of a size bonus
- Absorption_VolMAPeriod: lookback period for the volume moving average used to detect a volume spike
- Absorption_VolMult: multiple of average volume a bar's volume must exceed to qualify as absorption
- Absorption_RangeATRMult: maximum bar range (as a multiple of ATR) allowed for an absorption bar
- Absorption_SizeBonusMult: lot size multiplier applied when absorption confirms a divergence signal
Risk
- Risk_PctPerTrade: percentage of account equity risked per trade
- Risk_ATR_Period: ATR period used for stop distance and position sizing
- Risk_ATR_Multiple: stop loss distance expressed as a multiple of ATR
Profit Ladder
- Profit_ActivationPct: floating profit percentage of trade-entry balance that arms the profit lock
- Profit_TrailStepPct: ratchet step size the profit lock trails by as profit grows
Optimizer Score
- Score_MinProfitFactor: minimum profit factor required for an optimization run to qualify
- Score_MaxDrawdownPct: maximum drawdown percentage allowed for an optimization run to qualify
- Score_MinTrades: minimum number of trades required for an optimization run to qualify
- Score_R2Weight: weight applied to equity curve smoothness (R-squared) in the score
- Score_SlopeWeight: weight applied to normalized equity curve slope (profit speed) in the score
- Score_SplitPenalty: penalty weight for divergence between first-half and second-half R-squared
- Score_SkewPenalty: penalty weight for profit concentration in a single trade
- Score_UlcerPenalty: penalty weight for drawdown depth and duration (Ulcer Index)
- Score_MARWeight: weight applied to the MAR ratio (return over max drawdown) in the score
- Score_TradeBonusWeight: weight applied to a diminishing-returns bonus for trade count
Dashboard
- Dashboard_Show: enables or disables the on-chart performance dashboard
Optimizer Scoring System
Flowmask EA includes a custom OnTester scoring function designed to reward robust, tradable equity curves instead of curve-fitted spikes. Any optimization run with negative profit, a profit factor below the minimum, drawdown above the maximum, or too few trades is automatically disqualified and scored zero. Remaining runs are ranked on a weighted combination of equity curve smoothness, profit speed, and capital efficiency, minus penalties for temporal instability, single-trade profit concentration, and drawdown pain. Set the Optimizer Criterion to Custom max before running an optimization.
Recommended Setup
Test on a liquid major pair on the H1 timeframe. Use "1 Minute OHLC" modeling for optimization speed; results are consistent with tick-based tests since all logic is evaluated at bar close only.
Screenshots
Recommended .set files are attached in the comments section below.
Disclaimer
Past performance shown in backtests does not guarantee future results. Always test on a demo account before live use. Trading forex and CFDs carries a high level of risk and may not be suitable for all investors.
