Download MetaTrader 5

Quick way to test EA conflicts?

To add comments, please log in or register
winterz
104
winterz  

I've written my own EA over past few months and am now wanting to know if there was a quick way to determine whether or not their will be a conflict when applying this to multiple pairs? 

 I know this may sound like a daft question as demoing it first will highlight discrepancies and conflicting scenarios, but I just wanted to throw it out there to the more experienced coders any tips and tricks they might have to help me speed up the trailing period?

 I'm hopeful but I suspect it's just a case of demoing and monitoring from here (and of course, going over all the code and crossing the T's and dotting the I's).

Thanks in advance. 

Keith Watford
Moderator
10568
Keith Watford  

Use a magic number, different for each chart that the EA is applied to.

Use it to identify trades opened by the EA on the particular chart and there should be no conflicts. 

winterz
104
winterz  

Yea I am doing this already. Just being hyper-conscious as I am in the forward testing phase. I figured it was probably an unnecessary question, but thought I'd ask anyway.

Rather than making a new thread, is it possible to transfer GlobalVariables from one MT4 to another? May sound like a silly thing to do, but it's gonna be WAY easier for me to do this than have to work out the logic or code (i'd rather do it this way anyway).

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI  
You can do what ever you want. Just how the logic reflects your true intentions.
winterz
104
winterz  
deysmacro:
You can do what ever you want. Just how the logic reflects your true intentions.
I've noticed you write responses like this a lot. If you are confirming what I am asking, at least point me in the right direction. You could spend an equal amount of time on that one line you wrote in providing fruit instead of observational comments.
winterz
104
winterz  
Could someone kindly confirm whether or not GlobalVariables are transferable from one platform to another?
honest_knave
Moderator
2328
honest_knave  

For GlobalVariables:

You can code to write your GVs to file then read the file on the other platform.

You can run the terminal in portable mode off external media, making the whole terminal (with its GVs) transferable (not really what you asked, but it depends on your reasoning for wanting to move GVs).

Or you might want to look at named pipes.

winterz
104
winterz  

Very helpful, I appreciate the guidance, thanks! Will definitely look into this.

Last question on this thread, is there a fancy way I can store a string in a GlobalVariableSet? (i.e. not a double value, but a string value)?

whroeder1
15592
whroeder1  
winterz: is there a fancy way I can store a string in a GlobalVariableSet? (i.e. not a double value, but a string value)?
A GV consists of a string (the variable name) and a double. Ignore the double, use a known unique pattern that you can find with.
Not compiled, not tested.
#define pattern="Pattern-"
void   remember(string p, string s){ GlobalVariableSet(p+s,0); }
string retreive(string p){
   for(int iPos = GlobalVariablesTotal() -1; iPos >= 0; --iPos){
      string name = GlobalVariableName(iPos);
      if(StringFind(name, pattern) == 0) 
         return StringSubstr(name, StringLen(pattern));
   return ""; // Not found
}
Not compiled, not tested.
Alain Verleyen
Moderator
32455
Alain Verleyen  
winterz:
I've noticed you write responses like this a lot. If you are confirming what I am asking, at least point me in the right direction. You could spend an equal amount of time on that one line you wrote in providing fruit instead of observational comments.
If you don't like an answer please simply ignore it.
To add comments, please log in or register