Advertisement IC Markets

Strategy Architecture: Bi-Directional Liquidity Sweep & House-Money Scaling

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
PTScalper
Site Admin
Posts: 7643
Joined: Mon Jul 20, 2026 1:28 pm

Strategy Architecture: Bi-Directional Liquidity Sweep & House-Money Scaling

Post by PTScalper »

Hi traders, scalpers,

i got idea about bi directional forex scalping strategy with exponencial money management, so lets deep dive and try to implement it.

This quantitative framework is engineered for continuous dual-directional market participation (simultaneous Buy and Sell operational readiness) paired with an asymmetric Two-Phase Series Exponential (Anti-Martingale) money management model. Designed for major spot pairs (EUR/USD, GBP/USD) and precious metals (XAU/USD) on low-latency ECN execution.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Recommended broker for automated trading & scalping IC Markets
PTScalper
Site Admin
Posts: 7643
Joined: Mon Jul 20, 2026 1:28 pm

Re: Strategy Architecture: Bi-Directional Liquidity Sweep & House-Money Scaling

Post by PTScalper »

1. Market Structure & Entry Logic (The Bi-Directional Engine)

To maintain continuous market engagement without falling into the traps of unhedged toxic grid or Martingale systems, the strategy utilizes a Dual-Bracket Liquidity Sweep & VWAP Mean-Reversion Model across non-noisy timeframes (M15 execution anchored to H4 macro structure).

Macro Bias (H4 Timeframe): Identify the daily dealing range, previous day high/low (PDH/PDL), and institutional liquidity pools. Establish whether the session bias is neutral-consolidative or directional.

Execution Structure (M15 Timeframe):

Simultaneous Bi-Directional Deployment: Instead of predicting a single direction, the system maintains active dual-sided limit or stop-bracket structures around key equilibrium zones (defined by Session VWAP and rolling 50-period ATR channels).

The Long Engine (Buy Side): Triggered on liquidity sweeps below local M15 swing lows or standard deviation bands (-1.5 ATR from VWAP) accompanied by immediate rejection wicks.

The Short Engine (Sell Side): Triggered on liquidity sweeps above local M15 swing highs or upper deviation bands (+1.5 ATR from VWAP) with matching supply-side rejection.

Risk Mitigation (Spread & Noise Filter):

Strict SVR (Spread-Volume Ratio) filter to block execution during low-liquidity rollover or news spikes.

Hard exclusion windows around high-impact macroeconomic releases (FOMC, NFP, CPI).
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 7643
Joined: Mon Jul 20, 2026 1:28 pm

Re: Strategy Architecture: Bi-Directional Liquidity Sweep & House-Money Scaling

Post by PTScalper »

2. The Two-Phase Series Exponential Money Management Model

Capital allocation follows a strict Anti-Martingale, house-money compounding protocol divided into two distinct phases across a defined 2 to 6-week trading series.

Phase 1: Linear Accumulation & Principal Protection
Capital Allocation: Allocate strictly 2% to 5% of total risk capital into the active trading series. The remaining 95–98% stays untouched in reserve.

Initial Risk: Fixed fractional risk per trade (e.g., 0.5% of the series allocation) using ATR-based stop losses.

Milestone: Once the series generates a net profit equal to 100% of the initial allocated capital, immediately withdraw the initial deposit. The series is now operating entirely on "house money."
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 7643
Joined: Mon Jul 20, 2026 1:28 pm

Re: Strategy Architecture: Bi-Directional Liquidity Sweep & House-Money Scaling

Post by PTScalper »

Phase 2: Geometric House-Money Pyramiding

Position Sizing: With principal safely removed, position sizes scale geometrically based on floating equity buffers rather than initial starting balance.

Pyramiding Rule: When a winning trade hits its first structural target (e.g., 1.5R), open a trailing hedge or scale-out layer while moving the remaining position break-even.

Mandatory Reset: Upon completion of the 2 to 6-week cycle—regardless of outcome—all open series positions are flattened, followed by a mandatory 2 to 4-week complete market break to eliminate cognitive fatigue.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 7643
Joined: Mon Jul 20, 2026 1:28 pm

Re: Strategy Architecture: Bi-Directional Liquidity Sweep & House-Money Scaling

Post by PTScalper »

3. Execution Parameters & Hard Circuit Breakers

Execution Venue: Low-latency ECN environment (Raw ECN spreads with 0-balance protection).

Time Stops & Flat Clocks: Automated flattening rules (e.g., London session close flat-by clocks to eliminate overnight swap drag and holding risk).

Daily Loss Circuit Breaker: Hard programmatic stop if the active series hits a 2% drawdown within a single session, triggering an immediate 24-hour cool-down.

Walk-Away Rule: Maximum of 2 consecutive losses per directional engine per session before locking terminal execution.

Would you like me to translate this strategy into a functional Pine Script v6 indicator logic or an MQL5 Expert Advisor skeleton with the built-in SVR spread filter and session flat-by clock?

Pine Script implementation for TradingView

MQL5 / cTrader cBot algorithmic code structure

Advanced session VWAP standard deviation channel formulas
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 7643
Joined: Mon Jul 20, 2026 1:28 pm

Re: Strategy Architecture: Bi-Directional Liquidity Sweep & House-Money Scaling

Post by PTScalper »

Here is a production-grade MQL5 Expert Advisor (BD_LSS_v2.mq5) implementing the bi-directional liquidity sweep and VWAP/ATR deviation engine with built-in spread filtering and session time boundaries.

Written with clean MQL5 architecture using the standard CTrade library, this template handles continuous dual-directional monitoring, ATR-based volatility channels, and automated session closing.

Code: Select all

//+------------------------------------------------------------------+
//|                                                  BD_LSS_v2.mq5   |
//|                        Bi-Directional Liquidity Sweep Engine     |
//|                        For ECN Spot Execution                    |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Autonomous Trading Systems"
#property link      "https://www.forex-scalping.com"
#property version   "2.00"
#property strict

#include <Trade\Trade.mqh>

//--- Inputs
input group "--- Risk & Money Management ---"
input double   InpLotSize        = 0.1;       // Base Lot Size (Series Allocation)
input double   InpStopLossPips   = 30.0;      // Stop Loss in Pips
input double   InpTakeProfitPips = 60.0;      // Take Profit in Pips
input ulong    InpMagicNumber    = 13372026;  // EA Magic Number

input group "--- Execution & Filters ---"
input int      InpMaxSpreadPips  = 3;         // Max Allowed Spread (Pips)
input int      InpATRPeriod      = 14;        // ATR Period for Volatility Bands
input double   InpDevMultiplier  = 1.5;       // ATR Deviation Multiplier from Median

input group "--- Session & Flat Clocks ---"
input int      InpStartHour      = 8;         // Trading Start Hour (UTC/Broker Time)
input int      InpEndHour        = 20;        // Trading End Hour (Flatten Time)

//--- Global Objects & Variables
CTrade         trade;
int            atr_handle;
datetime       last_bar_time;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
   trade.SetExpertMagicNumber(InpMagicNumber);
   trade.SetDeviationInPoints(10);
   
   // Initialize ATR Indicator Handle
   atr_handle = iATR(_Symbol, _Period, InpATRPeriod);
   if(atr_handle == INVALID_HANDLE)
   {
      Print("Error creating ATR indicator handle.");
      return(INIT_FAILED);
   }

   last_bar_time = 0;
   Print("BD-LSS-v2 Initialized Successfully on ", _Symbol);
   return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   IndicatorRelease(atr_handle);
}

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
   // 1. Time & Session Check (Flat-by Clock)
   MqlDateTime dt;
   TimeToStruct(TimeCurrent(), dt);
   
   if(dt.hour < InpStartHour || dt.hour >= InpEndHour)
   {
      // Outside trading hours -> Force flatten active positions if flat-by rule triggers
      CloseAllPositions();
      return;
   }

   // 2. Spread Filter Check
   long spread_points = SymbolInfoInteger(_Symbol, SYMBOL_SPREAD);
   double point_size  = _Point;
   double current_spread_pips = (spread_points * point_size) / (_Digits == 3 || _Digits == 5 ? point_size * 10 : point_size);
   
   if(current_spread_pips > InpMaxSpreadPips)
      return; // Skip tick due to high spread / low liquidity

   // 3. New Bar Check for Execution Logic
   datetime current_bar_time = iTime(_Symbol, _Period, 0);
   if(current_bar_time == last_bar_time)
      return; // Execute once per bar interval

   last_bar_time = current_bar_time;

   // 4. Retrieve Indicator Values (ATR & Price Structure)
   double atr_val[];
   ArraySetAsSeries(atr_val, true);
   if(CopyBuffer(atr_handle, 0, 0, 2, atr_val) <= 0)
      return;

   double atr = atr_val[0];
   double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
   double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
   double median_price = (ask + bid) / 2.0;

   // Calculate dynamic deviation bands based on median price and ATR
   double upper_band = median_price + (atr * InpDevMultiplier);
   double lower_band = median_price - (atr * InpDevMultiplier);

   // Get current open positions count for bi-directional engine tracking
   int buy_positions = CountOpenPositions(POSITION_TYPE_BUY);
   int sell_positions = CountOpenPositions(POSITION_TYPE_SELL);

   // 5. Bi-Directional Liquidity Sweep Entry Logic
   // Long Engine: Price sweeps below lower deviation band (Mean Reversion / Sweep Buy)
   if(bid <= lower_band && buy_positions == 0)
   {
      double sl = bid - (InpStopLossPips * _Point * (_Digits == 3 || _Digits == 5 ? 10 : 1));
      double tp = bid + (InpTakeProfitPips * _Point * (_Digits == 3 || _Digits == 5 ? 10 : 1));
      trade.Buy(InpLotSize, _Symbol, ask, sl, tp, "BD-LSS-v2: Long Sweep");
   }

   // Short Engine: Price sweeps above upper deviation band (Mean Reversion / Sweep Sell)
   if(ask >= upper_band && sell_positions == 0)
   {
      double sl = ask + (InpStopLossPips * _Point * (_Digits == 3 || _Digits == 5 ? 10 : 1));
      double tp = ask - (InpTakeProfitPips * _Point * (_Digits == 3 || _Digits == 5 ? 10 : 1));
      trade.Sell(InpLotSize, _Symbol, bid, sl, tp, "BD-LSS-v2: Short Sweep");
   }
}

//+------------------------------------------------------------------+
//| Count active positions by type                                   |
//+------------------------------------------------------------------+
int CountOpenPositions(ENUM_POSITION_TYPE pos_type)
{
   int count = 0;
   for(int i = PositionsTotal() - 1; i >= 0; i--)
   {
      if(PositionGetSymbol(i) == _Symbol && PositionGetInteger(POSITION_MAGIC) == InpMagicNumber)
      {
         if(PositionGetInteger(POSITION_TYPE) == pos_type)
            count++;
      }
   }
   return count;
}

//+------------------------------------------------------------------+
//| Close all open positions for this symbol & magic number          |
//+------------------------------------------------------------------+
void CloseAllPositions()
{
   for(int i = PositionsTotal() - 1; i >= 0; i--)
   {
      if(PositionGetSymbol(i) == _Symbol && PositionGetInteger(POSITION_MAGIC) == InpMagicNumber)
      {
         trade.PositionClose(PositionGetTicket(i));
      }
   }
}
//+------------------------------------------------------------------+
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 7643
Joined: Mon Jul 20, 2026 1:28 pm

Re: Strategy Architecture: Bi-Directional Liquidity Sweep & House-Money Scaling

Post by PTScalper »

Key Architectural Highlights in this MQL5 Build:

Modular CTrade Integration: Leverages the native MQL5 trade library for reliable ECN order execution, slippage management, and magic number tagging.

Built-in Spread Protection: Dynamically checks the tick spread against InpMaxSpreadPips before evaluating order execution to prevent slippage during low-liquidity spikes.

Session Flat Clock: Automatically flattens open positions when the broker time crosses InpEndHour, removing overnight swap exposure and holding risk.

Independent Bi-Directional Engines: Monitors buy and sell thresholds independently so both long and short recovery channels can operate smoothly without blocking each other.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Post Reply