Developing an EA that wants to use values that are created by another indicator how should I proceed.
- MQL5 Wizard: Development of trading robots for MetaTrader 5
- Momentum - Oscillators - Indicators - Charts - MetaTrader 5 for Android
- Momentum - Oscillators - Indicators - Chart - MetaTrader 5 for iPhone
I am starting to work on an EA, which wants to use values that are identified with an Indicator. I have a good idea of how the logic will work to trade but I am unsure of what I should do for the indicator. Should I re implement the indicator to generate the values in my EA (this is not what I want to do ideally the indicator is over 2000 lines). Or is there another method that is commonly used to do this.
Your indicator size is impressive, hope it doesn't redraw.
In regards to EA, step-1 put indicator signals into buffers.
Your indicator size is impressive, hope it doesn't redraw.
In regards to EA, step-1 put indicator signals into buffers.
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.
(MT4) Detailed explanation of iCustom - MQL4 programming forum (2017)
Hi
If your indicator is coded properly and return values as buffers for candles – you can easily get the values using iCustom function, just like you use normal indicators from the platform. But if the indicator redraws it might be difficult to get the good results in the EA. Remember that when EA call the indicator, it force whole calculation of the values – from this very moment, but while the indicator is on the chart the calculations might follow their old course and do not recalculate at the same moment as used in the EA – which might end up in different signals within the EA. Be careful while using such indicators.
Best Regards
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use