此资源为星钻会员专享,每日更新,收录于《大白EA宝库:星钻会员专属合集》。
这个 EA 用均线金叉死叉入场,按账户风险百分比自动计算手数,ATR 动态止损,只在新 K 线形成时计算,带逐笔风控日志。本帖文件为 MT5 源码,打包成 zip 下载,解压后在 MetaEditor 里编译使用,参数与文件开头见下方源码预览。
源码预览(先看代码,再决定下不下)
本帖是源码 EA:Risk_Management_ATR_EA.mq5,全文共 433 行。下面是它的全部可调参数与文件开头,完整源码在上方下载区,星钻会员可见。
可调参数(11 个)
double RiskPercentagePerTrade = 1.0;(Risk per trade (% of balance))double MaximumRiskInMoney = 0;(Max risk cap in account currency (0 = no limit))int VolatilityPeriod = 14;(ATR calculation period)double VolatilityMultiplier = 2.0;(Stop loss ATR multiplier)bool EnableDynamicStopLoss = true;(Use ATR-based stop loss)int StaticStopLossPips = 50;(Fixed SL in pips (when dynamic disabled))int FastMovingAveragePeriod = 10;(Fast MA period)int SlowMovingAveragePeriod = 20;(Slow MA period)ENUM_MA_METHOD MovingAverageType = MODE_SMA;(MA calculation method)int ExpertMagicIdentifier = 123456;(Unique magic number)string OrderCommentLabel = "RiskManager_v3";(Trade comment)
//+------------------------------------------------------------------+ //| EnhancedRiskManagerEA.mq5 | //| Copyright 2025, Advanced Trading Systems | //| https://www.b123.com/ | //+------------------------------------------------------------------+ #property copyright "Advanced Trading Systems" #property link "https://www.b123.com/" #property version "3.00" #property strict #property description "Professional Risk-Based Position Sizing Expert Advisor" #property description "Dynamic lot calculation using ATR volatility measurement" #property description "Optimized performance with reduced redundancy" //--- Include necessary libraries #include <Trade\Trade.mqh> //--- Input parameters input group "=== Capital Protection Settings ===" input double RiskPercentagePerTrade = 1.0; // Risk per trade (% of balance) input double MaximumRiskInMoney = 0; // Max risk cap in account currency (0 = no limit) input group "=== Volatility Analysis ===" input int VolatilityPeriod = 14; // ATR calculation period input double VolatilityMultiplier = 2.0; // Stop loss ATR multiplier input bool EnableDynamicStopLoss = true; // Use ATR-based stop loss input int StaticStopLossPips = 50; // Fixed SL in pips (when dynamic disabled) input group "=== Signal Generation ===" input int FastMovingAveragePeriod = 10; // Fast MA period input int SlowMovingAveragePeriod = 20; // Slow MA period input ENUM_MA_METHOD MovingAverageType = MODE_SMA;// MA calculation method input group "=== Order Management ===" input int ExpertMagicIdentifier = 123456; // Unique magic number input string OrderCommentLabel = "RiskManager_v3"; // Trade comment
风险提示:EA 交易有风险,过往与参数表现不代表未来。正式使用前先在模拟盘跑够样本,确认在自己的点差、滑点环境下仍符合预期,再决定是否上实盘。
版本说明:资源随 MT4/MT5 版本迭代可能失效,如遇失效请在本帖留言反馈。

