Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

Metatrader 5 Expert Advisor | Long-Only Trend Breakout with Dynamic Risk Management | Source Code Included

Explore the latest free tools from the MQL5 community. Here's a new indicator, expert advisor, or script for MetaTrader.

Image for Long-Only Trend Breakout with Dynamic Risk Management

You input a precise currency amount you are willing to lose (e.g., $20 or $50). The EA extracts the current market SYMBOL_TRADE_TICK_VALUE and SYMBOL_TRADE_TICK_SIZE to calculate the exact distance to your Stop Loss in ticks. It then normalizes this data into a calculated position volume, adjusting seamlessly to broker rules ( SYMBOL_VOLUME_STEP ). If a setup requires a lot size smaller than your broker's minimum allowance, the trade is safely skipped.

Input Parameters & Optimization Guide

The EA exposes highly flexible inputs designed for the MT5 Strategy Tester:

Parameter Default Value Description Optimization Potential
InpRiskAmount 20.0 Fixed monetary currency amount to risk per trade (e.g., $20). Scale according to your account size.
InpMinSLPoints 5000 Minimum allowed Stop Loss distance in points. High. Filter out tiny, low-momentum breakouts or tight noise.
InpRewardToRiskRatio 1.0 Target reward multiplier (e.g., 1.5 means TP is 1.5x the SL distance). High. Find the sweet spot for maximum expectancy on your chosen asset.
InpMagicNumber 654321 Unique tracking identifier for the EA's positions. Change if running multiple EAs on one account.


How to Optimize:

  1. Run a Fast (Genetic Algorithm) optimization on your target index.

    Recover from drawdowns intelligently with the Auto Recovery Expert Advisor for MT4/MT5. Perfect for hedging strategies. Learn more.

  2. Vary InpMinSLPoints to filter out small structural candles that result in false breakouts.

  3. Optimize InpRewardToRiskRatio between 0.5 and 2.5 to find the mathematical edge for the H4 timeframe.


Level up your trading with professional RobotFX expert advisors and indicators. Visit www.robotfx.org for proven MT4/MT5 tools.

73638

Best MetaTrader Indicators + Profitable Expert Advisors