Errors, bugs, questions - page 2823

 
Nikolai Semko:

decided to check the speed rambling version.
And the result was surprising.
Comparison even of pre-normalized double is even slower on average than if double is compared through epsilon or through conversion to int

The result:

I do not exclude that many things depend on the novelty and architecture of the processor and some programmers may get a different result.

Surprisingly, the rounding to integer function returns a real number, not an integer, and you have to round the type to an integer as well. Where is the logic of the language?
 
Nikolai Semko:

Does the performance of the operation comparing two doubles depend on the values of the variables themselves? I doubt it.

It seems to be so. It's rather strange.
If you replace the line in the example above

double test = 1.11;

to

double test = NormalizeDouble(1.11,2);

the simple comparison of two double's starts working faster than other options. Although it can be either double or double. What difference does it seem? But the resulting performance is two times faster. It's like a miracle.

2020.08.10 17:40:13.583 TestCompareDouble (USDCAD,H4)   простое сравнение предварительно нормализированых double 1 - 552 микросекунд, всего совпадений = 507
2020.08.10 17:40:13.583 TestCompareDouble (USDCAD,H4)   простое сравнение предварительно нормализированых double 2 - 954 микросекунд, всего совпадений = 507
2020.08.10 17:40:13.583 TestCompareDouble (USDCAD,H4)   сравнение double через эпсилон                             - 778 микросекунд, всего совпадений = 507
2020.08.10 17:40:13.583 TestCompareDouble (USDCAD,H4)   сравнение double через преобразование в int                - 854 микросекунд, всего совпадений = 507
Files:
 
Alexey Navoykov:

The test is incorrect. Why do you divide by 100000.0 only once at the end? It should be performed at each iteration and then summed up. That's a fair comparison. But this is not normalization at all - you have just optimized your test algorithm. Of course it will be faster and more accurate (since the accumulated error is reduced).

Yes, you're right. The accuracy will be the same as with NormalizeDouble if you divide it at each iteration. But the speed will still be higher than with NormalizeDouble.

2020.08.10 21:38:48.652 TestCompareDouble (USDCAD,H4)   простая сумма                            - 1394 микросекунд, сумма = -3604329.1567609389312565
2020.08.10 21:38:48.652 TestCompareDouble (USDCAD,H4)   сумма с NormalizeDouble                  - 5861 микросекунд, сумма = -3604329.1543100476264954
2020.08.10 21:38:48.652 TestCompareDouble (USDCAD,H4)   сумма, нормализированная через int       - 2179 микросекунд, сумма = -3604329.1543100476264954

Thank you.

 

Generally speaking, after rounding to a whole number, returning a non-whole number is not good. Previously in printers I have seen almost whole numbers with zeros after the decimal point and one at the end, or with nines after the decimal point. I thought it was a bug. Turns out to be an unclear position of the developers. Well, rounding to integer, you should remove the remainder after the decimal point in binary form but apparently it is difficult/impossible to zero the mantissa. About normalization is even more complicated, even if we move a comma to 5 digits and integer in binary, reverse rounding to double will give a difference with integer type.

Sadly, one has to crutch on seemingly simple comparison operations.

Not python.))))

 
Valeriy Yastremskiy:

Generally speaking, after rounding to a whole number, returning a non-whole number is not good. Previously in printers I have seen almost whole numbers with zeros after the decimal point and one at the end, or with nines after the decimal point. I thought it was a bug. Turns out to be an unclear position of the developers. Well, rounding to integer, you should remove the remainder after the decimal point in binary form but apparently it is difficult/impossible to zero the mantissa. About normalization is even more complicated, even if we move the comma to 5 digits and integer in binary, reverse rounding to double will give a difference with integer type.

Sadly, we have to crunch on seemingly simple comparison operations.

Expressions after rounding can contain some other operations with resulting data, and not necessarily integer. Then we will have to convert it back to double from int, creating an overhead on the spot.

