iMA egality problem

To add comments, please log in or register
Bond
66
Bond  

yo,

here's my code :

int magicalNumber,ticket;
double Moyenne1=iMA(NULL,PERIOD_M30,20,8,MODE_SMA,PRICE_CLOSE,i);
double Moyenne2=iMA(NULL,PERIOD_M30,50,8,MODE_SMA,PRICE_CLOSE,i);

magicalNumber = 98765;

            if( Moyenne1 == Moyenne2 )
            {
               ticket = OrderSend(Symbol(),OP_SELL,0.1,Bid,3,0,0,"SELL",magicalNumber,0,Red);
               
            }


The problem is, it never takes order !

why ?


thanks in advance

Alain Verleyen
37480
Alain Verleyen  
Bad_Bond:

yo,

here's my code :


The problem is, it never takes order !

why ?


thanks in advance


Maybe because Moyenne1 is never equals to Moyenne2 ;-)
Simon Gniadkowski
17644
Simon Gniadkowski  
angevoyageur:

Maybe because Moyenne1 is never equals to Moyenne2 ;-)

And even if it is equal it may not be  ;-)  Can price != price ?

Does it try and take orders and fail ?   What are Function return values ? How do I use them ?

Alain Verleyen
37480
Alain Verleyen  
RaptorUK:

And even if it is equal it may not be  ;-)  Can price != price ?

Does it try and take orders and fail ?   What are Function return values ? How do I use them ?

I knew you were going to link without my having to get it :-D
Simon Gniadkowski
17644
Simon Gniadkowski  
angevoyageur:
I knew you were going to link without my having to get it :-D
You are most welcome :-)
Bond
66
Bond  

how could it never been equal ?

look at this :

iMA

Simon Gniadkowski
17644
Simon Gniadkowski  
Bad_Bond:

how could it never been equal ?

Read this and you will find out:  Can price != price ?

Also if the cross is just before or just after a Bar the values at the Bar will not be equal.

Bond
66
Bond  
moving avering is a bar too ?
Simon Gniadkowski
17644
Simon Gniadkowski  
Bad_Bond:
moving avering is a bar too ?

The MAs are only calculated for each bar,  not between bars . . .

 

Bar #3210
MA11.51.61.71.9
MA21.71.71.61.4

 

These 2 MAs have crossed between Bars 1 & 2 but the values are not equal at any of the Bars. 

Bond
66
Bond  
and he returns number every 30 minutes so
12
To add comments, please log in or register