Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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