Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1677

 
pribludilsa #:
Why does the compiler give the implicit enum conversion warning ?
long type = PositionGetInteger(POSITION_TYPE); 
 
pribludilsa #:
Why does the compiler give the implicit enum conversion warning ?


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


+++
 
Thank you, brothers, you're a lifesaver.
 
pribludilsa #:
Why does the compiler generate the implicit enum conversion warning?
Because PositionGetInteger(POSITION_TYPE); returns value of long type and must be converted to enum type.
 
Galim_V #:

In the script.

This works correctly. Selects indexes without repeating values from the array to be checked.

#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]);
  }
 
can't find how in the code for the print, to insert the version number from #property version"1.07", no such option? the program name is there, why isn't the version there as well?

 
Fast235 #property version"1.07", no such possibility? program name is there, why version is not there as well?

No. And no matter how many times I asked about it, the answer was always the same: silence. ;)

 
Fast235 #property version"1.07", no such option? the program name is there, why isn't the version there?

like this:

#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 #:

like this:

But the question is why is there no access to

version

???

Yes and to

copyright

и

link

???