Perhaps you should read the manual, especially the examples.
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate/OnStart (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 (2020)
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
How to call indicators in MQL5 - MQL5 Articles (2010)
what is the best framework/flow/architecture to implement this in MQL5 such that when the OnTick() event of the EA fires ...we are guaranteed that the outputs of the indicators have been processed and are ready and valid for the EA to do its thing ?
Any indicator implies resource and time overheads for its calls, so if you want a guarantee of immediate processing of new tick, then move all algorithms into EA and call corresponding functions internally - EA.buyORsell(function3(function2(function1(price-volume-action-etc)))).
Perhaps you should read the manual, especially the examples.
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate/OnStart (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 (2020)
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
How to call indicators in MQL5 - MQL5 Articles (2010)
thx. I am aware of all the above....my concern ( based on other C++ based platforms) is that i will run into situations where iCustom won't keep up !
infact ...this is the very reason why i am giving MT5 a shot. Sierra was just not cutting it because they put everything on a single thread !
Any indicator implies resource and time overheads for its calls, so if you want a guarantee of immediate processing of new tick, then move all algorithms into EA and call corresponding functions internally - EA.buyORsell(function3(function2(function1(price-volume-action-etc)))).
thanks ...
in order to keep things a bit organized in the code....do you think i can use objects/classes to encapsulate as much as possible ...or do i absolutely need to have all the fx calls sitting directly inside onTick()?
also ...is there away to force MT5 to distribute/multithread processing ? for e.g ...indicator 1 goes to thread 1 ( on logical core 0), indicator 2 goes to thread 2 (logical core 1)...etc
thx
Perhaps you should read the manual, especially the examples.
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate/OnStart (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 (2020)
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
How to call indicators in MQL5 - MQL5 Articles (2010)
You will need to use iCustom() and CopyBuffer() to access the the data of the sub-indicators, within the code of the "super" indicator.
thanks....this should do the trick.
wondering how many custom indicators were you able to nest like this successfully?
custom indicator 1 --> custom indicator 2 ---> custom indicator 3----- > custom indicator ?
thx again
Cascading the indicators is not something I would recommend!
Consider doing the "unification" in the EA itself, instead of cascading the indicators. Let the EA read the data of the individual indicators and deriving the signal from them within the EAs code.
All indicators for the same symbol, share a single thread. So making the indicators dependant on each other is going to slow things down quite a bit.
And should there be a single "hiccup", they will all freeze, including the chart itself.
Consider streamlining your logic to work within a single indicator, using the data from one buffer serve as input to another buffer, and so on.
All indicators for the same symbol, share a single thread. So making the indicators dependant on each other is going to slow things down quite a bit.
And should there be a single "hiccup", they will all freeze, including the chart itself.
Consider streamlining your logic to work within a single indicator, using the data from one buffer serve as input to another buffer, and so on.
thanks,
just to make sure i understood correctly....does the below look right ? :
iCustom1 -------> EA onTick()
iCustom2 -------> EA onTick()
iCustom3 -------> EA onTick()
iCustomX -------> EA onTick()
additional signal/indicator buffer processing would happen inside OnTick() ?
would creating classes/objects for the iCustom calls help with orchestration or would it result in processing overhead and synchronization issues?
thx
thanks,
just to make sure i understood correctly....does the below look right ? :
iCustom1 -------> EA onTick()
iCustom2 -------> EA onTick()
iCustom3 -------> EA onTick()
iCustomX -------> EA onTick()
additional signal/indicator buffer processing would happen inside OnTick() ?
would creating classes/objects for the iCustom calls help with orchestration or would it result in processing overhead and synchronization issues?
thx
No, that is not how it works. The indicators and EA work independently of each other and the EA has its own dedicated thread.
The EA can then read the data from the indicators via the CopyBuffer() function, at anytime it wishes when processing an event, for example during OnTick(), OnTimer(), OnChartEvent(), etc.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey Folks....new MT5/MQL5 user here,
i am attempting to move my custom indicators + trading system from Sierra Charts to MT5 and facing some basic issues.
I have learned a bit about MQL5 to understand the general aspects of indicators vs EAs...went through the sample code ....but i am by no means an expert MQL5 guy yet ...my challenge/question is:
suppose my trading system requires the use of many indicators ....some of those indicators require the output generated by other indicators as shown below:
indicator1 output -------> input to indicator 2. indicator 2 output --------> input to indicator3. indicator 3 output ------> input to EA to make buy/sell decisions
what is the best framework/flow/architecture to implement this in MQL5 such that when the OnTick() event of the EA fires ...we are guaranteed that the outputs of the indicators have been processed and are ready and valid for the EA to do its thing ?
appreciate the help.
chucky