Differance between MqlRates and other methods ?

 

is there any difference between using MqlRates and using iCLose for example ?

MqlRates i have to use array and copy rates to the array , where iClose can just enter the shift number of the bar and thats it

or i am missing something here ?

thanks

Documentation on MQL5: Timeseries and Indicators Access
Documentation on MQL5: Timeseries and Indicators Access
  • www.mql5.com
Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Ahmed_Fouda:

is there any difference between using MqlRates and using iCLose for example ?

MqlRates i have to use array and copy rates to the array , where iClose can just enter the shift number of the bar and thats it

or i am missing something here ?

thanks

iXXX functions (including iClose) are best avoided. Such functions contain a call to the CopyXXX functions inside (CopySeries, roughly speaking). When using iXXX functions, you must check the result of execution and the error flag each time such a function is called.

Therefore, just use CopySeries to copy the amount of data you need 1 time. Check the result of the execution once and use the ready-made copied data.


iClose:

Note

The function always returns actual data. For this purpose it performs a request to the timeseries for the specified symbol/period during each call.

Machine translate:

Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий

Новая версия платформы MetaTrader 5 build 3620: улучшения веб-терминала, поддержка ONNX и ускоренное умножение матриц в MQL5

Ilyas, 2023.03.05 09:42

CopyRates has no synchronization problems, and CopySeries is a special case of CopyRates, when you need to get not all the data for a bar, but only individual fields.

If the required bar fields are copied by separate calls to CopyLow, СopyTime, etc., then a new bar may open between calls and the data in the arrays will be inconsistent, as described by Alain

CopySeries is a completely standalone function and does not use CopyRates for its work.

Synchronization is ensured by blocking data updates by symbol for the duration of the function, as in all other CopyXXX

An update lock means that symbol updates will be applied after the lock is released, i.e. they will not be lost.

Reason: