Partial Close EA - page 2

 

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?

 
justin7:
Please anybody have?

Select the order you wish to close (half of it) and add the following code :

int LotDigit = 0;

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

 
mladen:
Select the order you wish to close (half of it) and add the following code :
int LotDigit = 0;

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

apologies I have no coding knowledge of any kind can you make into an EA?

Regards, J