Errors, bugs, questions - page 3133

 
Yury Lemeshev #:

Be consistent. If you check

SymbolIsSynchronized(euSY01)==true

then check and

(euSY01b>0)==true

:)

 
Yury Lemeshev #:

If you do this, and there are seven such lines in the code for seven pairs, then the market overview will only have quotes for one currency.


Expensive function, I would bypass it through equality to the previous value.
 
JRandomTrader #:

Be consistent. If you check

then check and

:)

(euSY01b>0)==true

It's better than just

euSY01b>0
 
2022.01.02 11:03:22.330 2019.01.02 07:56:40 EURJPY false
2022.01.02 11:03:22.330 2019.01.02 07:56:40 EURCAD false
2022.01.02 11:03:22.330 2019.01.02 07:56:40 EURCHF false
2022.01.02 11:03:22.330 2019.01.02 07:56:40 EURGBP false
2022.01.02 11:03:22.330 2019.01.02 07:56:40 EURAUD false
2022.01.02 11:03:22.330 2019.01.02 07:56:40 EURNZD false
2022.01.02 11:03:22.330 2019.01.02 07:56:40 EURUSD true
2022.01.02 11:03:22.330 2019.01.02 07:56:42 EURJPY false
2022.01.02 11:03:22.330 2019.01.02 07:56:42 EURCAD false
2022.01.02 11:03:22.330 2019.01.02 07:56:42 EURCHF false
2022.01.02 11:03:22.330 2019.01.02 07:56:42 EURGBP false
2022.01.02 11:03:22.330 2019.01.02 07:56:42 EURAUD false
2022.01.02 11:03:22.330 2019.01.02 07:56:42 EURNZD false
2022.01.02 11:03:22.330 2019.01.02 07:56:42 EURUSD true


If you check synchronisation, it only works for one currency. I need to analyse 7 currencies at a time.

 
Yury Lemeshev #:
If you check the synchronisation, it only works for one currency. But I need to analyse 7 currencies at a time.

I need to do it in OnInit()

// Потрогаем символ, иначе в тестере не грузит историю
 for(int i=0;i<CountSymbol;i++) {
   iClose(SymbTrade[i],PERIOD_CURRENT,1);
 }
 
Yury Lemeshev #:
2022.01.02 11:03:22.330 2019.01.02 07:56:40 EURJPY false
2022.01.02 11:03:22.330 2019.01.02 07:56:40 EURCAD false
2022.01.02 11:03:22.330 2019.01.02 07:56:40 EURCHF false
2022.01.02 11:03:22.330 2019.01.02 07:56:40 EURGBP false
2022.01.02 11:03:22.330 2019.01.02 07:56:40 EURAUD false
2022.01.02 11:03:22.330 2019.01.02 07:56:40 EURNZD false
2022.01.02 11:03:22.330 2019.01.02 07:56:40 EURUSD true
2022.01.02 11:03:22.330 2019.01.02 07:56:42 EURJPY false
2022.01.02 11:03:22.330 2019.01.02 07:56:42 EURCAD false
2022.01.02 11:03:22.330 2019.01.02 07:56:42 EURCHF false
2022.01.02 11:03:22.330 2019.01.02 07:56:42 EURGBP false
2022.01.02 11:03:22.330 2019.01.02 07:56:42 EURAUD false
2022.01.02 11:03:22.330 2019.01.02 07:56:42 EURNZD false
2022.01.02 11:03:22.330 2019.01.02 07:56:42 EURUSD true


If you check synchronisation, it only works for one currency. And I need to analyse 7 currencies in a moment.

As a crutch, you could try to remember the time when the pair was last synchronised and use that as a reference.

Also, you can use SymbolInfoTick() for ask and bid

 

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

Yury Lemeshev, 2022.01.02 08:54

(euSY01b>0)==true

This is more correct than just

euSY01b>0

it is like true == true, result: true. and false == true, result: false :)

this is exactly the result you get if

if (true) { // управление передается коду в скобках
  ...
}

if (false) { // управление не передаётся коду в скобках
  ...
}

or

// в if не 0 - true
if (1) {
  ...
}

if (-1) {
  ...
}

// в if 0 - false
if (0) {
  ...
}
 
Yury Lemeshev #:

If you do this, and there are 7 such lines in the code for seven pairs, then the market overview will only show quotes for one currency.


try calling Bars in OnTick

https://www.mql5.com/ru/docs/series/bars

from the article:

   int bars=Bars(_Symbol,_Period);
   if(bars>0)
     {
      Print("Количество баров в истории терминала по символу-периоду на данный момент = ",bars);
     }
   else  //нет доступных баров
     {
      //--- видимо, данные по символу не синхронизированы с данными на сервере
      bool synchronized=false;
      //--- счетчик цикла
      int attempts=0;
      // сделаем 5 попыток дождаться синхронизации
      while(attempts<5)
        {
         if(SeriesInfoInteger(Symbol(),0,SERIES_SYNCHRONIZED))
           {
            //--- есть синхронизация, выходим
            synchronized=true;
            break;
           }
         //--- увеличим счетчик
         attempts++;
         //--- подождем 10 миллисекунд до следующей итерации
         Sleep(10);
        }
      //--- вышли из цикла по факту синхронизации
      if(synchronized)
        {
         Print("Количество баров в истории терминала по символу-периоду на данный момент = ",bars);
         Print("Самая первая в истории терминала дата по символу-периоду на данный момент = ",
               (datetime)SeriesInfoInteger(Symbol(),0,SERIES_FIRSTDATE));
         Print("Самая первая дата в истории по символу на сервере = ",
               (datetime)SeriesInfoInteger(Symbol(),0,SERIES_SERVER_FIRSTDATE));
        }
      //--- синхронизация данных так и не была достигнута
      else
        {
         Print("Не удалось получить количество баров на ",_Symbol);
        }
     }
also, reference to prices in OnTick should be (so that third-party characters are loaded).
Документация по MQL5: Доступ к таймсериям и индикаторам / Bars
Документация по MQL5: Доступ к таймсериям и индикаторам / Bars
  • www.mql5.com
Bars - Доступ к таймсериям и индикаторам - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Mihail Matkovskij #:

try calling Bars in OnTick

https://www.mql5.com/ru/docs/series/bars

from the article:

Also, there should be a reference to prices in OnTick (so that third-party characters are loaded).

This does not solve the problem of the original

SymbolInfoDouble(euSY06,SYMBOL_BID,euSY06b) is always filled with value when used correctly. For some reason the correct value for the required symbol does not come. And it seems to be filled using the previous value received, which is the value of one of the other seven currencies.

If there is no solution, and this solution I am looking for more than a month, I feel that it is just a bug tester. Developers please pay attention to this. If it is a bug fix it
 
Vitaly Muzichenko #:

I need to do in OnInit()

But when I test one of my multisymbol indicators, the list of symbols from the string of input parameters is loaded in OnInit. And their prices are accessed in OnCalculate. Moreover, when I set to load symbols from Market Watch, only one basic symbol appears in the tester.

Reason: