You need to write your own code for a multi-symbol Expert Advisor, since the CExpert class was created specifically for the MQL5 Wizard (for the 'Expert Advisor (generate)' mode).
You need to write your own code for a multi-symbol Expert Advisor, since the CExpert class was created specifically for the MQL5 Wizard (for the 'Expert Advisor (generate)' mode).
Do I need to start all from scratch? I can't reuse anything from those classes? (CExpert and CExpertBase?)
Thanks for your answer.
I've found this great example as an starting point
But I wonder, when testing this, 0 ticks are generated, don't know why. But even if ticks were generated, wouldn't they correspond to the selected symbol in the tester, independent of the symbols in which the expert is working?
I've found this great example as an starting point
But I wonder, when testing this, 0 ticks are generated, don't know why. But even if ticks were generated, wouldn't they correspond to the selected symbol in the tester, independent of the symbols in which the expert is working?
Yes, if you use the OnTick() function (I suppose that's what you're asking about), the EA will use ticks from the selected symbol in the tester (or from the chart you placed the EA on). If the selected symbol (or chart) is GBPUSD, GBPUSD ticks will be used even if your EA trades 10 symbols none of which are GBPUSD. I.e. the EA will make calculations on each tick of GBPUSD symbol.
That's also the reason why it's better to test and use a multi-symbol EA on GBPUSD|EURUSD instead of other Forex pairs. The more ticks you get, the more actual is the data used in your OnTick() calculations.
Yes, if you use the OnTick() function (I suppose that's what you're asking about), the EA will use ticks from the selected symbol in the tester (or from the chart you placed the EA on). If the selected symbol (or chart) is GBPUSD, GBPUSD ticks will be used even if your EA trades 10 symbols none of which are GBPUSD. I.e. the EA will make calculations on each tick of GBPUSD symbol.
That's also the reason why it's better to test and use a multi-symbol EA on GBPUSD|EURUSD instead of other Forex pairs. The more ticks you get, the more actual is the data used in your OnTick() calculations.
Do I need to start all from scratch? I can't reuse anything from those classes? (CExpert and CExpertBase?)
Thanks for your answer.
No, you don't need to start from the scratch, but you need object oriented understanding. You create your custom Expert Class and Inherit from the CExpert Class like shown in the example. Afterwards you simply overwrite the functions, yout want to change.
class MyExpertCExpert : public CExpert{ ... }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello, I'm trying to think in a way (If possible) of having an Expert which operates in multiple Symbols at a time, but I'd like to get your opinion on the best approach.
I have seen this post https://www.mql5.com/en/forum/212858, which shed some light into the problem, but I would like to use the class `CExpert`.
Is it in any way possible to extend the class `CExpert` in such a way that I'm allow to change the symbol at run time without receiving an error
> Change of symbol is forbidden
If it's not possible at all, how do people manage large portfolios of experts? Do they have +50 open charts with experts attached ?
Update
I've been trying for a while now without success, either having an array of symbols and an Expert and trying to change the symbol, or having an array of Expect to map 1 to 1 to an array of Symbols. Either way, seems I can think of a way of achieving this behavior.
Example:
This fails always with:
> CExpert::Init: wrong symbol or timeframe (must be SYMBOL:PERIOD)
Where Symbol:PERIOD is the one selected in the tester
Best regards