Hi Manuel & welcome
Why not just load the similar input parameters (extern variables) into either single or multi-dimensional arrays then you can just loop through each index and perform the repeated calculations.
Cheers
Why not just load the similar input parameters (extern variables) into either single or multi-dimensional arrays then you can just loop through each index and perform the repeated calculations.
Cheers
MQL has nice OO features that can be used to create very elegant and efficient solution for your problem.
But, if you don't have any experience with OO programming, learning curve can be steep.
drazen64:
Agree with that 100% ! I'm sure most don't use the full OOP features of MQL but the fact that you can strip it down bare is what makes it so accessible to non programmers :)
MQL has nice OO features that can be used to create very elegant and efficient solution for your problem.
But, if you don't have any experience with OO programming, learning curve can be steep.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi, everyone.
I'm almost new to mql4 programming but I have been around programming some time in other languajes. I'm trying to code an EA that runs at once several Strategies but I found a problem when coding,
as all Strategies use the same program but may have different parameters, when I code I have to check all parameters one by one. Let me explain.
For instance: Strategy1_SL_pips=40; Strategy1_Trail=true; and so on...
Strategy2_SL_pips=20; Strategy1_Trail=false; and so on...
So when I arrive at a point where I have to use them, i need to check every single Variable by its name.
For instance: if (Strategy1_Trail) { Do stuff;}
if (Strategy2_Trail { Repeat code; }
In other languajes U can get a Variable's Value by its name and do things like this:
string StrategyArray[]={"Strategy1","Strategy2"...};
for (int i=0; i<ArrayRange(StrategyArray,0);i++) {
if (GetValue(StrategyArray[i]+"_Trail")==true) { Do Stuff;}
}
Where GetValue is a function provided from the languaje.
I've seen that it can be made something like that with GlobalVariables but I didn't see how can I do with extern variables.
This issue would save me tons of repeated code and much less errors when upgrading or changing code. I would be grateful if someone tell me how to get a solution. Thanks in advance