MQL language feature request: a more compact and generalised "OnCalulate()" function format type.

Fernando Carreiro  

Currently, the OnCalculate() event handling function offers two format types for MQL5—one type is for applied price data, and the other for handling time series data.

They are both clunky and don't fully cater for more generalised requirements. One supplies only applied price data making it restrictive, and the other offers the time series data as separate individual arrays, making it difficult to pass multiple time series data onto sub-functions.

I propose the following more compact and more generalised format type as a third type, which supersedes the other two:

int  OnCalculate(
   const int        rates_total,       // size of input data 
   const int        prev_calculated,   // number of handled bars at the previous call
   const int        begin,             // index number in the price[] array meaningful data starts from
   const double     &price[],          // array (by reference) of applied price values for calculation
   const MqlRates   &rates[],          // array (by reference) of structure of time-series rates data
   );

The “begin” parameter can be set to “WRONG_VALUE” to show that no applied price data is available, but irrespective of there being any applied price data or not (even if it is for another indicator's value), the rates information would always be provided. This would enhance the possibilities of calculations that can be carried out (for example, volume weighted applied price calculations).

Also, when attaching the indicator to the chart, the normally “Applied price” dialogue could be enhanced by adding the option of “No applied price”, so that the indicator could cater to both and all other the possibilities, making it more generalised.

Note to admin (or moderators): If you know where I can reference this request in the Russian forum for a better appraisal, please let me know.

Note to other users: If you agree with this request, post a "thumbs up" or "+ 1" or something similar, so that we can show to MetaQuotes this request's worth. Any suggestions or enhancements are also welcome.

Fernando Carreiro  

I've made a post in the Russian forum as well, hopefully in the correct thread ...

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

Особенности языка mql5, тонкости и приёмы работы

Fernando Carreiro, 2023.01.25 15:10

English (original): I would like to make an MQL language feature request. If this is not the correct thread, please let me know. The original request is on the English forum ...

Русский (перевод Google): Я хотел бы сделать запрос на поддержку языка MQL. Если это не правильная тема, пожалуйста, дайте мне знать. Оригинал запроса есть на английском форуме...

Reason: