新人对MQL4和MQL5的任何问题,对算法和代码的帮助和讨论 - 页 1677

 
pribludilsa #:
为什么编译器会给出隐式枚举转换的警告?
long type = PositionGetInteger(POSITION_TYPE); 
 
pribludilsa #:
为什么编译器会给出隐式枚举转换的警告?


ENUM_POSITION_TYPE type = (ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE);
 
Taras Slobodyanik #:


+++
 
谢谢你们,兄弟们,你们是救世主。
 
pribludilsa #:
为什么编译器会产生隐式枚举转换警告?
因为PositionGetInteger(POSITION_TYPE);返回长类型的值,必须转换为枚举类型。
 
Galim_V #:

在剧本中。

这样做是正确的。选择要检查的数组中没有重复值的索引。

#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//обьявим класс
class Сleaner
 {
 public:     
         Сleaner() { Alert("Конструктор");
          }
           ~Сleaner() { Alert("Деструктор"); }
  void come(int &array[],int &re[]){ 
      int n=0; 
      ZeroMemory(re);   
  for(int i=0; i<ArraySize(array); i++) {
    if(ArraySearch(re, array[i])==-1) {
      n++;
      ArrayResize(re,n);
      re[n-1]=array[i];
      Print(" n =",n);
     }
   }
 }

private:
          int ArraySearch(int& m[], int e)
       {
        for(int i=0; i<ArraySize(m); i++) {
        if(m[i]==e){ 
        Print(" e =",e,", ArraySize(m) =",ArraySize(m)," ,m[i] =",m[i]," ,i =",i );
       return(i);
       }
       }
  return(-1);
    }
 };
Сleaner pi;
int arr[]= {2,2,7,7,4,4,6,6,8,8,9};
int res[];
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
    pi.come(arr,res);
     for(int z=0;z<ArraySize(res);z++)
  Print(res[z]);
  }
 
在打印的代码中找不到如何从#属性版本"1.07 "中插入版本号,没有这样的选项? 程序名称在那里,为什么版本不在那里?

 
Fast235 #属性版本"1.07 "中插入版本号,没有这样的可能性? 程序名称在那里,为什么版本不在那里?

没有。无论我问过多少次,答案总是一样的:沉默。;)

 
Fast235 #属性版本"1.07 "中插入版本号,没有这样的选项? 程序名称在那里,为什么版本不在那里?

像这样。

#property copyright "Maxim A.Kuznetsov"
#property link      "https://www.luxtrade.tk"
#property version   "1.00"

#define  VERSION "1.023"
#property version VERSION
void OnStart()
{
   PrintFormat("Version %s",VERSION);
}
 
Maxim Kuznetsov #:

像这样。

但问题是,为什么没有机会接触到

version

???

是的,并且要

copyright

и

link

???

原因: