Whale Speed Volatility Divergence
- Experts
- Mustafa Ozkurkcu
- 버전: 1.0
This EA looks for a two-layer momentum/liquidity breakout:
Divergence detection (trigger):
-
TPS (ticks-per-second / bar tick_volume ) must be high vs. its recent average ( TPS_Multiplier ),
-
while Volatility (bar high–low) must be low vs. its recent average ( Volatility_Multiplier ).
This combo flags “flow in a quiet range” → a likely near-term breakout.
Direction & filter:
-
If the signal bar is green ( close > open ) → consider BUY; if red → SELL.
-
Optional MA trend filter ( Use_TrendFilter ): bar above MA → BUY allowed; below MA → SELL allowed.
Order parameters:
-
SL = signal bar low (BUY) or high (SELL).
-
TP = SL × TakeProfit_Multiplier (risk/reward multiple).
-
Position size is computed from RiskPercentage . If margin is insufficient, size is reduced iteratively ( Reduce_On_Margin_Or_Limit , Open_Retry_* ).
Execution safeguards (broker realities):
-
Before placing orders, check spread, stop/freeze levels, tick size, and a latency buffer.
-
For SL modifications, use throttle, skip when too close to freeze, pre-modify tick refresh, and slack pips to reduce “close to market” rejections.
-
On open/modify failures, apply cooldowns to avoid spammy logs and needless retries.
Trailing stop engine:
-
As price moves in favor, move SL forward by a pip distance ( TrailingStop_Pips ),
-
enforcing a minimum step each modify ( Trailing_Min_Step_Pips ) and honoring stop/freeze + buffer distances.
Data/warmup & tester compatibility:
-
If there aren’t enough bars, the EA waits ( Require_History_Warmup ) or falls back to another timeframe.
-
In the tester, TPS can be emulated from tick_volume ( Use_TickVolume_Emulation ) and signals can be fixed to bar[1] ( Use_Closed_Bar ) for stable/reproducible backtests.
OnTimer (every 1s): Real-time TPS counter → tps_history[] ; average of last 5 bars’ high–low → vol_history[] .
OnTick:
-
Warmup & symbol/TF ready? If not, wait or use fallback TF.
-
Compute TPS_now / TPS_avg and Vol_now / Vol_avg (emulated in tester).
-
Condition: TPS_now > TPS_avg × TPS_Multiplier AND Vol_now < Vol_avg × Volatility_Multiplier .
-
Bar color + optional MA filter set the direction.
-
Build SL/TP, compute size from risk, check spread & stop/freeze, run iterative margin fit → open order.
-
If a position is open, run trailing; before modify, refresh tick + apply slack to keep SL within safe limits.
Risk & Trade Controls
-
TakeProfit_Multiplier
Sets TP as a multiple of SL distance (RR). Example: 2.0 = 1:2 RR. -
Max_Spread_Pips
If current spread exceeds this, skip signals (avoid poor liquidity entries). -
InpMagicNumber
Magic number to tag the EA’s trades. In netting accounts, one position per symbol. -
RiskPercentage
% of balance risked per trade. Lot size is derived from this, SL distance, and tick value. -
TrailingStop_Pips
If enabled, SL trails price by this many pips (while honoring stop/freeze + buffers). -
Max_Lots_Per_Trade
Hard cap: even if the risk formula suggests more, size won’t exceed this. -
Reduce_On_Margin_Or_Limit
If opening fails due to margin/volume, shrink lot and retry. -
Open_Retry_Attempts
How many reduced-lot retries on open. -
Open_Retry_Factor
Each retry multiplies lot by this factor (e.g., 0.75 → reduce by 25%).
Trend Filter (MA)
-
Use_TrendFilter
When on, a BUY/SELL is only allowed if it aligns with the MA side. -
MA_Period, MA_Method, MA_Price
MA settings for the trend filter (SMA/EMA/WMA, close/HLC3, etc.).
Signal Logic (TPS & Vol)
-
TPS_Multiplier
Threshold for the “flow” side. Higher = more selective vs. average TPS. -
Volatility_Multiplier
Threshold for “quietness.” Lower = stricter requirement for low range. -
HistorySize
How many seconds/samples of TPS/Vol history to keep (1-second timer in live).
Backtest & Robustness
-
Use_TickVolume_Emulation
In tester, emulate TPS from bar tick_volume instead of real tick timing. -
Use_Closed_Bar
Compute signals on closed bars (bar[1]) → reduces repaint/look-ahead bias. -
TPS_Lookback_Bars / Vol_Lookback_Bars
Bar lookbacks for TPS/Vol averages (tester path).
Execution Safeguards
-
Modify_Throttle_Sec
Minimum seconds between SL modifications (reduces spam/rejects). -
Trailing_Min_Step_Pips
Minimum pip improvement required to move SL. -
Modify_Extra_Buffer_Pips
Extra buffer on top of broker stop and freeze levels. -
Enable_CloseToMarket_Backoff
On “close to market/invalid stops,” retry once with looser distance. -
Backoff_Extra_Pips
Extra distance used for that single retry. -
Freeze_Skip_Pips
If current SL is within freeze level + this buffer, skip modify (avoid rejects). -
Modify_Latency_Margin_Pips
Extra safety vs. live price jumps. -
Modify_Failure_Cooldown_Sec
Wait time after a failed modify before trying again. -
PreModify_Refetch_Tick
Refresh the tick just before modifying SL; recompute limits with current price. -
PreModify_Slack_Pips
Place SL a touch beyond the theoretical limit to reduce “close to market” errors. -
Open_Failure_Cooldown_Sec
If open fails (No money / volume limit), wait before retrying—cleaner logs, safer behavior.
Data & Warmup
-
Auto_Select_Symbol
Auto-select the symbol if not already visible. -
Require_History_Warmup
Don’t trade until enough bars are loaded. -
Auto_Find_Available_TF
If the main TF lacks data, auto-fallback to the first TF with data. -
Warmup_Min_Bars
Minimum bars required before starting. -
Fallback_Timeframe
Backup timeframe used when data is insufficient. -
Preload_Bars
How many bars to preload at startup.
-
Position sizing: dynamic lots from RiskPercentage and SL distance.
-
Margin fit: use OrderCalcMargin vs. free margin; if it doesn’t fit, iteratively shrink size.
-
Spread filter: skip entries when Max_Spread_Pips is exceeded.
-
Broker level guards: stop/freeze levels + extra buffers + latency margin.
-
Retry policy: only shrink-and-retry on volume/money errors; don’t insist on other rejects.
-
Cooldowns: on open/modify failures to avoid over-trading and excess risk.
-
Tune signal first ( TPS_Multiplier , Volatility_Multiplier , lookbacks), then polish execution (trailing + pre-modify slack).
-
Majors (EURUSD H1/M30): keep Max_Spread_Pips low; start PreModify_Slack_Pips around 0.4–0.8.
-
XAUUSD (D1/H1): large point size; widen TrailingStop_Pips , nudge up Modify_Latency_Margin_Pips and Backoff_Extra_Pips .
-
Scalp (M1/M5): begin with Use_Closed_Bar = true for stability; switching it off increases risk.
This EA/strategy:
-
Is not investment advice.
-
Does not guarantee profits; backtests/optimizations do not represent future performance.
-
Market conditions (news, liquidity drops, slippage, latency, broker limits) can negatively impact results.
-
Misconfiguration, low capital, high leverage, or unsuitable risk percentages can cause loss of capital.
-
Demo/forward test before going live; start RiskPercentage low (e.g., 0.1–0.5%) and scale gradually.
-
Stop/freeze levels and contract specs vary by broker—verify your broker’s conditions before using aggressive parameters.

This could be great but a lack of proven sets AND control of LS is very dangerous.
On M5 this EA took a trade with LS 2. (TWO!?!?!) despite risk % set at 0.1% of balance.
Trade ended up at -330.
This will kill accounts.
Author can improve this EA with proven sets.