Play videoPlease edit your post.
For large amounts of code, attach it.
- OrderLots is not an int
- What are Function return values ? How do I use them ? - MQL4 forum
- See also Order History sort by closing date - MQL4 forum
Thank you deVries,
I changed "int" by "double" and worked fine .......

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,
Can anyone help me with the following;
I've created a function to search and find the oldest open trade and the output is the ticket number, it works fine....but
int FindOlderTrade() {
int older_time;
int ticket;
for (int tomate = OrdersTotal() - 1; tomate >= 0; tomate--) {
OrderSelect(tomate, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != MN1) continue;
if (TimeCurrent()-OrderOpenTime() > older_time) {
older_time = TimeCurrent()-OrderOpenTime();
ticket = OrderTicket();
}
}
return (ticket);
}
........... when a try to do the same to search and find the the oldest trade size with a similar function it does not work, returns 0 :
int FindOlderTradeSize() {
int older_time;
double lt;
for (int tomate = OrdersTotal() - 1; tomate >= 0; tomate--) {
OrderSelect(tomate, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != MN1) continue;
if (TimeCurrent()-OrderOpenTime() > older_time) {
older_time = TimeCurrent()-OrderOpenTime();
lt = OrderLots();
}
}
return (lt);
}
Any help would be much appreciated..
Thank you