Detailed explanation of iCustom - page 5

 
William Roeder:
Continuing from #23 and encapsulating in a function #26, I now show a struct that works on both MT4 and MT5. (For post-build 600, I've changed the invalid dots (#29) in variable names, and approprate ints to standard enumerations.)
Not compiled, not tested.Not compiled, not tested.

Hi William & Co.

If you call iCustom multiple times for a given indicator with the same symbol & timeframe, is the full indicator code executed repeatedly or does MQL4 does something smart behind the scenes to cache the resulting buffers? Hopefully it's the latter especially for more heavier indicators... My understanding is that MQL5 improves this situation by using handles, treating indicators similar to that of opening/closing files.

Furthermore, when programming EAs I am interested in using the CIndicator derived classes from the Standard Library which probably offers greater control (and extensibility) when compared with the built-in functions (iCustom, iMACD, iBands, etc), not to mention that theoretically should offer similar programming semantics on both platforms, MT4 and MT5. However I have not yet tried it myself and still puzzled by the significant differences in the source code between MQL4 and MQL5 (Include/Indicators/*.mqh). Would be so kind to offer your insights on the pros and cons from your understanding of and experience with these functions/libraries?

 
Dima Diall: If you call iCustom multiple times for a given indicator with the same symbol & timeframe, is the full indicator code executed repeatedly or does MQL4 does something smart behind the scenes to cache the resulting buffers?
  1. If the specific symbol/TF chart does not exist, it is invisibly created.
  2. If specific indicator/parameter(s) combination is not on the symbol/TF chart it is invisibly added.
  3. Then it reads from the requested buffer[index].
 
William Roeder:
  1. If the specific symbol/TF chart does not exist, it is invisibly created.
  2. If specific indicator/parameter(s) combination is not on the symbol/TF chart it is invisibly added.
  3. Then it reads from the requested buffer[index].

Thanks a lot for the quick response, William -- it is interesting approach indeed... Are such invisibly created indicators automatically destroyed when the EA is terminated? I would assume so, at least in MQL4; maybe in MQL5 perhaps one needs to explicitly call IndicatorRelease() for the indicator handles in use by the EA.

PS: Do you happen to have any experience with CIndicator classes in the Standard Library? I've been searching online for code samples and couldn't find much, other than the meagre reference material at http://www.mql5.com/en/docs/standardlibrary/technicalindicators/CIndicators/CIndicator (or built-in help system).

PPS: Is there a way to enable email notifications in this forum? I looked around in my account settings and was unable to find anything.

Documentation on MQL5: Standard Library
Documentation on MQL5: Standard Library
  • www.mql5.com
MQL5 Standard Library is written in MQL5 and is designed to facilitate writing programs (indicators, scripts, experts) for end users. Library provides convenient access to the most of the internal MQL5 functions.
 
  1. Since unused charts are purged after ten minutes, I assume unused indicators are as well.
  2. I haven't studied MT5. Look at the code in the class.
  3. Not that I'm aware. I just use Firefox and the Update Scanner add on.
Reason: