MT4 EA源码:Auto Tp 自动给每单设止盈止损|星钻会员尊享 - 资源合集论坛 - Meta Trade 4 - BBTrading

MT4 EA源码:Auto Tp 自动给每单设止盈止损|星钻会员尊享

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

这是一个自动为每笔订单设置止盈/止损的 EA,无需手动干预即可让每笔交易都有预设的退出位。本帖文件为 MT4 源码,打包成 zip 下载,解压后在 MetaEditor 里编译使用,参数与文件开头见下方源码预览。

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

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

可调参数(8 个)

  • double TakeProfitPips = 30;(Take Profit :)
  • bool UseStopLoss = false;(Use Stop Loss (Enable/Diseble):)
  • double StopLossPips = 200;(Stop Loss :)
  • bool UseTrailingStop = false;(Use Trailing Stop (Enable/Diseble):)
  • double TrailingStopPips = 15;(Trailing Stop:)
  • bool UseEquityProtection = false;(Use Equity Protection)
  • double MinEquityPercent = 50.0;(Close trades if Equity < 50% of Balance)
  • int Slippage = 3
//+------------------------------------------------------------------+
//|                                                      Auto_Tp.mq4 |
//|                                                Mir Mostofa Kamal |
//|                              https://www.b123.com/ |
//+------------------------------------------------------------------+
#property copyright "Mir Mostofa Kamal"
#property link      "https://www.b123.com/"
#property version   "1.00"
#property description "Auto Take profit and stop loss set EA ."
#property description "This EA will work on all time frames. Good for Scalping."
#property description "WARNING: Use this software at your own risk."
#property description "The creator of this script cannot be held responsible for any damage or loss."
#property strict
//+------------------------------------------------------------------+
//Inputs
//+------------------------------------------------------------------+
extern double TakeProfitPips     = 30;    // Take Profit :
extern bool   UseStopLoss    = false;  // Use Stop Loss (Enable/Diseble):
extern double StopLossPips       = 200;    // Stop Loss :
extern bool   UseTrailingStop    = false;  // Use Trailing Stop (Enable/Diseble):
extern double TrailingStopPips   = 15;    //Trailing Stop:

extern bool   UseEquityProtection = false; //Use Equity Protection
extern double MinEquityPercent   = 50.0;  // Close trades if Equity < 50% of Balance
extern int    Slippage            = 3;

int MagicNumber = 0; // Only affect manual trades
//+------------------------------------------------------------------+
int OnInit()
  {
   Print("Auto SL/TP Manager EA initialized.");
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
void OnTick()

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

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

请登录后发表评论