mql5 documentation errors, defaults or inconsistencies. - page 2

 
Rashid Umarov # :

Fixed, thank you

there is more: same error

      ...
      levels!=ArraySize(widths) || levels!=ArraySize(widths))

error1

error2

error3

error4

error5

<Post edited and fixed by moderator>

Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types / OBJ_FIBOTIMES
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types / OBJ_FIBOTIMES
  • www.mql5.com
OBJ_FIBOTIMES - Object Types - Objects Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Rajesh Kumar Nait #:

there is more: same error

error1

error2

error3

error4

error5

<Post edited and fixed by moderator>

Thank you. This will not cause an error, so it will be fixed sometime later.

 

In the opencl example you have an error in the cl code i think :

if (kernel_index>total_arrays) return;  

should be 

if (kernel_index>=total_arrays) return;  

its here :

https://www.mql5.com/en/docs/opencl/clprogramcreate

cheers

Documentation on MQL5: Working with OpenCL / CLProgramCreate
Documentation on MQL5: Working with OpenCL / CLProgramCreate
  • www.mql5.com
CLProgramCreate - Working with OpenCL - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

CL_DEVICE_MAX_WORK_GROUP_SIZE 

From Khronos :  Maximum number of work-items in a work-group executing a kernel 

Your docs :  The total number of the local working groups 

https://www.mql5.com/en/docs/opencl/clgetinfointeger

Documentation on MQL5: Working with OpenCL / CLGetInfoInteger
Documentation on MQL5: Working with OpenCL / CLGetInfoInteger
  • www.mql5.com
CLGetInfoInteger - Working with OpenCL - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

On the documentation page  https://www.mql5.com/en/docs/basis/types/casting

Typecasting

There is a mistake in the example script that derives the numeric limits for "safe" typecasting long -> double without losing precision.

  When converting  long/ulong type into double, precision may be lost in case the integer value is greater than 9223372036854774784 or less than -9223372036854774784.

The correct statement should be:

  When converting  long/ulong type into double, precision may be lost in case the integer value is greater than 9007199254740992 or less than -9007199254740992, i.e., [-2^53, 2^53].

Corrected version of the script:

void OnStart()
  {
   long l_max=LONG_MAX; // 2^63 -1 (9223372036854775807)
   long l_min=LONG_MIN; // -2^63 (-9223372036854775808)
//--- define the highest integer value, which does not lose accuracy when being cast to double
   while(l_max!=long((double)l_max))
      l_max/=2;
//--- define the lowest integer value, which does not lose accuracy when being cast to double
   while(l_min+1!=long((double)(l_min+1)))
      l_min/=2;
//--- include the upper boundary in the found interval
   l_max++;
//--- derive the found interval for integer values
   PrintFormat("When casting an integer value to double, it must be "
               "within [%I64d, %I64d] interval",l_min,l_max);
//--- now, let's see what happens if the value falls out of this interval
   PrintFormat("l_max+1=%I64d, double(l_max+1)=%.f, long(double(l_max+1))=%I64d",
               l_max+1,double(l_max+1),long(double(l_max+1)));
   PrintFormat("l_min-1=%I64d, double(l_min-1)=%.f, long(double(l_min-1))=%I64d",
               l_min-1,double(l_min-1),long(double(l_min-1)));
//--- receive the following result
// When casting an integer value to double, it must be within [-9007199254740992, 9007199254740992] interval
// l_max+1=9007199254740993, double(l_max+1)=9007199254740992, long(double(l_max+1))=9007199254740992
// l_min-1=-9007199254740993, double(l_min-1)=-9007199254740992, long(double(l_min-1))=-9007199254740992
  }


References for the "max safe integer" for typecasting long -> double:

https://en.wikipedia.org/wiki/Double-precision_floating-point_format#Precision_limitations_on_integer_values

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER

https://www.tutorialspoint.com/what-is-javascript-s-highest-integer-value-that-a-number-can-go-to-without-losing-precision

https://stackoverflow.com/questions/1848700/biggest-integer-that-can-be-stored-in-a-double

https://stackoverflow.com/questions/38602078/how-to-get-the-maximum-safest-integer-of-a-double-in-java

https://stackoverflow.com/questions/26380364/why-is-number-max-safe-integer-9-007-199-254-740-991-and-not-9-007-199-254-740-9

Documentation on MQL5: Language Basics / Data Types / Typecasting
Documentation on MQL5: Language Basics / Data Types / Typecasting
  • www.mql5.com
