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

Fresh: Metatrader 5 Libraries | PropFirm Defense | Trading Tool Update

RobotFX curates the best open-source MetaTrader code to inspire your trading automation.

How it behaves

  • One observation per pass, shared by every rule, and at most one directive out of it. Eight rules breaching at once produce one action, not eight.
  • Works alongside anything — any EA, manual trading or copied signal on the account. It takes no position of its own.
  • State survives a restart. The anchor, the consumed budget and the latches are persisted, so a VPS reboot does not refill the drawdown allowance.
  • Every threshold is yours to set, from the Inputs dialog, with presets for common firm styles as a starting point.

Image for PropFirm Defense

Architecture, for readers who want to reuse the pieces

CPropRulebook is the only class a caller needs. It composes:

  • CPropSnapshotBuilder — freezes one account snapshot per pass (equity, balance, positions, floating P/L) so every rule judges the same numbers.
  • CRuleRegistry + CRuleCoordinator — hold the eight IPropRule implementations and resolve many verdicts into at most one directive.
  • CProtectiveActionExecutor — the only class allowed to touch a position, and only to flatten on breach.
  • CGuardStateStore — persists the trailing floor, consumed budgets and latches across a terminal restart.
  • CTerminalAlgoSwitch — an optional actuator for the terminal's global Algo Trading button. It degrades instead of refusing to start when the WinAPI call it needs is unavailable (Market build, Linux/Wine, or AllowDllImport=0).

Not a strategy

This does not decide when to enter and makes no claim about profitability. It answers two questions for whatever does trade: may I open this now, and is anything about this account currently in breach.

Unique stair-step trend trading with the Stairsteps Expert Advisor. Innovative approach for consistent results. Learn more.

Limitations, stated up front

  • Preset numbers are a starting point, not a contract. Prop-firm rulebooks change and differ per programme and per tier. Check every threshold against your own agreement.
  • The news rule needs the terminal's economic calendar. It abstains when the calendar is unavailable, which is the case in the Strategy Tester.
  • CTerminalAlgoSwitch imports user32.dll when compiled without the market-build switch (PROP_MARKET_BUILD, on by default in the attached demo). If you compile your own entry point and need the DLL-free path (Market rules, AllowDllImport=0, or a platform with no WinAPI), define that macro before the include.

Complement community code with advanced automation from RobotFX.

77156

Best MetaTrader Indicators + Profitable Expert Advisors