文章 "从 MQL4 迁移到 MQL5" - 页 9

 
Sergey Pavlov:

它与这篇文章同时创建。但没有交易功能 就没有意义!

我制作了(发布在 kodobase 中)可与 MQL5 交易功能 同时使用的 MQL4 交易功能。

因此,模拟器可能仍然有意义。

 
fxsaber:

我已经制作了(上传到 kodobase)可与 MQL5 交易功能 同时使用的 MQL4 交易功能。

因此,模拟器可能仍有意义。

https://www.mql5.com/zh/code/16006
MT4Orders
MT4Orders
  • 2016.08.05
  • fxsaber
  • www.mql5.com
Параллельное использование ордерных систем MetaTrader 4 и MetaTrader 5.
 

更多相关信息。

MQL's OOP notes: Converting MetaTrader 4 indicators to MetaTrader 5
MQL's OOP notes: Converting MetaTrader 4 indicators to MetaTrader 5
  • 2016.09.28
  • //www.mql5.com/en/users/marketeer">
  • www.mql5.com
It has been a long time since MetaTrader 5 was released, but MQL products for MetaTrader 4 do still prevail on mql5.com site (both in the codebase, and in the market), and in the Internet in general....
 
buh400:
我意识到这个问题已经被提出来了,我需要阅读另一篇文章:)我的帖子可以删除

请告诉我您意识到了什么,需要阅读哪篇文章,以及如何修复上述错误?

在这里,我的理解是由用户 添加一个指标--这就是我发表评论的原因...
 
MT4Orders
MT4Orders
  • 投票: 27
  • 2016.10.10
  • fxsaber
  • www.mql5.com
Parallel use of the MetaTrader 4 and MetaTrader 5 order systems.
 

我假设所有

