Thank you so much Broketrader.
I perfectly see the difference between the consrtuctor and the Initialize function, now, thank you so much. And, really, your material here is wonderful. I am now looking back to your implementation through polymorphism, at the very early posts, while studying it through in Eckel, because this is the last step in my development of the "indicator in the indicator".
I think this is exactly also what Tilltheend is asking, if I am not completely wrong. All the three solutions proposed so far (merge, dll - it is possible: see https://www.mql5.com/en/articles/19 - and iCustom) are the "classical ways", that I have investigated in the past days. I think problems could be:
1. merge: you must re-code the whole indicator for any combination of indicators you want to create.
2. dll: well, I don't know. For me it is too complex... (yet)
3. iCustom: very inefficient and very much memory consuming (you have to load and use a lot of "buffers").
What I am trying to implement now is the fruit of three days of very painful interpretation of the google-translator-like text of Nicolay Kositsin article on the mql forum: https://www.mql5.com/en/articles/180, but I think with a much simpler implementation (without arrays with "rotating indexes" which took me not less than 12 full hours to understand...). And... this is the point now: using polymorphism to avoid repetition of common functionality across the board. This is, at least, the aim.
But the idea is cool: you transform the "concept" of indicator itself. Indicator is just the functionality required by MetaTrader for fetching data from the broker, and to draw lines on charts (and this is the only reason that I plan to use "buffers" for). All the logic of the indicator (which is a mathematical transformation of a numerical sequence) is transferred into another "class" of things - SequenceTransforms, exactly - which self-contain (encapsulate and hide) their "mini-array" of values (much less memory!!! Once you store the "period" + "backshift" requested you are done), and expose an interface in which you input a value instead of a sequence (plus the "configuration parameters" like the period of the averaging, etc...) and you get back a value and not a sequence. You can feed this value into the buffer, if you want, and have an "Indicator" drawn.
Or... you can feed this output value as an input for another SequenceTransform and another and another...
Or... you can even make an EA without using iCustom: you just feed in, from the EA, the input value to your SequenceTransform and get your output ready for making trading decisions (eventually storing the two-three previous values that you need into some EA-local small array).
And... you are forever done with the limitations of 8 buffers for MetaTrader, if this would be a concern...
Just imagine, if you go into the digital filters realm, what does it mean if you want to apply a HighPass filter to your price, then use this value for calculating a FisherTransform, and then feed this FisherTransform into the calculation of a HurstExponent (which in turn is derived from FractalDimensions)... With iCustom, re-coding, or dll I think you could get crazy!
BTW: all this is readily available in Zorro, with the beauty of lite-C (and the much better software design of those people compared to MetaQuotes). A pity that Zorro is still far away from being available for a decent number of brokers (I mean: the API). And so I develop there and must "translate" into mql...
Just my two pieces of cheese.
Best
BL
I perfectly see the difference between the consrtuctor and the Initialize function, now, thank you so much. And, really, your material here is wonderful. I am now looking back to your implementation through polymorphism, at the very early posts, while studying it through in Eckel, because this is the last step in my development of the "indicator in the indicator".
I think this is exactly also what Tilltheend is asking, if I am not completely wrong. All the three solutions proposed so far (merge, dll - it is possible: see https://www.mql5.com/en/articles/19 - and iCustom) are the "classical ways", that I have investigated in the past days. I think problems could be:
1. merge: you must re-code the whole indicator for any combination of indicators you want to create.
2. dll: well, I don't know. For me it is too complex... (yet)
3. iCustom: very inefficient and very much memory consuming (you have to load and use a lot of "buffers").
What I am trying to implement now is the fruit of three days of very painful interpretation of the google-translator-like text of Nicolay Kositsin article on the mql forum: https://www.mql5.com/en/articles/180, but I think with a much simpler implementation (without arrays with "rotating indexes" which took me not less than 12 full hours to understand...). And... this is the point now: using polymorphism to avoid repetition of common functionality across the board. This is, at least, the aim.
But the idea is cool: you transform the "concept" of indicator itself. Indicator is just the functionality required by MetaTrader for fetching data from the broker, and to draw lines on charts (and this is the only reason that I plan to use "buffers" for). All the logic of the indicator (which is a mathematical transformation of a numerical sequence) is transferred into another "class" of things - SequenceTransforms, exactly - which self-contain (encapsulate and hide) their "mini-array" of values (much less memory!!! Once you store the "period" + "backshift" requested you are done), and expose an interface in which you input a value instead of a sequence (plus the "configuration parameters" like the period of the averaging, etc...) and you get back a value and not a sequence. You can feed this value into the buffer, if you want, and have an "Indicator" drawn.
Or... you can feed this output value as an input for another SequenceTransform and another and another...
Or... you can even make an EA without using iCustom: you just feed in, from the EA, the input value to your SequenceTransform and get your output ready for making trading decisions (eventually storing the two-three previous values that you need into some EA-local small array).
And... you are forever done with the limitations of 8 buffers for MetaTrader, if this would be a concern...
Just imagine, if you go into the digital filters realm, what does it mean if you want to apply a HighPass filter to your price, then use this value for calculating a FisherTransform, and then feed this FisherTransform into the calculation of a HurstExponent (which in turn is derived from FractalDimensions)... With iCustom, re-coding, or dll I think you could get crazy!
BTW: all this is readily available in Zorro, with the beauty of lite-C (and the much better software design of those people compared to MetaQuotes). A pity that Zorro is still far away from being available for a decent number of brokers (I mean: the API). And so I develop there and must "translate" into mql...
Just my two pieces of cheese.
Best
BL
πάντα δοκιμάζετε τὸ καλὸν κατέχετε
1