How do I insert ZigZag Custom Indicator code in my EA code

 

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

Documentação sobre MQL5: Indicadores Técnicos / iCustom
Documentação sobre MQL5: Indicadores Técnicos / iCustom
  • www.mql5.com
iCustom - Indicadores Técnicos - Referência MQL5 - Referência sobre algorítimo/automatização de negociação na linguagem para MetaTrader 5
 
you asking a repeating question
 
Henoch Protasio Da Silva Junior:

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

 
Henoch Protasio Da Silva Junior: 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?

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.

 
Henoch Protasio Da Silva Junior: , I don't want call the indicator with the iCustom function

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)

 
Amando,

I am really sorry! It wasn't intentional.



Ahmet,

Thanks for your answer!



Fernando,

That was exactly my question and you made it absolutely clear! Thank you so much!



Kindly regards,
 
William Roeder #: 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 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.