美文网首页MT5入门到精通
MT5入门到精通之十六(系统自带跟单操作)

MT5入门到精通之十六(系统自带跟单操作)

作者: 旺仔2488 | 来源:发表于2017-05-06 08:01 被阅读0次

2017/5/6
MT5入门到精通之十六(系统自带跟单操作)
一 跟单signal (mt5软件要一直打开)
1.订阅与取消订阅

image.png

2.充值

image.png

3.代码实现查询和订阅
3.1前提条件,需要允许才可以订阅成功

image.png

3.2信号查询,订阅和取消代码实现

//+------------------------------------------------------------------+
//|                                          operateSignalScript.mq5 |
//|                        Copyright 2017, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property script_show_inputs
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart()
  {
//1.遍历信号
   int total=SignalBaseTotal();
   for(int i=0;i<total;i++)
     {
      if(SignalBaseSelect(i)==true)
        {
         //2.1 信号名称
         string name=SignalBaseGetString(SIGNAL_BASE_NAME);
         //2.2Return on Investment (%)
         double roi=SignalBaseGetDouble(SIGNAL_BASE_ROI);
         //2.3 Number of subscribers
         int subscribers_num=SignalBaseGetInteger(SIGNAL_BASE_SUBSCRIBERS);
         //2.4 Account maximum drawdown
         double max_drawdown=SignalBaseGetDouble(SIGNAL_BASE_MAX_DRAWDOWN);
         //2.5 Signal subscription price
         double subscription_price=SignalBaseGetDouble(SIGNAL_BASE_PRICE);
         //2.6 Signal ID
         int signal_id=SignalBaseGetInteger(SIGNAL_BASE_ID);
         //3.订阅指定条件的信号
         if(roi>80 && subscribers_num>20 && subscription_price==0)
           {
            //3.1信号一些个性化参数设置
            //Agree to terms of use of Signals service
            SignalInfoSetInteger(SIGNAL_INFO_TERMS_AGREE,1);
            //Copy trades by subscription
            SignalInfoSetInteger(SIGNAL_INFO_SUBSCRIPTION_ENABLED,1);
            //Copy Stop Loss and Take Profit flag
            SignalInfoSetInteger(SIGNAL_INFO_COPY_SLTP,1);
            //The flag enables synchronization without confirmation dialog
            SignalInfoSetInteger(SIGNAL_INFO_CONFIRMATIONS_DISABLED,1);
            //Deposit percent 
            SignalInfoSetInteger(SIGNAL_INFO_DEPOSIT_PERCENT,70);
            //Equity limit
            SignalInfoSetDouble(SIGNAL_INFO_EQUITY_LIMIT,1000);
            //Slippage 
            SignalInfoSetDouble(SIGNAL_INFO_SLIPPAGE,3.5);
            //3.2订阅信号
            if(SignalSubscribe(signal_id)==false)
              {
               printf(GetLastError());
              }
           }
         int a=0;
        }
     }

  }
//+------------------------------------------------------------------+

3.3订阅成功后如下显示

image.png

如果您发现本文对你有所帮助,如果您认为其他人也可能受益,请把它分享出去。

相关文章

网友评论

    本文标题:MT5入门到精通之十六(系统自带跟单操作)

    本文链接:https://www.haomeiwen.com/subject/wfdetxtx.html