Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1579

 
Zuko Lee #:
Exactly :) Thank you very much! Could you please add a notification option to it? Thank you very much
Email me, I'll add it
 
Papa Hoth #:
Everything is deleted there, send me the owls, I will write it normally, there is no need to touch the history at all

in mt5?

 
Vitaly Muzichenko #:

in mt5?

Everywhere and 4 and 5
 
Vitaly MuzichenkoTradução #:

Eu realmente espero que alguém definitivamente faça isso neste tópico, há alguns bons programadores aqui.

very tks :*

 
Could you tell me how the condition looks like in the code : if a sell position is opened on the account with magik "0" (opened manually) ? mt5
 
Vitaly Muzichenko #:

in mt5?

after any condition, write this, all objects will be deleted in the tester.

  ObjectsDeleteAll(0,"",0,-1);//---------------------------------------->🔄
  ChartRedraw(); 
 
Aleksei Gureev position is opened on the account with magik "0" (opened manually) ? mt5

there is no such condition, there is only a condition if it is not opened manually. If you really need this action, you can specify migic as -1 (for all) or 0.

 
Aleksei Gureev position is opened on the account with magik "0" (opened manually) ? mt5
   int Total=PositionsTotal();
   for(int i=Total-1; i>=0; i--){
      if(m_position.SelectByIndex(i)){
         if(m_position.Symbol()==m_symbol.Name()){
            if(m_position.PositionType()==POSITION_TYPE_SELL && m_position.Magic()==m_Magic) Любой нужный
 if(m_position.PositionType()==POSITION_TYPE_SELL && m_position.Magic()==0)  Руками
 if(m_position.PositionType()==POSITION_TYPE_SELL && m_position.Magic()!=0)   Все кроме руками
 if(m_position.PositionType()==POSITION_TYPE_SELL && m_position.Magic()==-1) Все
 if(m_position.PositionType()==POSITION_TYPE_SELL ) Тоже Все
 

lynxntech #:

How to collect "Checksum" of parameters from for example such a series of parameters?

it is necessary for checking the same conditions in different terminals and passes in the tester.

and the upper true has "weight" more than the lower and subsequent ones for example

Form a string of parameters:

string params = "b1=" + (string) b1 + "a1=" + (string) a1 + ...;

and calculate hash from it, for example, by this function:

#define  FOREACH(A, D)   { for(int i=0, im=ArraySize(A);i<im;i++) {D;} }

//+------------------------------------------------------------------+
//| Хеш-значение параметров эксперта                                 |
//+------------------------------------------------------------------+
string CVirtualAdvisor::HashParams(string p_params) {
   uchar hash[], key[], data[];

// Вычисляем хеш от строки инициализации
   StringToCharArray(p_params, data);
   CryptEncode(CRYPT_HASH_MD5, data, key, hash);

// Переводим его из массива чисел в строку с шестнадцатеричной записью
   string res = "";
   FOREACH(hash, res += StringFormat("%X", hash[i]); if(i % 4 == 3 && i < 15) res += "-");

   return res;
}
 
Yuriy Bykov #:

Form a string from the parameters:

and calculate the hash from it, for example, with this function:

it's a lot of code, if it was possible, as in FastReport, to set properties in the function and it went through all variables and returned the result, it was the only correct solution (there you only need properties, you don't need to enumerate variables)

in my case, the solution gives almost 100% simple result, it is only for my perception, not for automation.

For automation, I don't see a normal solution to check all input variables, and does the robot need such a solution?