Target is 50 pips but can't get it to enter if statement

 

I have the following if statement to be entered when the target profit is 50 pips (500 for 5 decimal systems).

I can't get the value to exceed 500, am I doing something wrong with the *Point part?


if (OrderType() == OP_BUY && (Bid-OrderOpenPrice())*Point >= 500 )

{

//...do code

}


In my debugging, as soon as I multiply it by *Point it comes out as 0.00000

eg

Print ("not in modificationBUY: Bid-OO=" + DoubleToStr(MathAbs(Bid-OrderOpenPrice()),5)); //debug
Print ("not in modificationBUY: Bid-OO*Point=" + DoubleToStr(MathAbs((Bid-OrderOpenPrice())*Point),5)); //debug


prints 0.00960 (96 pips)

prints 0.00000


FULL CODE:

for(int i=0;i<OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

if(OrderSymbol()==Symbol())
{
Print ("Order:" + OrderTicket() + ", OT: " + OrderType()); //debug
Print ("not in modificationBUY: Bid-OO=" + DoubleToStr(MathAbs(Bid-OrderOpenPrice()),5)); //debug
Print ("not in modificationBUY: Bid-OO*Point=" + DoubleToStr(MathAbs((Bid-OrderOpenPrice())*Point),5)); //debug

if (OrderType() == OP_BUY && (Bid-OrderOpenPrice())*Point >= 500 ) { //50pips profit at least before we modify //&& (


etc.....

 

Hello,

In your code:

if (OrderType() == OP_BUY && (Bid-OrderOpenPrice())*Point >= 500 )

{

//...do code

}

You'd better divide by Point to obtain the result in points, like that it should fit your expectation:

if (OrderType() == OP_BUY && (Bid-OrderOpenPrice())/Point >= 50

)

{

//...do code

}