Dear all,
I hope I'm not asking a repeated question, but I would like the help from my colleagues to clarify a doubt.
Is it possible to include an indicator code, in this case ZigZag Indicator, inside an EA code (OnTick)? That is, I don't want call the indicator with the iCustom function, but rather include the indicator code inside my EA.
It's possible?
Kindly regards
yes possible
Yes, ANY indicator can be rewritten to be calculated inside the EA without the need to call the indicator via iCustom(), even the ZigZag. However, it is coded in a totally different way as to the way it is coded in an indicator.
So, in essence you can't just copy/paste the code from an existing Indicator. It has to be totally re-coded from scratch using a different approach.
Don't try to do that. There are no buffers, no IndicatorCounted() or prev_calculated. No way to know if older bars have changed or been added (history update.)
Just get the value(s) of the indicator(s) into EA/indicator (using iCustom) and do what you want with it.
Detailed explanation of iCustom - MQL4 programming forum (2017)
I am really sorry! It wasn't intentional.
Thanks for your answer!
That was exactly my question and you made it absolutely clear! Thank you so much!
Just get the value(s) of the indicator(s) into EA/indicator (using iCustom) and do what you want with it. Detailed explanation of iCustom - MQL4 programming forum (2017)
I would have to disagree with you as a matter of opinion. One can easily replicate Indicator functionality in an EA with all the same advantages, and yet have it be much more efficient in its use of RAM and CPU.
Obviously each case is different and there can be situations where the use of an indicator via iCustom is more convenient, or easier to code and maintain, or equivalent in efficiency.
However, I would say that for the majority of Indicators, it is more efficient to code it in the EA, if one knows how to do it properly. It also depends on the coder's skill level.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear all,
I hope I'm not asking a repeated question, but I would like the help from my colleagues to clarify a doubt.
Is it possible to include an indicator code, in this case ZigZag Indicator, inside an EA code (OnTick)? That is, I don't want call the indicator with the iCustom function, but rather include the indicator code inside my EA.
It's possible?
Kindly regards