• Welcome back! Thank you for being a part of this Traders Community. Let's discuss and share :)
    Selamat datang kembali! Trimakasih telah menjadi bagian dari Komunitas Trader ini. Mari berdiskusi dan berbagi :)

Suggestion I’ll build the EA according to your strategy.

Hello Egners. Please find below my idea. Thank you in advance:-

EA Name: Hedged Grid Martingale (Buy + Sell)
Platform: MT4 | No indicators | Any timeframe | Any symbol | Magic Number required

Opening​

  • Opens 1 BUY + 1 SELL together at market
  • Uses starting lot (user input)

Grid (per side, independent)​

  • Every Grid Gap pips against a side → add another trade on that side
  • Lot sequence: 3 × 0.01 → 3 × 0.02 → 3 × 0.03 → 3 × 0.04 … forever (+0.01 every 3 trades)
  • No stop loss. No max trades. No max lots. Each side keeps adding until its exit target is hit
  • Start lot, lot step, trades-per-tier, grid gap = all user-adjustable

Take Profit (per side)​

  • TP measured from FIRST entry of that side (not average)
  • Buy TP and Sell TP = separate user inputs
  • On TP → close all trades on that side, stop opening that side
  • Other side keeps running

Break-Even (surviving side only)​

  • Triggered automatically when one side hits TP
  • Surviving side switches to break-even mode and keeps gridding if price moves against it
  • Closes when price hits the user-set Break-Even Price (exact price, per side, fully adjustable — $1 to $1000+)
  • On hit → close all trades on that side

Reset​

  • When both sides closed → immediately open new Buy + Sell, lot sequence resets

Filters​

  • Spread filter — don't open new trades if spread > user-set max
  • Slippage — user input

Dashboard (on chart)​

  • Open trades per side
  • Lots per side
  • Floating P/L per side + total
  • Max Drawdown accrued whilst running (persists across session)
  • Current mode per side (Gridding / Break-Even / Closed)
  • TP price + Break-Even price per side
  • Toggle on/off + corner position

Inputs​

InputNotes
Magic Numberrequired
Starting Lote.g. 0.01
Lot Stepe.g. 0.01
Trades Per Tiere.g. 3
Grid Gappips, e.g. 20
Buy TPpips from first buy
Sell TPpips from first sell
Buy Break-Even Priceexact price
Sell Break-Even Priceexact price
Max Spreadfilter
Slippage
Dashboard On/Off + Corner

Optional (please include in code, off by default)​

  • Equity stop / close-all at X% DD
  • Max total lots cap

Quote Reply
Report

The hopper​

Member​

Credit Hunter
Credits
133
Would it be possible to add these features to the above?

Restart Mode — NEW​

User-selectable option with two choices:
ModeBehaviour
Mode A — Wait (original)Winning side closes. EA waits for the surviving side to hit break-even. Only then does it restart the full Buy + Sell cycle
Mode B — Restart ImmediatelyThe moment a side hits TP, EA immediately opens a fresh trade on that closed side — without waiting for the other side to close. The surviving side carries on in break-even mode as normal
  • Mode B detail: If Buy hits TP → close Buy, then immediately open a new Buy at market. Sell continues running in break-even mode. So at any moment, both sides can be active at once (one fresh cycle + one surviving basket). Magic number tagging must keep them separate.
  • User input: "Restart Mode: Wait / Immediate"

Manual Buttons — NEW​

On-chart buttons (top corner, user-adjustable position):
  • [ CLOSE ALL BUYS ] — closes every open buy trade (EA's magic number only)
  • [ CLOSE ALL SELLS ] — closes every open sell trade (EA's magic number only)
Behaviour notes:
  • Buttons must not reset the cycle automatically — they just close the trades
  • Add a confirmation popup ("Close all buys? Yes / No") so you don't fat-finger it
  • After a manual close, the EA should follow the same restart logic as a normal close (respect Restart Mode setting)
  • Optionally add a [ CLOSE ALL ] button for both sides at once
 
Hello Egners. Please find below my idea. Thank you in advance:-

EA Name: Hedged Grid Martingale (Buy + Sell)
Platform: MT4 | No indicators | Any timeframe | Any symbol | Magic Number required

Opening​

  • Opens 1 BUY + 1 SELL together at market
  • Uses starting lot (user input)

Grid (per side, independent)​

  • Every Grid Gap pips against a side → add another trade on that side
  • Lot sequence: 3 × 0.01 → 3 × 0.02 → 3 × 0.03 → 3 × 0.04 … forever (+0.01 every 3 trades)
  • No stop loss. No max trades. No max lots. Each side keeps adding until its exit target is hit
  • Start lot, lot step, trades-per-tier, grid gap = all user-adjustable

Take Profit (per side)​

  • TP measured from FIRST entry of that side (not average)
  • Buy TP and Sell TP = separate user inputs
  • On TP → close all trades on that side, stop opening that side
  • Other side keeps running

Break-Even (surviving side only)​

  • Triggered automatically when one side hits TP
  • Surviving side switches to break-even mode and keeps gridding if price moves against it
  • Closes when price hits the user-set Break-Even Price (exact price, per side, fully adjustable — $1 to $1000+)
  • On hit → close all trades on that side

Reset​

  • When both sides closed → immediately open new Buy + Sell, lot sequence resets

Filters​

  • Spread filter — don't open new trades if spread > user-set max
  • Slippage — user input

Dashboard (on chart)​

  • Open trades per side
  • Lots per side
  • Floating P/L per side + total
  • Max Drawdown accrued whilst running (persists across session)
  • Current mode per side (Gridding / Break-Even / Closed)
  • TP price + Break-Even price per side
  • Toggle on/off + corner position

Inputs​

InputNotes
Magic Numberrequired
Starting Lote.g. 0.01
Lot Stepe.g. 0.01
Trades Per Tiere.g. 3
Grid Gappips, e.g. 20
Buy TPpips from first buy
Sell TPpips from first sell
Buy Break-Even Priceexact price
Sell Break-Even Priceexact price
Max Spreadfilter
Slippage
Dashboard On/Off + Corner

Optional (please include in code, off by default)​

  • Equity stop / close-all at X% DD
  • Max total lots cap

Quote Reply
Report

The hopper​

Member​

Credit Hunter
Credits
133
Would it be possible to add these features to the above?

Restart Mode — NEW​

User-selectable option with two choices:
ModeBehaviour
Mode A — Wait (original)Winning side closes. EA waits for the surviving side to hit break-even. Only then does it restart the full Buy + Sell cycle
Mode B — Restart ImmediatelyThe moment a side hits TP, EA immediately opens a fresh trade on that closed side — without waiting for the other side to close. The surviving side carries on in break-even mode as normal
  • Mode B detail: If Buy hits TP → close Buy, then immediately open a new Buy at market. Sell continues running in break-even mode. So at any moment, both sides can be active at once (one fresh cycle + one surviving basket). Magic number tagging must keep them separate.
  • User input: "Restart Mode: Wait / Immediate"

Manual Buttons — NEW​

On-chart buttons (top corner, user-adjustable position):
  • [ CLOSE ALL BUYS ] — closes every open buy trade (EA's magic number only)
  • [ CLOSE ALL SELLS ] — closes every open sell trade (EA's magic number only)
Behaviour notes:
  • Buttons must not reset the cycle automatically — they just close the trades
  • Add a confirmation popup ("Close all buys? Yes / No") so you don't fat-finger it
  • After a manual close, the EA should follow the same restart logic as a normal close (respect Restart Mode setting)
  • Optionally add a [ CLOSE ALL ] button for both sides at once
Hello, here is what you requested; discussions and further debate regarding trading with this advisor in this thread are prohibited.
 

Attachments

Many thanks, Egners. Could I trouble you for one more thing, please?

This time I need an expert advisor that can simply enable auto trading at a time I specify. MT4 again, please.
 
EA Spec: Timed AutoTrading Enabler

Purpose:
A minimal EA whose only function is to switch AutoTrading ON at a user-defined time. It does nothing else — no trading, no order management, no other logic.

Usage flow:

  1. AutoTrading is OFF in the terminal.
  2. The user attaches the EA to a chart.
  3. The EA sits idle and waits.
  4. At the chosen time, the EA enables AutoTrading.
Inputs:

  • EnableTime — the date/time at which AutoTrading should be turned on (server time or local time — please confirm which you'll use).
Behaviour:

  • On attach: do nothing except wait. AutoTrading is off, so the EA must still be able to run and monitor the time in this state.
  • Continuously check current time against EnableTime.
  • Once current time ≥ EnableTime: switch AutoTrading ON, then stop (no further action).
Notes:

  • This is the EA's sole purpose — keep it as simple as possible.
  • Please advise on how you'll enable AutoTrading programmatically (e.g. via TerminalInfoInteger(TERMINAL_TRADE_ALLOWED) / the terminal's AutoTrading button), since this may depend on terminal settings and permissions.
 
EA Spec: Timed AutoTrading Enabler

Purpose:
A minimal EA whose only function is to switch AutoTrading ON at a user-defined time. It does nothing else — no trading, no order management, no other logic.

Usage flow:

  1. AutoTrading is OFF in the terminal.
  2. The user attaches the EA to a chart.
  3. The EA sits idle and waits.
  4. At the chosen time, the EA enables AutoTrading.
Inputs:

  • EnableTime — the date/time at which AutoTrading should be turned on (server time or local time — please confirm which you'll use).
Behaviour:

  • On attach: do nothing except wait. AutoTrading is off, so the EA must still be able to run and monitor the time in this state.
  • Continuously check current time against EnableTime.
  • Once current time ≥ EnableTime: switch AutoTrading ON, then stop (no further action).
Notes:

  • This is the EA's sole purpose — keep it as simple as possible.
  • Please advise on how you'll enable AutoTrading programmatically (e.g. via TerminalInfoInteger(TERMINAL_TRADE_ALLOWED) / the terminal's AutoTrading button), since this may depend on terminal settings and permissions.
I hope this is what you wanted.
 

Attachments

Hello, here is what you requested; discussions and further debate regarding trading with this advisor in this thread are prohibited.
Dear Egners,

During both BT and FT, the EA doesn't add trades to the winning side. For example, if the losing side adds another trade with a grid gap of 5 pips, the winning side should also add another trade in the same way, until the target price is reached.

Would it be possible to add this feature to the EA?

Many thanks again.
 
Dear Egners,

During both BT and FT, the EA doesn't add trades to the winning side. For example, if the losing side adds another trade with a grid gap of 5 pips, the winning side should also add another trade in the same way, until the target price is reached.

Would it be possible to add this feature to the EA?

Many thanks again.
How It Works

The side whose grid trigger fires adds a regular trade in lot steps; the opposite basket immediately opens a trade of the same lot at the current price. Its own firstPrice, TP, and BE levels remain untouched — only count, lots, and lastPrice are updated.

If both sides trigger on the same tick (possibly after a fast gap), each adds its own trade once, and the mirrors do not fire — otherwise each side would get two additions.

The mirror trade respects MaxTotalLots, MaxSpreadPips, and lot normalization, so the protective limits cannot be bypassed.

With MirrorSameLot = false, the mirroring side uses its own step progression (NextLot based on its own counter) — convenient when the baskets started at different times and have a different number of trades.

Important to Consider Before Backtesting

A buy and a sell opened at the same price with the same lot offset each other, so each mirror pair freezes the current floating profit/loss. In practice this means that once mirroring starts, the overall floating result stops responding to further price movement — the drawdown is locked near the level of the first mirror order, but any further recovery is also capped. The exit is still determined by the existing logic (TP from the first trade / BE price), while swaps and commissions keep accruing on both sides as long as the position is locked. Margin also grows on both sides — watch your free margin and test with a realistic spread. P\S...... Please finish the rest yourself. Anything you want to change in the advisor, you’ll need to develop yourself; I won’t be involved in the adjustments.
 

Attachments

Back
Top