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

 
Alexey Viktorov #:

If you need to close 0.3 and then 0.7 from the 1st lot, it is easier to open two orders with different takeoffs.

This is not convenient, in my scalp system you have to actively tactically follow the trades. + there can be impulses, and to open from different windows or to change a lot in seconds is such an activity :) It is easier to open 1 lot, and then partially fix. But do not fix manually, but by given price levels (price). If you work with 3 Takei, you will have to play the piano when opening deals.
 
TranceFM #:
It's not convenient, in my scalp system you have to actively tactically follow trades. + there can be impulses, and to open from different windows or change lot in seconds is such an activity :) It is easier to open 1 lot, and then partially fix. But do not fix manually, but by given price levels (price). If you work with 3 Takei, you will have to play the piano when opening trades.
Then order yourself an Expert Advisor
 
MakarFX #:
Then order yourself an advisor.

So there are no ready-made ones? Okay. (chuckles) How much would an owl like this cost?

 

In the script.

#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 AS=ArraySize(array);
        int n=0;    
  for(int i=0; i<AS; i++) {
    if(ArraySearch(re, array[i])==-1) {
      n++;
      ArrayResize(re,n);
      re[n-1]=array[i];
     }
   }
 }
 void sleep() { Sleep(1000); }
private:
          int ArraySearch(int& m[], int e)
       {
        for(int i=0; i<ArraySize(m); i++) {
        if(m[i]==e) return(i);
//        Print(" e =",e,", ArraySize(m) =",ArraySize(m)," ,m[i] =",m[i]," ,i =",i );
       }
  return(-1);
    }
 };
Сleaner pi;
int arr[]= {6,4,6,7,9,65,66,2,2,9,7,7};
int res[];
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
  
  pi.come(arr,res);
  pi.sleep();
  for(int z=0;z<ArraySize(res);z++)
  Print(res[z]);
   
  }
//+------------------------------------------------------------------+

works correctly.

2021.10.14 17:24:29.321 Eye_12 GBPUSD,M5: Alert: Destructor

2021.10.14 17:24:29.321 Eye_12 GBPUSD,M5: uninit reason 0

2021.10.14 17:24:29.321 Eye_12 GBPUSD,M5: 2

2021.10.14 17:24:29.321 Eye_12 GBPUSD,M5: 66

2021.10.14 17:24:29.321 Eye_12 GBPUSD,M5: 65

2021.10.14 17:24:29.321 Eye_12 GBPUSD,M5: 9

2021.10.14 17:24:29.321 Eye_12 GBPUSD,M5: 7

2021.10.14 17:24:29.321 Eye_12 GBPUSD,M5: 4

2021.10.14 17:24:29.321 Eye_12 GBPUSD,M5: 6

2021.10.14 17:24:28.209 Eye_12 GBPUSD,M5: initialized

2021.10.14 17:24:28.209 Eye_12 GBPUSD,M5: Alert: Constructor

The repetitions are removed from the array. In owt, if array.

int arr[]= {6,4,6,7,9,65,66,2,2,9,7,7};

is dynamic and it increases, also works correctly, but if it decreases, it starts to lie.

 

I don't know how faithfully I reproduced

#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 AS=ArraySize(array);
        int n=0;    
  for(int i=0; i<AS; i++) {
    if(ArraySearch(re, array[i])==-1) {
      n++;
      ArrayResize(re,n);
      re[n-1]=array[i];
     }
   }
 }
 void sleep() { Sleep(1000); }
private:
          int ArraySearch(int& m[], int e)
       {
        for(int i=0; i<ArraySize(m); i++) {
        if(m[i]==e) return(i);
//        Print(" e =",e,", ArraySize(m) =",ArraySize(m)," ,m[i] =",m[i]," ,i =",i );
       }
  return(-1);
    }
 };
Сleaner pi;
int arr[]= {6,6,2};
int res[];
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {

   arr[0]= 6;
   arr[1]= 6;

  pi.come(arr,res);
//  pi.sleep();
  for(int z=0;z<ArraySize(res);z++)
  Print(res[z]);
   
  }
//+------------------------------------------------------------------+

but that's exactly the result in the owl

2021.10.14 21:11:34.802 Oko_12 GBPUSD,M5: Alert: Destructor

2021.10.14 21:11:34.802 Eye_12 GBPUSD,M5: uninit reason 0

2021.10.14 21:11:34.523 Eye_12 GBPUSD,M5: 2

2021.10.14 21:11:34.523 Eye_12 GBPUSD,M5: 6

2021.10.14 21:11:34.523 Eye_12 GBPUSD,M5: initialized

2021.10.14 21:11:34.523 Eye_12 GBPUSD,M5: Alert: Constructor


 
Hello all, Mr. experienced developer, could you please advise a beginner? I am interested in the process of packing MQL4 Expert Advisor in one ex4 file for uploading to Market if I have a custom indicator connected through iCustom (and the indicator itself is also connected to another indicator, and the latter in its turn is a library). I wonder if there is an easy way to move all this stuff to one file or will I have to integrate everything directly in the EA code?
 
Aleksandr Kononov custom indicator connected through iCustom (and the indicator itself is also connected to another indicator, and the latter in its turn is connected to the library). I wonder if there is an easy way to move all this stuff to one file or will I have to integrate everything directly in the EA code?

have to integrate everything

 
Aleksandr Kononov custom indicator connected through iCustom (the indicator itself is also connected to another indicator, and the latter in its turn is connected to the library). I wonder if there is an easy way to move all this stuff to one file or will I have to integrate everything directly in the EA code?

Connect through a resource

 
Vitaly Muzichenko #:

Connect through a resource

Thanks for reading🤜🤛
 
ENUM_POSITION_TYPE type = PositionGetInteger(POSITION_TYPE);
Why does the compiler give the implicit enum conversion warning ?
Документация по MQL5: Торговые функции / PositionGetInteger
Документация по MQL5: Торговые функции / PositionGetInteger
  • www.mql5.com
PositionGetInteger - Торговые функции - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
Reason: