mql5 documentation errors, defaults or inconsistencies. - page 4

 
William Roeder #:
That is the initialization list for an array, but you have only a single variable.
Right, but even if given for an array, it doesn't work.

struct _test
{
    public:
    double arr[];
};


//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
    _test test_me = { { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 } };

    return(INIT_FAILED);
};

Edit: or, you have misunderstood.... Not sure.
 

this works but you lose integers

struct _test_dynamic
{
    public:
    vector arr;
};

struct _test_static
{
    public:
    double arr[8];
};

int OnInit()
  {
    _test_dynamic   test_me_A = { {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0} };
    _test_static    test_me_B = { {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0} };
    Print(test_me_A.arr);
  return(INIT_SUCCEEDED);
  }
 
Dominik Egert #: Right, but even if given for an array, it doesn't work.
    _test test_me = { { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 } };

That is a single variable not an array.  Stop trying to use initializer lists on a single variable.

 
William Roeder #:

That is a single variable not an array.  Stop trying to use initializer lists on a single variable.

No, William, you are wrong on this. Please take a precise look. - It is behaving differently than documented, and it is behaving inconsistent/buggy.
 
Lorentzos Roussos #:

this works but you lose integers

Yes, but that's not the point. I figured that out before posting.
 
As documented here:

https://www.mql5.com/en/docs/basis/variables/inputvariables#group

It is possible to create "groups" for inputs to programs of ex5 types...

When doing so for an indicator, and using the keyword group, this will be considered as an input to be counted for calling iCustom.

iCustom, as documented here:

Takes in as parameters the inputs to the indicator being loaded. This follows in sequence the inputs as they are defined by input statements inside the indicator itself.

When the indicator uses input group for "grouping" inputs, it is mandatory to accout for these "groups" with an empty string, as they are internally (by the terminal) handled as regular inputs.

For a detailed explanation see this thread please:



 

Since we are still waiting for MQ to add commission details to the MQL-API, I have found in

Include/Trade/PositionInfo.mqh

this member function:

//+------------------------------------------------------------------+
//| Get the property value "POSITION_COMMISSION"                     |
//+------------------------------------------------------------------+
double CPositionInfo::Commission(void) const
  {
   return(PositionGetDouble(POSITION_COMMISSION));
  }

Which seems to show an undocumented predefined constant/enum to retrieve a positions commission charge.

MetaEditor does not mark this constant as "red" (default color scheme) and therefore does not acknowledge this as existing/valid, but mql5.com does.

Also there is no mentioning of POSITION_COMMISSION in the documentation, at lest I was unable to find it.

EDIT:

https://www.mql5.com/en/forum/374848

EDIT2:

StrikeOut: See next post, please.

How to get commission per lot in MQL5 - How can I get commission per lot from a broker?
How to get commission per lot in MQL5 - How can I get commission per lot from a broker?
  • 2021.08.04
  • www.mql5.com
Is there a programagic way (like symbolinfodouble, or accountinfodouble) to get the broker's commission per lot. Commission per trade = turnover x commission rate = $11. I just want to grab it from inside mql5
 
Dominik Egert #: POSITION_COMMISSION

It is documented with a single line in Documentation on MQL5: List of MQL5 Constants

POSITION_COMMISSION

Commission

PositionGetDouble

But nothing else is explained about it.

EDIT: It probably only returns the current entry commission of a position just as it is mentioned in the Standard Library class method documentation ...

Return Value: Amount of commission of the position (in deposit currency).

Documentation on MQL5: List of MQL5 Constants
Documentation on MQL5: List of MQL5 Constants
  • www.mql5.com
List of MQL5 Constants - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: