Download MetaTrader 5
To add comments, please log in or register
Code Base will help you in mastering your theoretical skills. Come and learn!
winterz
104
winterz 2015.02.11 10:58 

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
7953
Keith Watford 2015.02.11 11:39  

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 2015.02.11 12:43  

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 2015.02.11 12:49  
You can do what ever you want. Just how the logic reflects your true intentions.
winterz
104
winterz 2015.02.11 14:52  
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 2015.02.11 23:08  
Could someone kindly confirm whether or not GlobalVariables are transferable from one platform to another?
honest_knave
966
honest_knave 2015.02.11 23:25  

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 2015.02.12 11:11  

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
13620
whroeder1 2015.02.12 13:55  
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
28607
Alain Verleyen 2015.02.14 12:48  
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