Trading robot · MT5

Straddle TP SL EA

by minhajul61

Straddle TP SL EA is a breakout robot for MetaTrader 5, specifically optimized for gold trading.

GitHub stars1
Forks0
Last update2 months ago22 Jul 2026
LicenceNone stated

Overview

Straddle TP SL EA implements a straddle strategy by placing buy-stop and sell-stop orders at the boundaries of a recent price range, typically using the last M5 candle. The EA includes risk management features such as ATR-adaptive stop losses, spread-aware trailing stops, and position sizing based on account equity. It filters entries using a built-in news calendar, UTC session hours, and minimum volatility requirements. Additional safety controls include daily profit and loss targets, a holiday skip list, and an on-chart dashboard.

Details

Author

minhajul61 on GitHub

Type

Trading robot

Platform

MetaTrader 5 (MQL5)

Strategy

Breakout, Scalping

Markets

Gold

Timeframes

M1-M5

Risk profile

No grid, martingale or hedging logic was found in its code or README. That says nothing about how it performs: backtest it first.

Input parameters

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

NameTypeDefaultDescription
InpLookbackCandlesint1Candles to build range (high/low); 1 = last M5 candle
InpRangeTFENUM_TIMEFRAMESPERIOD_M5Timeframe for range calculation
InpBufferPointsdouble50Buffer beyond range high/low (points)
InpMinRangePointsdouble200Skip setup if candle range < this (points) - filters dead/choppy bars. Changed 300->200 on 2026-07-23: swept 50/100/150/
InpUseSessionFilterbooltrueSkip new setups during the excluded hours below
InpBrokerPresetENUM_BROKER_PRESETBROKER_CUSTOMPick your broker for its known offset, or Custom to enter it manually
InpCustomGMTOffsetHoursint3Used only when InpBrokerPreset = Custom - broker server time = UTC + this
InpExcludedHoursUTCstring4,10,11,22,23Comma-separated UTC hours to skip (weak/negative-edge hours)
InpATRPeriodint14ATR period (computed on InpRangeTF)
InpATRMultSLdouble0.5Initial SL distance = ATR * this - adapts to volatility. Changed 1.5->0.5 on 2026-07-23: swept 1.5/1.0/0.75/0.5 on CXM D
InpTrailStartSpreadMultdouble0.1Trailing starts once profit >= current spread * this. Real-tick backtest tested 0.01/1.0/3.0 on the same week: LOWER (fa
InpTrailStartProfitUSDdouble0One-time arm gate: no trailing at all until floating profit clears this $ amount once; after that, trailing follows the
Show all 40 inputs
NameTypeDefaultDescription
InpTrailStepPointsdouble100SL trail distance kept behind price (points)
InpTPPointsdouble0Fixed TP distance (points); 0 = disabled, trailing SL exits
InpUseATRSpikeFilterboolfalseSkip new setups when ATR is spiking well above its recent baseline. Tested worse in a real-tick A/B (profit $294 vs $318
InpMaxATRRatiodouble1.5Current ATR must be <= baseline * this to allow a new setup
InpATRBaselineBarsint20Bars averaged (on InpRangeTF) to build the ATR baseline
InpUseTrendFilterboolfalseTrend-aligned trades trail looser, so they hold longer for bigger profit (tested worse: -46% profit, 8x drawdown - kept
InpTrendMAPeriodint50MA period (computed on InpRangeTF) that defines the trend
InpTrendHoldMultiplierdouble2.5Trend-aligned trades trail at InpTrailStepPoints * this (wider = holds longer)
InpUseRiskSizingbooltrueSize lots by % equity risk instead of fixed lot - REQUIRED when porting to a broker with a different contract size (this
InpRiskPercentdouble0.5Risk % of equity per trade (used when InpUseRiskSizing = true)
InpLotSizedouble0.01Fixed lot size (used only if InpUseRiskSizing = false, or as fallback if risk sizing fails)
InpSlippagePointsint20Max slippage (points)
InpMagicint20260716EA magic number
InpPendingExpiryMinint240Pending order expiry, minutes (0 = GTC)
InpAllowLongbooltrueAllow long (buy stop) setups
InpAllowShortbooltrueAllow short (sell stop) setups
InpUseDailyLimitbooltrueStop arming new setups once today's P/L hits either limit below (open positions still managed/trailed)
InpDailyProfitTargetPctdouble0Stop new trades once daily P/L >= this % of day-start balance (0 = disabled)
InpDailyMaxLossPctdouble2.0Stop new trades once daily P/L <= -this % of day-start balance (0 = disabled)
InpTradeMondaybooltrueAllow new setups on Monday
InpTradeTuesdaybooltrueAllow new setups on Tuesday
InpTradeWednesdaybooltrueAllow new setups on Wednesday
InpTradeThursdaybooltrueAllow new setups on Thursday
InpTradeFridaybooltrueAllow new setups on Friday
InpTradeSaturdayboolfalseAllow new setups on Saturday
InpTradeSundayboolfalseAllow new setups on Sunday
InpHolidayDatesstringComma-separated dates to skip entirely, format YYYY.MM.DD (e.g. "2026.12.25,2026.01.01")
InpUseNewsFilterbooltrueSkip new setups around high-impact economic calendar events (uses MQL5's built-in Calendar - works in live/demo; in the

How to install it

  1. 1Download the sourceUse "Download source (.zip)" above, or clone minhajul61/Straddle-TP-SL-EA from GitHub, and unzip it.
  2. 2Open the data folderIn MetaTrader choose File, then Open Data Folder, and go to MQL5/Experts.
  3. 3Copy the filesCopy the .mq5 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

Nyao Scalper

by elrizwiraswara
173 stars

Nyao Scalper is an automated scalping robot for MetaTrader 5 that utilizes a multi-factor weighted scoring system to identify trade opportunities. It evaluates trend alignment through EMA crossovers, momentum via RSI, and price action through wick rejection and candle body analysis. The EA manages risk with adaptive AT

MT5 Trading robot ScalpingTrend followingMartingale High risk
Updated 3 months ago BSD-3-Clause GitHub repository of Nyao Scalper

Prop Firm EA Fleet

by cgemise971
20 stars

Prop Firm EA Fleet is a collection of MetaTrader 5 robots designed for passing prop firm evaluations and managing funded accounts. The suite utilizes various strategies including market structure analysis, session range breakouts for London and New York sessions, and high-frequency scalping. It features strict risk man

MT5 Trading robot SMC / ICT / price actionBreakoutScalping High risk
Updated 9 months ago None stated GitHub repository of Prop Firm EA Fleet
5 stars

Universal Market Hunter is an automated trading robot for MetaTrader 5 that targets Forex, gold, and cryptocurrency markets. It allows users to switch between two main strategies: a Bollinger Band volatility breakout and an engulfing price action pattern using volume confirmation. The system manages risk through ATR-ca

MT5 Trading robot BreakoutScalpingTrend following
Updated 1 year ago Apache-2.0 GitHub repository of Universal Market Hunter

High Frequency Scalper

by Pusparaj99op
5 stars

This MetaTrader 5 expert advisor is designed for scalping gold on the M1 timeframe. It features a versatile strategy engine capable of toggling between breakout and mean-reversion modes based on market conditions. The system manages trades using ATR-based trailing stops, break-even adjustments, and time-based exits. Ri

MT5 Trading robot ScalpingBreakoutMean reversion
4 stars

Gold SnR Momentum Scalper Pro is an automated scalping robot for MetaTrader 5, specifically optimized for XAUUSD on the M1 timeframe. It identifies entry points by combining support and resistance zones with RSI and moving average momentum. The system incorporates tick-level analysis to measure buying and selling press

MT5 Trading robot ScalpingBreakoutMean reversion
Updated 3 months ago Custom licence GitHub repository of Gold SnR Momentum Scalper Pro
2 stars

This Expert Advisor for MetaTrader 5 implements a stop-and-reverse trading strategy using pending stop orders. It places Buy Stop and Sell Stop orders that trail price movements in a single direction to tighten the entry point. Once a position is active, the EA maintains an opposite pending order as a reversal trigger,

MT5 Trading robot BreakoutScalping

More trading robots

Need a broker for MT5?

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

Compare brokers