Multisymbol EA ... Challenge to set Assets Symbol and there class parameters. Is there better way than what I use?
- a multi-asset EA runs in one thread so that one asset blocks all the others
while each EA for a single asset runs in its own thread, - OnTick is triggered by ticks of its chart symbol what if there aren't any ticks for a while.
- If the setup for each symbol is different this part becomes terribly long and the variable names as well...
I won't recommend it:
- a multi-asset EA runs in one thread so that one asset blocks all the others
while each EA for a single asset runs in its own thread, - OnTick is triggered by ticks of its chart symbol what if there aren't any ticks for a while.
- If the setup for each symbol is different this part becomes terribly long and the variable names as well...
Thanks Carl for your valuable feed back.
However I have created an ExpertClass with its own OnTick() and with internal subClasses to handle trading strategies. Each class have its own IsNewBar() for given Symbol it was loaded. I have run it on strategy tester and it worked for all the Symbols.
This serves me to have an EA (in form of class) for each symbol. This each EAClass is than called from main EA.mq5 file to run the multiple symbols.
The current issue is only to simplify the loading of each EA class for different symbols and simplifying the SetParam_Indicator() for each Symbol.
For now I have coded them manually and with repeated codes. However I wish to make it dynamic, so just change the Symbols in a array and on rerun the the EA class declration and SetParamIndicators are done for new value.
Hope it make sense and I am still open to learn any other structure/method to create an multi symbol EA.
Thanks Carl for your valuable feed back.
However I have created an ExpertClass with its own OnTick() and with internal subClasses to handle trading strategies. Each class have its own IsNewBar() for given Symbol it was loaded. I have run it on strategy tester and it worked for all the Symbols.
This serves me to have an EA (in form of class) for each symbol. This each EAClass is than called from main EA.mq5 file to run the multiple symbols.
The current issue is only to simplify the loading of each EA class for different symbols and simplifying the SetParam_Indicator() for each Symbol.
For now I have coded them manually and with repeated codes. However I wish to make it dynamic, so just change the Symbols in a array and on rerun the the EA class declration and SetParamIndicators are done for new value.
Hope it make sense and I am still open to learn any other structure/method to create an multi symbol EA.
CBaseExpert* experts_arr[5]; void OnInit() { experts_arr[0] = new CBaseExpert().OnInit(InpSymbol); }
@Dominik Christian Egert Thanks man.
This is really so simple and how dumb I am not been able to think of it.
![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
Attached Code of My EA (relavant parts only)