- Do you mean globally declared variables or Global Variables of the Terminal which is used for inter-process communications?
- Why do you care about a couple of milliseconds?
Hi Roeder.... Globally declared variables....
I'm trying to get my EA to run optimally... at the moment it is using 25% - 40% of my cpu... I'm just wondering if I should group all of my Arrays into one big Array and then allocate Global Variable values - as opposed to 30 or 40 Arrays calculating the same values that individually make up the same data...
Sorry, this is difficult to explain....
I guess what I am asking is this:
If I call the value of a Global Variable (Globally declared variable)... does that make the Array re-calculate... because if it does then I would rather have a longer "Wait" period so that the "Bigger Array" could do it's the calculations... as opposed to re-calculating all the individual ones...
I'm just wondering... because I always thought that a Global Variable (Globally declared variable) gets it's value - and keeps it - until the code comes past it and recalculates the value...
... but it seems that the more calculations I put on that "Global Variable" the higher my cpu requirement is... so... I'm just thinking... maybe when I call a variable it actually recalculates that variables value (ie. runs the Array that produces the value)...
I know it should not work that way... but that is what is happening...
My cpu processing goes up the more I use the Global Variables... when logically it should'nt because they are assigned a value (until the next sweep that is)...
...if that makes any sense
Sorry... I care.. because I am just about to go into the "Optimizing" stage of the game.. so I need to run as many instances of MT4 as possible...
The higher the cpu requirement... the less/fewer instances I can run
Hmm, answers about this would be speculative or philosophical... why don't you post your code?
I would prefer "Actual"... but anyways... let me put it this way:
Is it better (faster) to structure - getting -the values of my Global Variables like this:
Array_1[15,1];
Array_1[i,0] = iCustom(Symbol(),0,Etc1.,0,i);
Value_1 = Array_1[i,0];
Array_2[15,1];
Array_2[i,0] = iCustom(Symbol(),0,Etc2.,0,i);
Value_2 = Array_1[i,0];
Array_3[15,1];
Array_3[i,0] = iCustom(Symbol(),0,Etc3.,0,i);
Value_3 = Array_1[i,0];
.
.
.dito 30 arrays
Or...:
Array_All[15,30]
Array_All[i,0] = iCustom(Symbol(),0,Etc1.,0,i);
Array_All[i,1] = iCustom(Symbol(),0,Etc2.,0,i);
Array_All[i,2] = iCustom(Symbol(),0,Etc3.,0,i);
.... etc. etc...
...then
Value_1 = Array_All[0,0];
Value_2 = Array_All[0,1];
Value_3 = Array_All[0,2];
Which structure uses the least cpu resource?
If that makes any sense...
Sorry.. this is quite vital...
Value_X = (Value_1 + Value_2 + Value_3);
I could calculate Value_X as above... OR...
I could calculate it in the Array: ie:
Array_All[i,3] = (Array_All[i,0] + Array_All[i,1] + Array_All[i,2] );
Value_X = Array_All[0,3];
So, in theory, it should be more efficient to run a bigger Array.... as opposed to lots of smaller ones...
Which way is better... or more efficient?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys...
My EA has about 30 Arrays - all calculating specific values - which are stored in Global Variables that I use throughout my code.
My Question is:
- Will my code be faster if I consolidate all (or group) my Arrays and Global Variables in 1 function?