# iMA egality problem

66

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

37480

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 ;-)
17644

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 ?

37480

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
17644

angevoyageur:
I knew you were going to link without my having to get it :-D
You are most welcome :-)
17952

66

how could it never been equal ?

look at this :

17644

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.

66

moving avering is a bar too ?
17644

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.

66

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