EA-20781 · Hedging

Lock

This EA implements a locking/hedging strategy by opening opposing positions on the same instrument to protect existing trades from adverse market moves. It manages locked positions and unlocks them when market conditions become favorable. The core logic revolves around opening a reverse trade to offset risk on an existing position, effectively creating a synthetic flat state until a directional decision is made.

Open the interactive view (equity curve, symbol switch)

Key facts

CategoryHedging
RiskMedium
Blow-up riskLow
Rating★★☆☆☆
TypeTrading EA
TimeframesM15, H1, H4
IndicatorsNone
Authorsathudx.

Backtest results (H1, about 1 year)

SymbolP&LAnnualMax DDTradesWin rateSharpeRecoveryLosing streakPer tradeStatus
EURUSD-2.78%-2.42%4.09%11446.90%-0.63-0.685−$2.16Reliable
GBPUSD-0.24%-0.21%4.21%11647.00%-0.01-0.068$0.00Reliable
USDJPY-4.43%-3.86%7.04%11342.90%-0.81-0.6310−$4.09Reliable
XAUUSD+11.32%+9.26%52.86%11150.00%0.480.217+$12.54Reliable

Profitable on 1 of 4 markets with reliable results.

Converted from MQL5 to Python and run with the same rules for every EA. Positions use MT5 lot sizes (100,000 units per FX lot, 100 oz per gold lot) with 1:100 leverage, one order at a time, and a stop-out below 10% of the starting balance. Sharpe is computed from the equity curve. Results marked as unreliable are shown for completeness only.

Month by month

MarketMonths with a gainBest monthWorst month
EURUSD38%+1.57% 2026-04-1.36% 2026-01
GBPUSD46%+1.31% 2026-08-2.71% 2026-10
USDJPY46%+2.56% 2026-04-4.65% 2026-08
XAUUSD54%+48.49% 2026-02-28.34% 2026-08

From the backtest equity curve, sampled about every two days; only reliable results.

Blow-up risk: No blow-up pattern found

  • Can hold up to 2 positions at once

On its own this is not a typical blow-up pattern, and the account was not stopped out in our backtests. That is not a guarantee: any EA can lose money.

High: stopped out in our backtest, or martingale/grid sizing without a stop loss. Elevated: martingale or grid sizing with a stop loss, or several positions at once without a stop loss. What the label means and what we found →

Strategy analysis

The core concept of the lock strategy is to freeze floating profit or loss by opening an opposing position on the same instrument, bringing the net exposure on that symbol close to zero. Entry conditions are typically triggered when an existing position shows adverse floating movement reaching a preset loss threshold, at which point a reverse locking order is placed, or profit is proactively locked when specific market signals appear. Exit conditions rely on unlock logic — when the market trend reasserts itself or technical indicators confirm a direction, the losing side position is closed while the profitable side is retained. In terms of position sizing, the lock order lot size usually matches the original position to achieve a full hedge, though some lock strategies use proportional locking. For money management, since both long and short positions are held simultaneously, the margin requirement doubles, demanding higher account capital. The strategy's risk lies in improper unlock timing potentially causing losses on both sides, and prolonged locked positions consume significant margin, reducing capital efficiency.

Strengths

  • Effectively freezes existing floating profit, preventing profit giveback
  • Provides protection during uncertain market direction, avoiding the frustration of being stopped out before reversal
  • Compared to direct stop-loss closing, locking retains the opportunity for profit on both sides

Weaknesses

  • Margin requirement doubles, demanding high account capital and risking margin call forced liquidation
  • Unlock timing is difficult to judge; incorrect decisions may lead to losses on both sides
  • Prolonged locked positions accumulate swap costs on both sides, continuously draining account balance

Possible improvements

  • Add automatic unlock logic based on technical indicators to reduce risk from subjective judgment
  • Incorporate money management and margin monitoring modules to prevent insufficient margin from locking

Risk assessment

Overall risk: Medium

  • Double margin consumption from locked positions may trigger margin calls during high volatility
  • Improper unlock timing may result in losses on both sides rather than protection

Evaluation scores

Code quality3.0
Strategy logic3.0
Risk management2.0
Robustness2.0
Innovation2.0
Documentation1.0
Overall2.2

Parameters

ParameterDefaultDescription
LockProfit0Profit lock threshold
LockLoss0Loss lock threshold
UnlockProfit0Profit unlock threshold
LotSize0.01Initial lot size, martingale base quantity
MagicNumber0EA magic number to distinguish trade instances
Slippage3Allowed slippage

Similar Hedging EAs

Backtests are historical simulations and do not guarantee future results. Not financial advice.

Get the weekly Arena report

One email a week: ranking changes, new signals and new research. No spam; unsubscribe any time.