Typecasting - Data Types - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

I don't think it's explained clearly anywhere in the documentation that an array declared with [] but initialized is actually static.

Forum on trading, automated trading systems and testing trading strategies

Why doesn't my ArrayResize resize my 2D Array?

Alain Verleyen, 2023.04.28 13:52

Yes you are right, I missed the point that the array is static because it's initialized (and that is not clear in the documentation).

So if you want a dynamic array and initialize it, you need 2 arrays and copy the values.

int INIT[][4]= {{1,2,3,4},{5,6,7,8},{9,10,11,12}};
int arr[][4];

void OnInit() {
   ArrayCopy(arr,INIT);
   int arrRowsSize = ArrayRange(arr,0); // will return 3
   int arrColSize = ArraySize(arr)/3;
   Print("arrColSize: " + arrColSize);
   Print("arrRowsSize: " + arrRowsSize);
   Print("Row remove: " + ArrayRemove(arr, 1, 1));
   Print("Arr Size is: " + ArraySize(arr));
   //for(int i=0;i<arrColSize;i++){
   //   arr[2][i] = 0;
   //}

   Print("Arr Resize is: " + ArrayResize(arr, arrRowsSize-1));
   Print("Arr Size is: " + ArraySize(arr));
   ArrayPrint(arr);
}

Output:



 

Forum on trading, automated trading systems and testing trading strategies

EnumToString and turning values to string in a template class

Lorentzos Roussos, 2023.01.13 12:24

[concerning the enumapper - the original issue is solved]

There are some undocumented enumerations among the misscounts of course


for instance in ENUM_ACTIVATION_FUNCTION there is no AF_PRELU in the docs



 

All errors have been found in offline documentation.

