Coding help - page 761

 
oguz:

mladen,

"simple (Regularized ema) EA 1.3" was active in 5 different parities at the same time from 10 am to 9 pm but it did not open any orders!

Is there a problem in this ea for opening orders?

 

P.S: They were (ecn-pro) tickmill demo chart.

Hi oguz

It is working as it suppose to do,but plz always try to explain your problem exactly,if possible with illustration pictures,at least do your work that belongs to you as time is most important for every person.

regards


 
mntiwana:
Hi oguz

It is working as it suppose to do,but plz always try to explain your problem exactly,if possible with illustration pictures,at least do your work that belongs to you as time is most important for every person.

regards


Dear @mntiwana

The problem is simple at the level of my stupidity!

I thought this button was just an information message! Whereas It was doing that expert On-Enable / Off-Disable!

When I saw the color of the button in your graphic, it was red! 

Thank you for your graphics :) 

 

 

 
Dear Mladen,

I try to calculate the difference MA3 - MA1 given by the following code:
      for(int i=limit - 1; i>=0; i--)
      {  
        double MA1, MA2, MA3, MA4;
 
        buffer[i] = EMPTY_VALUE;

        MA1 = iCustomMa(MAType1,getPrice(pr_open,Open,Close,High,Low,i),MAPeriod,i,0);
        MA2 = iCustomMa(MAType1,getPrice(pr_close,Open,Close,High,Low,i),MAPeriod,i,0);
 
        MA3 =  iMA(NULL,0,MAPeriod,0,MAType2,PRICE_OPEN,i);
        MA4 =  iMA(NULL,0,MAPeriod,0,MAType2,PRICE_CLOSE,i);

        buffer[i] = MA3 - MA1;
      }
where MAType1 = iEMA(...), MAType2 = MODE_EMA.   For the above loop, the difference MA3 - MA1
is substantially different from 0.0.   However, when I comment MA2:
      for(int i=limit - 1; i>=0; i--)
      {  
        double MA1, MA2, MA3, MA4;
 
        buffer[i] = EMPTY_VALUE;

        MA1 = iCustomMa(MAType1,getPrice(pr_open,Open,Close,High,Low,i),MAPeriod,i,0);
      //  MA2 = iCustomMa(MAType1,getPrice(pr_close,Open,Close,High,Low,i),MAPeriod,i,0);
 
        MA3 =  iMA(NULL,0,MAPeriod,0,MAType2,PRICE_OPEN,i);
        MA4 =  iMA(NULL,0,MAPeriod,0,MAType2,PRICE_CLOSE,i);

        buffer[i] = MA3 - MA1;
      }
the difference MA3 - MA1 is exactly equal to 0.0 (as expected). 
I cannot understand such a behaviour, please help; it looks like a bug, or so...
 
wojtekpaul:
Dear Mladen,

I try to calculate the difference MA3 - MA1 given by the following code:
      for(int i=limit - 1; i>=0; i--)
      {  
        double MA1, MA2, MA3, MA4;
 
        buffer[i] = EMPTY_VALUE;

        MA1 = iCustomMa(MAType1,getPrice(pr_open,Open,Close,High,Low,i),MAPeriod,i,0);
        MA2 = iCustomMa(MAType1,getPrice(pr_close,Open,Close,High,Low,i),MAPeriod,i,0);
 
        MA3 =  iMA(NULL,0,MAPeriod,0,MAType2,PRICE_OPEN,i);
        MA4 =  iMA(NULL,0,MAPeriod,0,MAType2,PRICE_CLOSE,i);

        buffer[i] = MA3 - MA1;
      }
where MAType1 = iEMA(...), MAType2 = MODE_EMA.   For the above loop, the difference MA3 - MA1
is substantially different from 0.0.   However, when I comment MA2:
      for(int i=limit - 1; i>=0; i--)
      {  
        double MA1, MA2, MA3, MA4;
 
        buffer[i] = EMPTY_VALUE;

        MA1 = iCustomMa(MAType1,getPrice(pr_open,Open,Close,High,Low,i),MAPeriod,i,0);
      //  MA2 = iCustomMa(MAType1,getPrice(pr_close,Open,Close,High,Low,i),MAPeriod,i,0);
 
        MA3 =  iMA(NULL,0,MAPeriod,0,MAType2,PRICE_OPEN,i);
        MA4 =  iMA(NULL,0,MAPeriod,0,MAType2,PRICE_CLOSE,i);

        buffer[i] = MA3 - MA1;
      }
the difference MA3 - MA1 is exactly equal to 0.0 (as expected). 
I cannot understand such a behaviour, please help; it looks like a bug, or so...
You are applying price open in the first call to custom ma and then price close in the second call to custom ma - and you are doing that to the same instance of the ema. You can not do that. You are mixing apples with pears. For each different price (or value) use different instance of the custom ma.

Declare two instances of custom ma and then do the following :

for(int i=limit - 1; i>=0; i--)
{  
        double MA1, MA2, MA3, MA4;

        buffer[i] = EMPTY_VALUE;

        MA1 = iCustomMa(MAType1,getPrice(pr_open,Open,Close,High,Low,i),MAPeriod,i,0);
        MA2 = iCustomMa(MAType1,getPrice(pr_close,Open,Close,High,Low,i),MAPeriod,i,1);

        MA3 =  iMA(NULL,0,MAPeriod,0,MAType2,PRICE_OPEN,i);
        MA4 =  iMA(NULL,0,MAPeriod,0,MAType2,PRICE_CLOSE,i);

        buffer[i] = MA3 - MA1;
}
And then they will be exactly the same (MA1 to MA3 and MA2 to MA4)
 
yes, you are a genius.  :)
 
wojtekpaul:

Sorry for a stupid question, but how to declare the two instances?

The original function 'custom ma' is declared with int instanceNo=0,

and if I set the parameter to 1 when calling the function in the code,

I receive nothing...

check the maInstances in the code :)
 
mladen:

Declare two instances of custom ma

Sorry for a stupid question, but how to declare two instances?

The original function 'custom ma' is declared with int instanceNo=0,

and if I set the parameter to 1 when calling the function in the code,

I receive nothing (though now it doesn't interfere with the function with

the instance 0)...

 

OK, thanks, I still must learn much  :-)))


EDIT: OK, now I see - maInstances are in the new version of MAs

(e.g. in BB stops new format), but they seem to be absent

in the old version (where ca. 20 MAs are available).

 
wojtekpaul:

OK, thanks, I still must learn much  :-)))


EDIT: OK, now I see - maInstances are in the new version of MAs

(e.g. in BB stops new format), but they seem to be absent

in the old version (where ca. 20 MAs are available).

Old versions did not have the multi instance capability
 
Hello everyone and thanks for all the help that you brought was this forum I would like to you asked if it was possible to put the arrow which has on this indicator directly on the chart thanks a lot
Reason: