Errors, bugs, questions - page 1933

 
fxsaber:
The difference is more than 1e-15. Moreover, num != Norm. They are different numbers, not the same numbers.

My MT4 outputs true, true and difference 0. ;-)

 
Stanislav Korotky:

My MT4 outputs true, true and difference 0. ;-)

An undocumented way of distinguishing MT4/5 has formed. And MT5 bit rate has nothing to do with it.

 
fxsaber:

An undocumented way of distinguishing MT4/5 has formed. And MT5 bitness has nothing to do with it.

Besides that in mql4 works and in mql5 not even the documented operation prefix increment(++i) and decrement (--k)

Документация по MQL5: Основы языка / Операции и выражения / Арифметические операции
Документация по MQL5: Основы языка / Операции и выражения / Арифметические операции
  • www.mql5.com
Основы языка / Операции и выражения / Арифметические операции - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Alexey Viktorov:

Except that in mql4 it works, but in mql5 not even the documented operation prefix increment(++i) and decrement (--k)

I didn't see a problem

void OnStart()
{
  int i = 0;
  
  Print(i++ == 0); // true
  Print(++i == 2); // true
}
 
fxsaber:

An undocumented way of distinguishing MT4/5 has formed. And MT5 bitness has nothing to do with it.

It's not even the MT4/5 difference, it's whether #property strict is enabled.

If it is enabled, they will be different, if not, they won't.

There are different implementations of NormalizeDouble!
 

In what cases can reason=0 be passed to OnDeinit in indicators?

 
fxsaber:
The difference is more than 1e-15. Moreover, Num != Norm. These are different numbers, not the same numbers.

What about the zero degree? Degrees from 0 to -14 are a total of 15 digits. A degree of -15 is the 16th degree. I think so.

 
Stanislav Korotky:

What about the zero degree? Degrees from 0 to -14 are a total of 15 digits. A degree of -15 is the 16th degree. I think so.

See how many digits theDBL_MIN differs from zero.

 

Release version of the script is almost 3 times slower than Debug version.

string  PositionGetString2( const ENUM_POSITION_PROPERTY_STRING  Property_id )
{
  return(PositionGetString(Property_id));
}

#define  TOSTRING(A) #A + " = " + (string)(A)

void OnStart()
{
  if (PositionSelect(_Symbol))
  {
    const ulong StartTime = GetMicrosecondCount();
    
    for (int i = 0; i < 1 e7; i++)
    {
      PositionGetString2(POSITION_SYMBOL);
      PositionGetString2(POSITION_COMMENT);
    }
    
    Print(TOSTRING(GetMicrosecondCount() - StartTime));
  }
}

Steps to play

  1. Select EURUSD for debugging and open its chart in the terminal.
  2. Open one position on EURUSD.
  3. Start the debug version in ME by pressing F5 and see the result in the log.
  4. Recompile to ME using F7 - this is very important otherwise EX5 will be debug.
  5. Run the Release script from the terminal and view the logged results.
Debug-version result

GetMicrosecondCount()-StartTime = 638537


Release version result

GetMicrosecondCount()-StartTime = 1746492
 

When importing ticks into a custom tkc symbol, the tkc files are not readable.