No one prevents you from creating your own functions RoundInt or RoundLong, which will return the required type.

 

There is a problem with the tester in the marketplace.

If I test a multi-currency EA, the tester hangs.

The reason: During the analysis of the financial instrument, the Expert Advisor stumbles on the instruments with no history or the instrument is not properly designed.

In the standard terminal it hangs for 29 seconds, that's for sure and it's checked.

The tester in the Market reports too long testing.

I assume that the Expert Advisor encounters several such broken financial instruments.

This problem has been written about several times and a year ago, but it's still there....

 
Vladimir Pastushak:

This problem has been written about several times and a year ago, but it's still there....

It's not working for me. Please attach your source code.

 

Can you comment on why the function does not work? It does not switch to 0 chart.

ChartSetInteger(0,CHART_BRING_TO_TOP,0,true);

The second and further application of the pattern duplicates the windows

ChartApplyTemplate(0,"Template.tpl");

These functions worked before the update.

 
fxsaber:

It's not playing for me. Attach your source code.

Test on Demo Metakvotes servers

void OnStart()
  {
   int m_all_symbols = SymbolsTotal(false);
   string m_sym_name = "";
   for(int i = 0; i < m_all_symbols; i++)
     {
      // ======================================================================
      // === Получили имя символа
      if((m_sym_name = SymbolName(i, false)) != NULL)
        {
         // ======================================================================
         // === Если символ не выбран в окне маркет ватч
         if(!SymbolInfoInteger(m_sym_name, SYMBOL_SELECT))
            if(!SymbolSelect(m_sym_name, true))
               Print(" SymbolSelect " + m_sym_name);
         ulong get = GetMicrosecondCount();
         MqlRates rateM1[1440];
         if(CopyRates(m_sym_name, PERIOD_M1, 0, 1440, rateM1) > 0)
           {
            Print(m_sym_name, "  ", (GetMicrosecondCount() - get));
           }
         else
            Print("Error  ",m_sym_name, "  ", (GetMicrosecondCount() - get));
        }
     }
  }


2020.08.11 20:20:55.657 test (EURUSD,M15) MXNJPY 1998

2020.08.11 20:20:55.659 test (EURUSD,M15) NZDMXN 1979

2020.08.11 20:20:55.661 test (EURUSD,M15) USDCOP 1973

2020.08.11 20:20:55.663 test (EURUSD,M15) USDARS 2093

2020.08.11 20:20:55.665 test (EURUSD,M15) USDCLP 1929

2020.08.11 20:21:25.259 test (EURUSD,M15) Error AUS200 29593673

2020.08.11 20:21:54.837 test (EURUSD,M15) Error FCHI40 29578404

2020.08.11 20:22:24.336 test (EURUSD,M15) Error GDAXIm 29498485

2020.08.11 20:22:53.949 test (EURUSD,M15) Error HSI50 29612968

2020.08.11 20:23:23.458 test (EURUSD,M15) Error Jap225 29509059

2020.08.11 20:23:52.919 test (EURUSD,M15) Error ND100m 29461316

2020.08.11 20:24:22.425 test (EURUSD,M15) Error SP500m 29505571

2020.08.11 20:24:51.860 test (EURUSD,M15) Error SPN35 29435460

2020.08.11 20:25:21.273 test (EURUSD,M15) Error STOX50 29412578

2020.08.11 20:25:50.663 test (EURUSD,M15) Error UK100 29389644

2020.08.11 20:26:20.205 test (EURUSD,M15) Error Brent 29542597

2020.08.11 20:26:49.667 test (EURUSD,M15) Error Crude 29462066

2020.08.11 20:27:19.194 test (EURUSD,M15) Error NatGas 29526780




 
Vladimir Pastushak:

Testing on Demo Metacvots servers

Pardon me, it's hanging up now....

This script did not cause the Terminal to hang on my machine.

Reason: