Trading robot · MT4

Hedge EA

by sahebkaran1

This MetaTrader 4 expert advisor executes and manages trades using a specialized hedging strategy.

GitHub stars1
Forks2
Last update1 year ago9 Apr 2025
LicenceMIT

Overview

Hedge EA monitors account equity and floating losses, automatically opening hedge positions when a user-defined loss percentage is reached. The system includes robust risk management features such as daily and weekly loss limits, dynamic lot sizing based on account risk, and a margin level safeguard. It also incorporates a news filter, session-specific trading hours, and trailing stops. The EA can close all open positions once a target profit percentage is achieved.

Details

Author

sahebkaran1 on GitHub

Type

Trading robot

Platform

MetaTrader 4 (MQL4)

Strategy

Hedging

Markets

Forex

Timeframes

Any timeframe

Risk profile

  • Holds opposite positions at once

EA files

Topics

expert-advisorforexhedgingmt4

Input parameters

Read from HedgeEA.mq4. Defaults are the author's; change them in the EA's Inputs tab.

NameTypeDefaultDescription
LotSizedouble0.1Lot Size
HedgeLotSizedouble0.1Hedge Lot Size
StopLossint50Stop Loss in pips
TakeProfitint100Take Profit in pips
MagicNumberint123456Magic Number
Slippageint3Slippage in pips
MaxLossPercentdouble1.0Maximum Loss Percent before Hedging
TargetProfitdouble2.0Target Profit Percent to Close All
StartHourint0Trading Start Hour
EndHourint24Trading End Hour
MaxMarginLeveldouble1000Maximum margin level before closing positions
UseTrailingStopbooltrueUse trailing stop
Show all 27 inputs
NameTypeDefaultDescription
TrailingStopint20Trailing stop in pips
TrailingStepint5Trailing step in pips
UseDynamicLotSizeboolfalseUse dynamic lot size
RiskPercentdouble1.0Risk percent for dynamic lot size
MaxPositionAgeint24Maximum position age in hours
UseNewsFilterbooltrueUse news filter
NewsMinutesBeforeint30Minutes before news to avoid trading
NewsMinutesAfterint30Minutes after news to avoid trading
UseSessionFilterbooltrueUse session filter
AsianSessionstring00:00-08:00Asian session
LondonSessionstring08:00-16:00London session
NewYorkSessionstring13:00-21:00New York session
UseRiskManagementbooltrueUse advanced risk management
DailyLossLimitdouble2.0Daily loss limit in percent
WeeklyLossLimitdouble5.0Weekly loss limit in percent

How to install it

  1. 1Download the sourceUse "Download source (.zip)" above, or clone sahebkaran1/HedgeEA from GitHub, and unzip it.
  2. 2Open the data folderIn MetaTrader choose File, then Open Data Folder, and go to MQL4/Experts.
  3. 3Copy the filesCopy the .mq4 file into Experts.
  4. 4Compile in MetaEditorOpen the file in MetaEditor and press Compile. Fix any missing includes the compiler reports.
  5. 5Test before you tradeRun it in the Strategy Tester, then attach it to a demo chart and allow algorithmic trading.
Third-party code. ForexR did not write, test or endorse this EA, and the summary above was generated automatically from its README and code. ForexR lists only repositories with readable source code and never hosts files. Read the code, backtest it and use a demo account first; automated trading can lose money quickly.

Similar expert advisors

Icarus

by fraggli
7 stars

Icarus is an automated trading system for MetaTrader 4 that employs a grid strategy with Martingale lot scaling. It utilizes Bollinger Bands and the Stochastic Oscillator to identify entry points, offering a conjunctive mode for filtered execution. The EA manages risk through maximum position limits, equity warning thr

MT4 Trading robot GridMartingaleMean reversion High risk
Updated 4 years ago GPL-3.0 GitHub repository of Icarus

Profit Hunter

by phpkadir
5 stars

Profit Hunter is an expert advisor for MetaTrader 4 designed for forex and cryptocurrency trading. It utilizes a composite signal strategy combining Triple Moving Average, Adaptive RSI, CCI, iTrend, and Fisher indicators. The robot executes trades using a grid system where distances between orders are set manually or c

MT4 Trading robot GridMartingaleHedging High risk
Updated 4 years ago None stated GitHub repository of Profit Hunter

Oanda TDesk Drone

by LonnieCoffman
4 stars

Oanda TDesk Drone is a MetaTrader 4 expert advisor designed to execute trades based on signals from the TDesk dashboard via the Oanda FXtrade platform. It functions as a bridge, using an external Python script and file-based data exchange to facilitate order placement. The EA is specifically designed to support fractio

MT4 Trading robot Multi-strategyGridHedging High risk
Updated 7 years ago None stated GitHub repository of Oanda TDesk Drone

Oil Hedge

by vvvf
3 stars

This MetaTrader 4 expert advisor implements a correlation-based hedging strategy between two instruments, typically UKOIL and USOIL. It monitors the price spread between the two assets, opening buy and sell positions simultaneously when the spread expands or narrows beyond defined thresholds. The EA manages exits based

MT4 Trading robot HedgingMean reversionMartingale High risk
Updated 5 years ago None stated GitHub repository of Oil Hedge

North East Way

by Yogurt-Peng
3 stars

This MetaTrader 4 robot implements a multi-currency mean-reversion strategy, targeting price returns to the average on correlated forex pairs. It manages trades using a grid system with a significant martingale multiplier to scale lot sizes. The expert advisor allows for simultaneous trading on multiple symbols to dive

MT4 Trading robot Mean reversionGridMartingale High risk
Updated 1 year ago None stated GitHub repository of North East Way
3 stars

This expert advisor facilitates arbitrage trading between futures and spot instruments, primarily targeting gold and stock indices. Available for MetaTrader 4 and 5, it monitors the price difference between two related symbols against a moving average to identify trade opportunities. The logic includes a noise-filterin

MT4MT5 Trading robot ArbitrageMean reversionGrid High risk
Updated 3 years ago None stated GitHub repository of Gold Futures Spot Arbitrage

More trading robots

Need a broker for MT4?

Compare regulated brokers that support MetaTrader, with spreads, minimum deposits and leverage side by side.

Compare brokers