Making a range on mql4 coding
if ( (ReferencePrice - 10*Point) < Bid < (ReferencePrice - 10*Point)) ;True = 1 and false = 0 so you get
if( 3 < 2 < 1 ) if( false < 1 ) if( 0 < 1 ) if( true ) | if( 3 > 2 > 1 ) if( true > 1 ) if( 1 > 1 ) if( false ) |
in some occasion this:
10*Point
will become 0 as the integer value 10 causes Point to be casted to an integer and that means it becomes 0.
So you'd better write to be save:
10.0*Point
in some occasion this:
will become 0 as the integer value 10 causes Point to be casted to an integer and that means it becomes 0.
So you'd better write to be save:
Hi,
My problem is the following code snip below:
if ( (ReferencePrice - 10*Point) < Bid < (ReferencePrice - 10*Point)) ;
OrderSend (...............)
My order executes at any point above (ReferencePrice - 10*Point) and vice versa. Is there any way of creating a range, so that when the Bid is inbetween the two values, it only executes in between them.
Any help would be most appreciated.
Regards,
Mohammed Ali
Your value is the same on both side.
if(Bid > Reference - Xpoint && Bid < Reference + Xpoint) ...
Sorry for any confusion, I meant to write :
if ( (ReferencePrice - 10*Point) < Bid < (ReferencePrice + 10*Point)) ;
Thank you for the help so far. It has been very helpful for me.
in some occasion this:
will become 0 as the integer value 10 causes Point to be casted to an integer and that means it becomes 0.
So you'd better write to be save:
That's not true, any double in an operation will force the result of the operation to be a double.
momo133: Sorry for any confusion, I meant to write :
if( (ReferencePrice - 10*Point) < Bid < (ReferencePrice + 10*Point)); |
|
Hi,
My problem is the following code snip below:
if ( (ReferencePrice - 10*Point) < Bid < (ReferencePrice - 10*Point)) ;
OrderSend (...............)
My order executes at any point above (ReferencePrice - 10*Point) and vice versa. Is there any way of creating a range, so that when the Bid is inbetween the two values, it only executes in between them.
Any help would be most appreciated.
Regards,
Mohammed Ali