How we can get the last lot volume of the last order losed

 

hi,

i try to make expert and i want to get your advice to how i can to get the last lot volume of the last order lose

 

You can try with a function like this :

double lastOrderLots(int magicNumber=0)

{

datetime lastTime = 0;

double lastLots = 0;

for(int i=OrdersHistoryTotal()-1; i>=0; i--)

{

if (OrderSelect(i,SELECT_BY_POS, MODE_HISTORY)==false) break;

if (magicNumber!=0)

if (OrderMagicNumber() != magicNumber) continue;

if (OrderSymbol() != Symbol()) continue;

if (OrderCloseTime() <= lastTime) continue;

lastTime = OrderCloseTime();

lastLots = OrderLots();

}

return(lastLots);

}

It will look for the last closed order and return the volume of it (PS: it is searching in the set of already closed orders, currently opened orders are not taken into account with this finction)

sherifmao:
hi, i try to make expert and i want to get your advice to how i can to get the last lot volume of the last order lose
 

thank you ... it is really working good

Reason: