Quad Basket Hedging Grid
- Experts
-
Awais Ahmed
I develop and maintain automated trading systems for MetaTrader 4 and MetaTrader 5. - Version: 1.0
- Activations: 10
Quad Basket Hedging Grid — an automated hedging-grid Expert Advisor for MetaTrader 5.
The EA runs four independent baskets on one symbol, each on its own magic number: trend buy, trend sell, counter-trend buy and counter-trend sell. A basket adds a level every 21 pips against the position, with the lot multiplied by 1.7, up to a maximum of 12 levels. Once a basket holds four market orders every position adopts the newest take profit, so the basket closes as one.
Requirements
- MetaTrader 5, hedging account required (the EA checks the margin mode on start and stops on netting)
- Designed for AUDCHF and AUDCAD on H1
- Please keep the default settings. They are tuned for these pairs and this timeframe.
- Account type. The full grid strategy requires a hedging account. On a netting account MetaTrader merges positions on the same symbol, so the EA runs a reduced mode there: the same entry signals, one position at a time with the same stop and target, without the grid. A hedging account is recommended.
How it enters
Trend side: Stochastic (10, 3, 3) with 25/75 levels, filtered by a 25-period LWMA. Counter-trend side: a slower Stochastic (32, 12, 12) with 30/70 levels. By default the two trend baskets are switched off, so the EA works counter-trend only.
How it exits
- Take profit 30 pips per position
- After four orders in a basket, all positions take the newest take profit and close together
- Stop loss 253 pips per position
- Gap exit: if price jumps past the last entry by the grid distance plus 38 pips, the whole basket is closed at once
- Optional: close a basket at a fixed amount in account currency, and an optional trailing stop from the basket's lot-weighted average price
Account protection
Three limits, each independent and switched off by default:
- Daily loss limit — measured against the day's opening equity. Closes everything and pauses until the next day.
- Floating drawdown limit — floating loss against balance. Closes everything and pauses until the next day.
- Monthly profit target — closes everything and pauses until the next month.
News filter
Uses MetaTrader's own economic calendar. Around high-impact events on the chart symbol's two currencies, the grid spacing and the gap-exit distance are multiplied by 3, so the EA enters less often and further apart in a volatile window. The calendar is not available in the Strategy Tester, so the filter reports itself as off during a backtest.
About risk — please read before buying
This is a grid with a martingale progression. Position size compounds at 1.7× per level, so a basket that runs to all 12 levels holds about 8.3 lots in total from a 0.01 starting size. The per-position stop loss does not cap what a full basket can lose.
Before running it on a live account:
- Set Fix_lot to your account, not to the default
- Switch on the daily loss limit and the floating drawdown limit
- Test on a demo account first
Trading involves risk. Past performance does not indicate future results.
Inputs
Trade direction and hours StartHour 0, StopHour 24 — trading window in server hours · Buy_Trend false, Sell_Trend false — enable the trend baskets
Grid and sizing Fix_lot 0.01 — starting lot · Magic 69 — base magic number, four baskets derive from it · Range 21.0 — pips between levels · Level_Max 12 — maximum levels per basket · Star_ModifTp 4 — orders after which the basket shares one take profit · DiMarti 1.7 — lot multiplier per level
Exits Close_All_Gap true, Gap_Factor 38.0 — emergency basket close on a price jump · SL 253.0, TP 30.0 — pips per position · Tp_In_money false, Tp_in_money 7.0 — close a basket at a fixed amount · Dtrailing false, Trailing 5 — trailing stop from the basket average
Trend indicators kperiod 10, dperiod 3, slowing 3, lo_level 25, up_level 75, maPereode 25
Counter-trend indicator k_period 32, d_period 12, s_lowing 12, lolevel 30, uplevel 70
Risk management Use_Daily_Loss_Limit false, Daily_Loss_Limit_Pct 4.5 · Use_Active_DD_Limit false, Active_DD_Limit_Pct 9.5 · Monthly_Profit_Target_USD 0.0 (0 = off)
News filter Use_News_Filter true · News_Gap_Multiplier 3.0 · News_Minutes_Before 120, News_Minutes_After 120 · News_Impact_High true, News_Impact_Medium false · News_Only_Symbol_Currencies true · News_Refresh_Minutes 240 · News_Time_Adjust_Minutes 0
Dashboard Three movable panels on the chart showing account state, strategy and range, and the news window. Each can be minimised and dragged; positions persist per chart.
