static variables, one expert on 4 pairs

 

hello,

one of my expers having two statis variables. this expert is running on more than one currencies.

MT4 terminal is mixing the values of these static variables. I've tried to change names of these variables.

But this also did not solve the problem. Any suggestions?

ExpertX on EURGBP

------------------------

static double A;

static bool B;

(same code...)

ExpertX on EURCHF

------------------------

static double A;

static bool B;

(same code...)

 

Hello cbalta

Of course is annoying for you!

Not being rude here: But - let's get real here please... the terminal is not going to have such a fundamental error is it?

If you ran any script, ea,ind on xx number of charts, you are going to get xx number of instances/discrete data spaces for each chart+program run on it.

.

Suggest you look closer at what you and the program are doing... MT is not going to mess up like what you state.

.

Please state specifics as I am unsure with your comments:

1. I ask as you state: one of my expers having two statis variables. this expert is running on more than one currencies.

Are you saying that program file EAabc.ex4 runs on one chart and is using two ccy's?

2. Or, are you saying that program file EAabc.ex4 is applied to two charts and each is using one ccy?

.

I have come to understand that you can generally be very sure that the fault lies closer to home and that the MT environment is only doing what your program has asked it to do or what you have asked the Client Terminal to do when you interface with it.

.

Is so easy to just point finger at MT and say is it's fault...

.

Your issue is massively fundamental to the basic design of the complete MT package... how come others not have this problem? (I certainly do not and run same EA on up to 10 charts sometimes and the program source code [like most:] has static declarations...)

Of course maybe there is some other explanation but I'd be surprised - simply because many MT'ers are running same EA on many charts at once, yes?

.

Regards

 

This expert goes to 4 different charts/pairs.

When tick arrive, pr1 value of 4 different experts are mixed.

So, the problem is static variables usage with streaming prices..

static double pr1;                        //last order price
static bool OrderExist1;                //live order exits


start() {



if (ask<pr1) ....

    do something

else (bid>pr1) ...

   do something



if (cond)

    pr1=ask

else

    pr1=bid



}

 

show your code it's just a guess

 
phy wrote >>

show your code it's just a guess

solved. trade dispatcher problem. multiple ordersends() in the queue was disturbing.

Reason: