![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
When I add parenthesis I get another error. Can any coder help? I am new and trying to understand this language.
//Load the lot size from the last size..
if(OrderProfit() < 0)
{
if(OrderLots() == lotSize1)
{
gCalc = 2;
return(lotSize2);
}if(OrderLots() == lotSize2)
{
gCalc = 3;
return(lotSize3);
}if(OrderLots() == lotSize3)
{
gCalc = 4;
return(lotSize4);
}if(OrderLots() == lotSize4)
{
gCalc = 5;
return(lotSize5);
}if(OrderLots() == lotSize5)
{
gCalc = 6;
return(lotSize6);
}if(OrderLots() == lotSize6)
{
gCalc = 1;
return(lotSize1);
}
} else {
gCalc = 1;
return(lotSize1);
}
gCalc = 1;
return(lotSize1);
}
int getLastTicket()
{
int oTotal = OrdersHistoryTotal();
int myTicket = -1;
int lastOpenTime = -1;
bool ret;
for(int i = 0; i < oTotal; i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY) == false)
{
Print("Access to history failed with error (",GetLastError(),")");
return(-1);
}
if(OrderMagicNumber() == MagicNumber &&
OrderOpenTime() > lastOpenTime)
{
lastOpenTime = OrderOpenTime();
myTicket = OrderTicket();
}
}
return(myTicket);
}
i2trader