MT5 EA源码:ASQ RiskGuard Professional Risk Management EA 全账户风控,净值回撤保护|星钻会员尊享 - 资源合集论坛 - Meta Trade 4 - BBTrading

MT5 EA源码:ASQ RiskGuard Professional Risk Management EA 全账户风控,净值回撤保护|星钻会员尊享

此资源为星钻会员专享,每日更新,收录于《大白EA宝库:星钻会员专属合集》。

这是一个净值回撤保护加每日亏损上限、追踪最大回撤、交易时段过滤、点差守卫与自动手数的全账户风控 EA,带图表风险仪表盘与事件日志。本帖文件为 MT5 源码,打包成 zip 下载,解压后在 MetaEditor 里编译使用,参数与文件开头见下方源码预览。

源码预览(先看代码,再决定下不下)

本帖是源码 EA:ASQ_RiskGuard.mq5,全文共 1063 行。下面是它的全部可调参数与文件开头,完整源码在上方下载区,星钻会员可见。

可调参数(47 个)

  • bool InpEnableEquityStop = true;(Enable equity stop)
  • ENUM_DD_MODE InpDDMode = DD_PERCENT;(Drawdown calculation mode)
  • double InpMaxDrawdownPct = 5.0;(Max drawdown % (if DD_PERCENT))
  • double InpMaxDrawdownMoney = 500.0;(Max drawdown $ (if DD_MONEY))
  • ENUM_DD_BASE InpDDBase = DD_FROM_BALANCE;(Drawdown measured from)
  • ENUM_CLOSE_METHOD InpCloseMethod = CLOSE_ALL_POSITIONS;(Close method when triggered)
  • bool InpEnableDailyLimit = true;(Enable daily loss limit)
  • ENUM_DD_MODE InpDailyMode = DD_PERCENT;(Daily limit mode)
  • double InpDailyLimitPct = 3.0;(Daily loss limit % (if DD_PERCENT))
  • double InpDailyLimitMoney = 300.0;(Daily loss limit $ (if DD_MONEY))
  • bool InpDisableTradingDaily = true;(Disable trading after daily limit hit)
  • bool InpEnableSessionFilter = false;(Enable session-based blocking)
  • string InpSessionStart = "08:00";(Allowed session start (server time))
  • string InpSessionEnd = "20:00";(Allowed session end (server time))
  • bool InpCloseOutsideSession = false;(Close positions outside session)
  • bool InpEnableSpreadGuard = false;(Enable spread guard)
  • int InpMaxSpreadPoints = 30;(Max allowed spread (points))
  • ENUM_LOT_MODE InpLotMode = LOT_RISK_PERCENT;(Lot sizing mode)
  • double InpFixedLot = 0.01;(Fixed lot size)
  • double InpRiskPercent = 1.0;(Risk % per trade)
  • double InpRiskMoney = 100.0;(Risk $ per trade)
  • int InpDefaultSLPoints = 200;(Default SL for lot calc (points))
  • int InpMaxOpenPositions = 5;(Max simultaneous positions (0=off))
  • double InpMaxTotalLots = 1.0;(Max total lot exposure (0=off))
  • int InpMaxOrdersPerDay = 10;(Max orders per day (0=off))
  • bool InpAlertPopup = true;(Popup alert)
  • bool InpAlertSound = true;(Sound alert)
  • string InpAlertSoundFile = "alert.wav";(Alert sound file)
  • bool InpAlertPush = false;(Push notification)
  • bool InpAlertEmail = false;(Email alert)
  • int InpWarningPct = 80;(Warning at % of limit (0=off))
  • bool InpShowDashboard = true;(Show on-chart dashboard)
  • int InpDashX = 15;(Dashboard X position)
  • int InpDashY = 25;(Dashboard Y position)
  • int InpFontSize = 9;(Dashboard font size)
  • color InpAccentColor = C'0,150,255';(Accent color (brand))
  • color InpSafeColor = C'0,200,120';(Safe status color)
  • color InpWarningColor = C'255,180,0';(Warning status color)
  • color InpDangerColor = C'240,50,70';(Danger status color)
  • color InpTextColor = C'175,180,192';(Normal text color)
//+------------------------------------------------------------------+
//|                                              ASQ_RiskGuard.mq5   |
//|                              Copyright 2026, AlgoSphere Quant    |
//|                        https://www.b123.com/    |
//+------------------------------------------------------------------+
#property copyright   "Copyright 2026, AlgoSphere Quant"
#property link        "https://www.b123.com/"
#property version     "2.00"
#property description "ASQ RiskGuard v2 — Professional risk management EA"
#property description "Equity & daily DD protection, trailing max drawdown,"
#property description "session filter, spread guard, risk scoring, visual dashboard."
#property description "AlgoSphere Quant — Precision before profit."

//+------------------------------------------------------------------+
//| Includes                                                          |
//+------------------------------------------------------------------+
#include <Trade/Trade.mqh>
#include <Trade/PositionInfo.mqh>
#include <Trade/AccountInfo.mqh>

//+------------------------------------------------------------------+
//| Enums                                                             |
//+------------------------------------------------------------------+
enum ENUM_CLOSE_METHOD
  {
   CLOSE_ALL_POSITIONS = 0,    // Close all positions
   CLOSE_LOSING_ONLY   = 1,    // Close losing positions only
   CLOSE_LARGEST_LOSS  = 2     // Close largest loser first
  };

enum ENUM_LOT_MODE
  {
   LOT_FIXED           = 0,    // Fixed lot size
   LOT_RISK_PERCENT    = 1,    // Risk % of balance per trade
   LOT_RISK_MONEY      = 2     // Risk fixed $ amount per trade

风险提示:EA 交易有风险,过往与参数表现不代表未来。正式使用前先在模拟盘跑够样本,确认在自己的点差、滑点环境下仍符合预期,再决定是否上实盘。

版本说明:资源随 MT4/MT5 版本迭代可能失效,如遇失效请在本帖留言反馈。

请登录后发表评论