記事"MQL4からMQL5への移植"についてのディスカッション - ページ 9

 
Sergey Pavlov:

この記事と同時に作成された。しかし、取引関数が なければ意味がない!

MQL5の取引機能と同時に動作するMQL4の取引機能を 作りました(kodobaseに投稿)。

ですから、エミュレータはまだ意味があるかもしれません。

 
fxsaber:

MQL5の取引関数と同時に動作するMQL4の取引関数を 作った(kodobaseにアップロードした)。

そのため、エミュレータの感覚が残っているかもしれません。

https://www.mql5.com/ja/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
Expert Advisor がテスト モードで実行されている場合は TRUE を返し、そうでない場合は FALSE を返します。
MQLInfoInteger

bool IsTesting()
  MQLInfoInteger(MQL_TESTER)
IsTesting
Expert Advisor がテスト モードで実行されている場合は 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' - 宣言されていない識別子 TZ_Sky_and_Ground_V_04.mq5 2895 12
'OBJPROP_TIME2' - 定数式 required TZ_Sky_and_Ground_V_04.mq5 2895 12
'OBJPROP_PRICE2' - 宣言されていない識別子 TZ_Sky_and_Ground_V_04.mq5 2897 12
'OBJPROP_PRICE2' - 定数式 required TZ_Sky_and_Ground_V_04.mq5 2897 12
'OBJPROP_TIME3' - 宣言されていない識別子 TZ_Sky_and_Ground_V_04.mq5 2899 12
'OBJPROP_TIME3' - 定数式 required TZ_Sky_and_Ground_V_04.mq5 2899 12
'OBJPROP_PRICE3' - 宣言されていない識別子 TZ_Sky_and_Ground_V_04.mq5 2901 12
'OBJPROP_PRICE3' - 定数式 required TZ_Sky_and_Ground_V_04.mq5 2901 12