Links to online docs are provided, mostly showing same faults.


                https://www.mql5.com/en/docs/array/arrayinitialize
        MQL5 Reference  /  Array Functions / ArrayInitialize
            - arrays are not passed as reference


                
        MQL5 Reference  /  Working with databases
            - DatabaseColumnType is missing in documentation            https://www.mql5.com/de/docs/database/databasecolumntype
            - DatabaseColumnText is missing in documentation            https://www.mql5.com/de/docs/database/databasecolumntext


                https://www.mql5.com/en/docs/convert/chararraytostring
        MQL5 Reference  /  Conversion Functions / CharArrayToString
            - arrays are not passed as reference
            - comma missing after third parameter


                https://www.mql5.com/en/docs/convert/shortarraytostring
        MQL5 Reference  /  Conversion Functions / ShortArrayToString
            - arrays are not passed as reference


                https://www.mql5.com/en/docs/chart_operations/chartgetdouble
        MQL5 Reference  /  Chart Operations / ChartGetDouble
            - second parameter type is wrong, should be "ENUM_CHART_PROPERTY_DOUBLE"


                https://www.mql5.com/en/docs/chart_operations/chartgetinteger
        MQL5 Reference  /  Chart Operations / ChartGetInteger
            - second parameter type is wrong, should be "ENUM_CHART_PROPERTY_INTEGER"


                https://www.mql5.com/en/docs/chart_operations/chartsetstring
        MQL5 Reference  /  Chart Operations / ChartGetString
            - second parameter type is wrong, should be "ENUM_CHART_PROPERTY_STRING"


                https://www.mql5.com/en/docs/chart_operations/chartsetdouble
        MQL5 Reference  /  Chart Operations / ChartSetDouble
            - second parameter type is wrong, should be "ENUM_CHART_PROPERTY_DOUBLE"


                https://www.mql5.com/en/docs/chart_operations/chartsetinteger
        MQL5 Reference  /  Chart Operations / ChartSetInteger
            - second parameter type is wrong, should be "ENUM_CHART_PROPERTY_INTEGER"


                https://www.mql5.com/en/docs/chart_operations/chartsetstring
        MQL5 Reference  /  Chart Operations / ChartSetString
            - second parameter type is wrong, should be "ENUM_CHART_PROPERTY_STRING"


                https://www.mql5.com/en/docs/check/mqlinfointeger
        MQL5 Reference  /  Checkup / MQLInfoInteger
            - first parameter type is wrong, should be "ENUM_MQL_INFO_INTEGER"


                https://www.mql5.com/en/docs/check/mqlinfostring
        MQL5 Reference  /  Checkup / MQLInfoString
            - first parameter type is wrong, should be "ENUM_MQL_INFO_STRING"


                https://www.mql5.com/en/docs/check/terminalinfodouble
        MQL5 Reference  /  Checkup / TerminalInfoDouble
            - first parameter type is wrong, should be "ENUM_TERMINAL_INFO_DOUBLE"


                https://www.mql5.com/en/docs/check/terminalinfointeger
        MQL5 Reference  /  Checkup / TerminalInfoInteger
            - first parameter type is wrong, should be "ENUM_TERMINAL_INFO_INTEGER"


                https://www.mql5.com/en/docs/check/terminalinfostring
        MQL5 Reference  /  Checkup / TerminalInfoString
            - first parameter type is wrong, should be "ENUM_TERMINAL_INFO_STRING"


                https://www.mql5.com/en/docs/series/indicatorcreate
        MQL5 Reference  /  Timeseries and Indicators Access / IndicatorCreate
            - comma after last parameter


                https://www.mql5.com/en/docs/customind/indicatorsetdouble
        MQL5 Reference  /  Custom Indicators / IndicatorSetDouble
            - first parameter type is wrong, should be "ENUM_CUSTOMIND_PROPERTY_DOUBLE"
            - missing closing semicolon after closing bracet on second function signature.


                https://www.mql5.com/en/docs/customind/indicatorsetinteger
        MQL5 Reference  /  Custom Indicators / IndicatorSetInteger
            - first parameter type is wrong, should be "ENUM_CUSTOMIND_PROPERTY_INTEGER"
            - missing closing semicolon after closing bracet on second function signature.


                https://www.mql5.com/en/docs/customind/indicatorsetstring
        MQL5 Reference  /  Custom Indicators / IndicatorSetString
            - first parameter type is wrong, should be "ENUM_CUSTOMIND_PROPERTY_STRING"
            - missing closing semicolon after closing bracet on second function signature.


                https://www.mql5.com/en/docs/customsymbols/custombookadd
        MQL5 Reference  /  Custom Symbols / CustomBookAdd
            - comma missing after second parameter


                https://www.mql5.com/en/docs/customind/plotindexgetinteger
        MQL5 Reference  /  Custom Indicators / PlotIndexGetInteger
            - second parameter type is wrong, should be "ENUM_PLOT_PROPERTY_INTEGER"
            - missing closing semicolon after closing bracet on second function signature.


                https://www.mql5.com/en/docs/customind/plotindexsetdouble
        MQL5 Reference  /  Custom Indicators / PlotIndexSetDouble
            - second parameter type is wrong, should be "ENUM_PLOT_PROPERTY_DOUBLE"


                https://www.mql5.com/en/docs/customind/plotindexsetinteger
        MQL5 Reference  /  Custom Indicators / PlotIndexSetInteger
            - second parameter type is wrong, should be "ENUM_PLOT_PROPERTY_INTEGER"
            - missing closing semicolon after closing bracet on second function signature.


                https://www.mql5.com/en/docs/customind/plotindexsetstring
        MQL5 Reference  /  Custom Indicators / PlotIndexSetString
            - second parameter type is wrong, should be "ENUM_PLOT_PROPERTY_STRING"
            - missing closing semicolon after closing bracet on second function signature.


                https://www.mql5.com/en/docs/customind/setindexbuffer
        MQL5 Reference  /  Custom Indicators / SetIndexBuffer
            - array specified without reference operator


                https://www.mql5.com/en/docs/common/resourcereadimage
        MQL5 Reference  /  Common Functions / ResourceReadImage
            - comma after last parameter


                https://www.mql5.com/en/docs/common/resourcesave
        MQL5 Reference  /  Common Functions / ResourceSave
            - comma missing after first parameter


                https://www.mql5.com/en/docs/directx/dxcontextclearcolors
        MQL5 Reference  /  Working with DirectX / DXContextClearColors
            - Structure DXVector is missing in documentation, also in online documentation.
            - Structure DXVertexLayout is missing in documentation, also in online documentation.


                https://www.mql5.com/en/docs/indicators/ivolumes
        MQL5 Reference  /  Technical Indicators / iVolumes
            - missing closing semicolon after closing bracet.


                https://www.mql5.com/en/docs/marketinformation/symbolinfointeger
        MQL5 Reference  /  Market Info / SymbolInfoInteger
            - additional empty line in first fuction signature (not considered relevent)


                https://www.mql5.com/de/docs/marketinformation/symbolissynchronized
        MQL5 Reference  /  Market Info / SymbolIsSynchronized
            - comma after single parameter
            - missing closing semicolon after closing bracet.


                https://www.mql5.com/en/docs/strings/stringbufferlen
        MQL5 Reference  /  String Functions / StringBufferLen
            - return value is specified wrong, should be "uint"


                https://www.mql5.com/en/docs/series/barscalculated
        MQL5 Reference  /  Timeseries and Indicators Access / BarsCalculated
            - comma after single parameter


                https://www.mql5.com/en/docs/series/copybuffer
        MQL5 Reference  /  Timeseries and Indicators Access / CopyBuffer
            - all signatures array specified without reference operator


                https://www.mql5.com/en/docs/series/copyclose
        MQL5 Reference  /  Timeseries and Indicators Access / CopyClose
            - all signatures array specified without reference operator


                https://www.mql5.com/en/docs/series/copyhigh
        MQL5 Reference  /  Timeseries and Indicators Access / CopyHigh
            - all signatures array specified without reference operator


                https://www.mql5.com/en/docs/series/copylow
        MQL5 Reference  /  Timeseries and Indicators Access / CopyLow
            - all signatures array specified without reference operator


                https://www.mql5.com/en/docs/series/copyopen
        MQL5 Reference  /  Timeseries and Indicators Access / CopyOpen
            - all signatures array specified without reference operator


                https://www.mql5.com/en/docs/series/copyrates
        MQL5 Reference  /  Timeseries and Indicators Access / CopyRates
            - all signatures array specified without reference operator


                https://www.mql5.com/en/docs/series/copyrealvolume
        MQL5 Reference  /  Timeseries and Indicators Access / CopyRealVolume
            - all signatures array specified without reference operator


                https://www.mql5.com/en/docs/series/copytickvolume
        MQL5 Reference  /  Timeseries and Indicators Access / CopyTickVolume
            - all signatures array specified without reference operator


                https://www.mql5.com/en/docs/series/copyspread
        MQL5 Reference  /  Timeseries and Indicators Access / CopySpread
            - all signatures array specified without reference operator


                https://www.mql5.com/en/docs/series/copytime
        MQL5 Reference  /  Timeseries and Indicators Access / CopyTime
            - all signatures array specified without reference operator


                https://www.mql5.com/en/docs/series/seriesinfointeger
        MQL5 Reference  /  Timeseries and Indicators Access / SeriesInfoInteger
            - comma after last parameter in first signature


                https://www.mql5.com/en/docs/signals/signalbasegetdouble
        MQL5 Reference  /  Trade Signals / SignalBaseGetDouble
            - comma after single parameter


                https://www.mql5.com/en/docs/signals/signalbasegetinteger
        MQL5 Reference  /  Trade Signals / SignalBaseGetInteger
            - comma after single parameter


                https://www.mql5.com/en/docs/signals/signalbasegetstring
        MQL5 Reference  /  Trade Signals / SignalBaseGetString
            - comma after single parameter


                https://www.mql5.com/en/docs/signals/signalinfogetdouble
        MQL5 Reference  /  Trade Signals / SignalInfoGetDouble
            - comma after single parameter


                https://www.mql5.com/en/docs/signals/signalinfogetinteger
        MQL5 Reference  /  Trade Signals / SignalInfoGetInteger
            - comma after single parameter


                https://www.mql5.com/en/docs/signals/signalinfogetstring
        MQL5 Reference  /  Trade Signals / SignalInfoGetString
            - comma after single parameter


                https://www.mql5.com/de/docs/opencl/clbufferread
        MQL5 Reference  /  Working with OpenCL / CLBufferRead
            - "=" missing on last parameter in third signature
            - comma after last parameter in third signature


                https://www.mql5.com/en/docs/indicators/ibearspower
        MQL5 Reference  /  Technical Indicators / iBearsPower
            - comma after last parameter


                https://www.mql5.com/en/docs/indicators/ibullspower
        MQL5 Reference  /  Technical Indicators / iBullsPower
            - comma after last parameter
                        
                        
                https://www.mql5.com/en/docs/database/databasebindarray
                MQL5 Reference / Working with databases / DatabaseBindArray
                        - Function signature specifies "DatabaseBind" as function name, should be "DatabaseBindArray"


                https://www.mql5.com/en/docs/objects/objectcreate
                MQL5 Reference / Object Functions / ObjectCreate
                        - Fourth parameter type is specified with "sub_window" I suppose it should be "int"