1) Put this code at the end of your EA codes. As you see itchecksboth MAXLOT and MINLOT:
//+------------------------------------------------------------------+bool isLotValid(int orderType,double lots)
{
if(lots>MarketInfo(_Symbol,MODE_MAXLOT) || lots<MarketInfo(_Symbol,MODE_MINLOT))
{
Print("Lots "+lots+": is not valid.(greater than Max or less than min)");
returnfalse;
}
double remainMargin=AccountFreeMarginCheck(_Symbol,orderType,lots);
if(remainMargin<0)
{
Print("Lots "+lots+": is not valid.(not enough margin)");
returnfalse;
}
returntrue;
}
//+------------------------------------------------------------------+
2) Then, put this code before the open order code for by or sell:
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.
i think nobody want to share proper solution when he get solution. i hope anybody help us to share a dummy code to solve this issue.
This should work. The 'lots' is a double value that is on another part of the code, however, the rest of the necessary code is as displayed.
You need to check the lot size first before doing an order. Just use this code to return the correct lot size. I hope it will help your problem.
Thanks,
This should work. The 'lots' is a double value that is on another part of the code, however, the rest of the necessary code is as displayed.
Thanks.
1) Put this code at the end of your EA codes. As you see it checks both MAXLOT and MINLOT:
2) Then, put this code before the open order code for by or sell:
1) Put this code at the end of your EA codes. As you see it checks both MAXLOT and MINLOT:
2) Then, put this code before the open order code for by or sell:
Dear All,
This is the last changes that I made and solved my problem. So, I really don't know any other solutions at this moment.
So, I hope you find the answer as helpful as I expected.
You haven't tried everything. You know what symbol/TF doesn't work. Run it there and debug it.
Thanks to all, I solved it.
i am having same problem can you tell how you solved it?