此资源为星钻会员专享,每日更新,收录于《大白EA宝库:星钻会员专属合集》。
这个 EA 按周高低点自动计算交易区间,根据网格订单数与当前价格挂出 buy/sell limit 挂单网格。本帖文件为 MT4 源码,打包成 zip 下载,解压后在 MetaEditor 里编译使用,参数与文件开头见下方源码预览。
源码预览(先看代码,再决定下不下)
本帖是源码 EA:Ranged_Grid_Bot_EA_with_pending_orders.mq4,全文共 668 行。下面是它的全部可调参数与文件开头,完整源码在上方下载区,星钻会员可见。
可调参数(13 个)
int MAGICMA = 3937;(Magic Number; a unique number to assign to the orders)int startTrade = 0;(Trade Start Time; Do not trade before this hour)int endTrade = 24;(Trade End Time; Do not trade after this hour)bool closeAllAtEndTrade = true;(Close all trades and orders after Trade End Time despite profit)int maxOpenOrders = 5;(Adjust this to your broker's maximum orders limit)int numberOfOrders = 10;(Number of pending orders to open)double lotSize = 0.01;(Lot size for each order)bool resetOrdersDaily = true;(Input parameter to reset pending orders every day)double stopLossPoints = 60;(Input parameter for the minimum stop loss in points)double takeProfitPoints = 60;(Input parameter for the minimum take profit in points)double stopLossMultiplier = 3.0;(Input parameter for stop loss multiplier)double takeProfitMultiplier = 1.0;(Input parameter for take profit multiplier)double targetPercentage = 8.0;(Percentage of gain to trigger closing)
//+------------------------------------------------------------------+ //| RangeEA.mq4 | //| Copyright 2023, MetaQuotes Software Corp. | //| https://www.b123.com/ | //+------------------------------------------------------------------+ #property copyright "2023, MetaQuotes Software Corp." #property link "https://www.b123.com/" #property version "1.01" #property strict #define VER "1.01" input int MAGICMA = 3937; // Magic Number; a unique number to assign to the orders input int startTrade = 0; // Trade Start Time; Do not trade before this hour input int endTrade = 24; // Trade End Time; Do not trade after this hour input bool closeAllAtEndTrade = true; // Close all trades and orders after Trade End Time despite profit input int maxOpenOrders = 5; // Adjust this to your broker's maximum orders limit input int numberOfOrders = 10; // Number of pending orders to open input double lotSize = 0.01; // Lot size for each order input bool resetOrdersDaily = true; // Input parameter to reset pending orders every day input double stopLossPoints = 60; // Input parameter for the minimum stop loss in points input double takeProfitPoints = 60; // Input parameter for the minimum take profit in points input double stopLossMultiplier = 3.0; // Input parameter for stop loss multiplier input double takeProfitMultiplier = 1.0; // Input parameter for take profit multiplier input double targetPercentage = 8.0; // Percentage of gain to trigger closing // Global array to store order tickets int orderTickets[]; int orderTicketsCount = 0; // Global array to store executed order prices double executedOrderPrices[]; int executedOrdersCount = 0; double StopLevel;
风险提示:这类 EA 带网格/马丁类加仓逻辑,顺风时看不出来,单边行情里仓位和浮亏会一起放大。上实盘前先在模拟盘跑够样本,把最大层数和总手数按自己能承受的回撤设死,不要用默认参数直接跑。
版本说明:资源随 MT4/MT5 版本迭代可能失效,如遇失效请在本帖留言反馈。

