Lot number for order send and order close

 

Hi,

Would like to ask, is there anyone encountered invalid lot number for OrderClose function() ?

I'm trying to play around with the EA, a very simple EA.

The lot I had initially is 0.1 when executing order send. Then when I tried to loop through all the order, all order lots is 0.

Here is my code:


   if( testingCount < 10 ){
      ticket = OrderSend(Symbol(),OP_BUY, volumeSize,Ask,slipageSize,0,0,"",0,Black);
      testingCount++;
   }
   
   for( i = 0 ; i < OrdersTotal(); i++){
      if( OrderSelect(i, SELECT_BY_POS) == true ){
         orderTicket = OrderTicket();
         orderPrice = OrderOpenPrice();
         orderSL = OrderStopLoss();
         orderTP = OrderTakeProfit();
         orderLots = OrderLots();

         Alert("Order Lots: " + orderLots);
      }
   }

It keeps on alert me the order lots is 0.

When I changed the lot number from 0.1 to 1, it able to alert me the correct number.

I was wondering what can actually cause this? I was testing on EUR-USD.

 
programmerpig:

Hi,

Would like to ask, is there anyone encountered invalid lot number for OrderClose function() ?

I'm trying to play around with the EA, a very simple EA.

The lot I had initially is 0.1 when executing order send. Then when I tried to loop through all the order, all order lots is 0.

Here is my code:


It keeps on alert me the order lots is 0.

When I changed the lot number from 0.1 to 1, it able to alert me the correct number.

I was wondering what can actually cause this? I was testing on EUR-USD.

You probably have orderLots defined as Integer.
 
programmerpig:

Hi,

Would like to ask, is there anyone encountered invalid lot number for OrderClose function() ?

I'm trying to play around with the EA, a very simple EA.

The lot I had initially is 0.1 when executing order send. Then when I tried to loop through all the order, all order lots is 0.

Is orderLots a double or an int ?