MQLInfoInteger(MQL5_....


应改为

MQLInfoInteger(MQL_
 

请更正

bool IsTesting()
bool MQLInfoInteger(MQL5_TESTING)
IsTesting
如果智能交易系统在测试模式下运行,则返回 TRUE,否则返回 FALSE。
MQLInfoInteger

bool IsTesting()
  MQLInfoInteger(MQL_TESTER)
IsTesting
如果智能交易系统在测试模式下运行,则返回 TRUE,否则返回 FALSE。
MQLInfoInteger

MQL5_TESTING dont work please change it to  MQL_TESTER.
IsTesting - Checkup - MQL4 Reference
IsTesting - Checkup - MQL4 Reference
  • docs.mql4.com
IsTesting - Checkup - MQL4 Reference
 
Enum MAIN_SIGNAL_MODE { MODE_MAIN , MODE_SIGNAL}; 

enum ADX_MODE        { MODE_MAIN,         MODE_PLUSDI, MODE_MINUSDI };

2 相同定义创建错误 请修复此错误。
 

iBarShift 无法工作。

我的执行方式--不是很确定,但运行正常,而且似乎有意义

int iBarShift(string symbol,int tf,datetime time,bool exact=false)
  {
   if(time<0) return(-1);
   ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
   datetime Arr[],time1;
   CopyTime(symbol,timeframe,0,1,Arr);
   time1=Arr[0];
   if(time1<time){
      return(0); /// 如果给定时间小于酒吧营业时间
   }
   if(CopyTime(symbol,timeframe,time,time1,Arr)>0)
     {
      return(ArraySize(Arr));
     }
   else return(-1);
  }
 

我不知道如何使用该函数

bool ObjectSetMQL4(string name,
                   int index,
                   double value)
  {
   switch(index)
     {
      case OBJPROP_TIME1:
         ObjectSetInteger(0,name,OBJPROP_TIME,(int)value);return(true);
      case OBJPROP_PRICE1:
         ObjectSetDouble(0,name,OBJPROP_PRICE,value);return(true);
      case OBJPROP_TIME2:
         ObjectSetInteger(0,name,OBJPROP_TIME,1,(int)value);return(true);
      case OBJPROP_PRICE2:
         ObjectSetDouble(0,name,OBJPROP_PRICE,1,value);return(true);
      case OBJPROP_TIME3:
         ObjectSetInteger(0,name,OBJPROP_TIME,2,(int)value);return(true);
      case OBJPROP_PRICE3:
         ObjectSetDouble(0,name,OBJPROP_PRICE,2,value);return(true);
      case OBJPROP_COLOR:
         ObjectSetInteger(0,name,OBJPROP_COLOR,(int)value);return(true);
      case OBJPROP_STYLE:
         ObjectSetInteger(0,name,OBJPROP_STYLE,(int)value);return(true);
      case OBJPROP_WIDTH:
         ObjectSetInteger(0,name,OBJPROP_WIDTH,(int)value);return(true);
      case OBJPROP_BACK:
         ObjectSetInteger(0,name,OBJPROP_BACK,(int)value);return(true);
      case OBJPROP_RAY:
         ObjectSetInteger(0,name,OBJPROP_RAY_RIGHT,(int)value);return(true);
      case OBJPROP_ELLIPSE:
         ObjectSetInteger(0,name,OBJPROP_ELLIPSE,(int)value);return(true);
      case OBJPROP_SCALE:
         ObjectSetDouble(0,name,OBJPROP_SCALE,value);return(true);
      case OBJPROP_ANGLE:
         ObjectSetDouble(0,name,OBJPROP_ANGLE,value);return(true);
      case OBJPROP_ARROWCODE:
         ObjectSetInteger(0,name,OBJPROP_ARROWCODE,(int)value);return(true);
      case OBJPROP_TIMEFRAMES:
         ObjectSetInteger(0,name,OBJPROP_TIMEFRAMES,(int)value);return(true);
      case OBJPROP_DEVIATION:
         ObjectSetDouble(0,name,OBJPROP_DEVIATION,value);return(true);
      case OBJPROP_FONTSIZE:
         ObjectSetInteger(0,name,OBJPROP_FONTSIZE,(int)value);return(true);
      case OBJPROP_CORNER:
         ObjectSetInteger(0,name,OBJPROP_CORNER,(int)value);return(true);
      case OBJPROP_XDISTANCE:
         ObjectSetInteger(0,name,OBJPROP_XDISTANCE,(int)value);return(true);
      case OBJPROP_YDISTANCE:
         ObjectSetInteger(0,name,OBJPROP_YDISTANCE,(int)value);return(true);
      case OBJPROP_FIBOLEVELS:
         ObjectSetInteger(0,name,OBJPROP_LEVELS,(int)value);return(true);
      case OBJPROP_LEVELCOLOR:
         ObjectSetInteger(0,name,OBJPROP_LEVELCOLOR,(int)value);return(true);
      case OBJPROP_LEVELSTYLE:
         ObjectSetInteger(0,name,OBJPROP_LEVELSTYLE,(int)value);return(true);
      case OBJPROP_LEVELWIDTH:
         ObjectSetInteger(0,name,OBJPROP_LEVELWIDTH,(int)value);return(true);

      default: return(false);
     }
   return(false);
  }

编译器警告

'OBJPROP_TIME1' - 未声明标识符 TZ_Sky_and_Ground_V_04.mq5 2891 12
'OBJPROP_TIME1' - 需要常量表达式 TZ_Sky_and_Ground_V_04.mq5 2891 12
'OBJPROP_PRICE1' - 未声明的标识符 TZ_Sky_and_Ground_V_04。mq5 2893 12
'OBJPROP_PRICE1' - 需要常量表达式 TZ_Sky_and_Ground_V_04。mq5 2893 12
'OBJPROP_TIME2' - undeclared identifier TZ_Sky_and_Ground_V_04.mq5 2895 12
'OBJPROP_TIME2' - constant expression required TZ_Sky_and_Ground_V_04.mq5 2895 12
'OBJPROP_PRICE2' - 未声明的标识符 TZ_Sky_and_Ground_V_04。mq5 2897 12
'OBJPROP_PRICE2' - 需要常量表达式 TZ_Sky_and_Ground_V_04.mq5 2897 12
'OBJPROP_TIME3' - 未声明的标识符 TZ_Sky_and_Ground_V_04。mq5 2899 12
'OBJPROP_TIME3' - 需要常量表达式 TZ_Sky_and_Ground_V_04.mq5 2899 12
'OBJPROP_PRICE3' - 未声明标识符 TZ_Sky_and_Ground_V_04.mq5。mq5 2901 12
'OBJPROP_PRICE3' - 需要常量表达 TZ_Sky_and_Ground_V_04.mq5 2901 12