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
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

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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