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.
Does anyone have an ea like this? I need one to close half of a position at x pips please
Regards, J
Please anybody have?
Please anybody have?
Select the order you wish to close (half of it) and add the following code :
double MinLots = NormalizeDouble(MarketInfo(Symbol(),MODE_MINLOT) ,2);
double MaxLots = NormalizeDouble(MarketInfo(Symbol(),MODE_MAXLOT) ,2);
double LotStep = NormalizeDouble(MarketInfo(Symbol(),MODE_LOTSTEP),2);
if (LotStep==1) LotDigit=0;
if (LotStep==0.1) LotDigit=1;
if (LotStep==0.01) LotDigit=2;
double Lots=NormalizeDouble(OrderLots()/2.0,LotDigit);
if (Lots<MinLots) Lots=MinLots;
if (Lots>MaxLots) Lots=MaxLots;then try to close "Lots" of that selected order
Select the order you wish to close (half of it) and add the following code :
double MinLots = NormalizeDouble(MarketInfo(Symbol(),MODE_MINLOT) ,2);
double MaxLots = NormalizeDouble(MarketInfo(Symbol(),MODE_MAXLOT) ,2);
double LotStep = NormalizeDouble(MarketInfo(Symbol(),MODE_LOTSTEP),2);
if (LotStep==1) LotDigit=0;
if (LotStep==0.1) LotDigit=1;
if (LotStep==0.01) LotDigit=2;
double Lots=NormalizeDouble(OrderLots()/2.0,LotDigit);
if (Lots<MinLots) Lots=MinLots;
if (Lots>MaxLots) Lots=MaxLots;apologies I have no coding knowledge of any kind
can you make into an EA?
Regards, J