invalid price for order close

 

hello every one...

i am testing the code, for closing order like this:

for(int pos = OrdersTotal()-1; pos >= 0 ; pos--)
if ( OrderSelect(pos, SELECT_BY_POS) )
{

if (OrderType() == OP_BUY &&  ma1>ma2 ){
           OrderClose(OrderTicket(), OrderLots(),MarketInfo(OrderSymbol(), MODE_BID), 5, Red );

}


but in log write error:

2010.10.03 00:07:03 2010.09.01 10:30 fish EURUSD,M15: OrderClose error 4107
2010.10.03 00:07:03 2010.09.01 10:30 fish EURUSD,M15: invalid price 1.27034000 for OrderClose function
2010.10.03 00:07:03 2010.09.01 10:30 fish EURUSD,M15: OrderClose error 4107
2010.10.03 00:07:03 2010.09.01 10:30 fish EURUSD,M15: invalid price 1.27034000 for OrderClose function

what should i add in that orderclose function?

is it using NormalizeDouble or not?

thx,,

 
why not closing the order with OrderClosePrice()?
 

i am following that code from closing all open position indicator,

so how about code using ordercloseprice?

i am add the price on the end of close, like this:

 OrderClose(OrderTicket(), OrderLots(),MarketInfo(OrderSymbol(), MODE_BID), 5, Red );

but error: ')' - wrong parameters count ..

how about the true format coding?

thx..

 
 OrderClose(OrderTicket(), OrderLots(),OrderClosePrice(), 5, Red );
//z
 

the log is same error too..

invalid price 1.27034000 for OrderClose function

maybe must using normalizedouble like in the order send function, but in that orderclose function, i don't know how to put...

 

NormalizeDouble(OrderClosePrice(),Digits)


//z

 

ok, it's work..

thx very much..

OrderClose(OrderTicket(), OrderLots(),NormalizeDouble(MarketInfo(OrderSymbol(), MODE_BID),Digits), 5, Red );

same value with

OrderClose(OrderTicket(), OrderLots(),NormalizeDouble(OrderClosePrice(),Digits), 5, Red );


thx..