# custom the size of lot right after a position get closed in loss

10

Hi, everyone

I need a help to make my strategy in EA.

Is it possible to custom the size of lot right after a position get closed in loss?

I used the code following:

```extern double Lots=0.1;
extern double Lot_1=0.1;
extern double Lot_2=0.1;
extern double Lot_3=0.1;
extern double Lot_4=0.1;
extern double Lot_5=0.1;
extern double Lot_6=0.1;
extern double Lot_7=0.1;
extern double Lot_8=0.1;
extern double Lot_9=0.1;
extern bool UseMulti = false;
extern int Multi =2;

int start()
{
double newlot = Lots;
if (UseMulti==true)
{
if (ProfitOrLoss()==false) (newlot=lastlot()*Multi);
if (ProfitOrLoss()==true) (newlot=Lots);
}
if (UseMulti==false)
{
if (ProfitOrLoss_1()==true) (newlot=Lots);
if (ProfitOrLoss_1()==false) (newlot=Lot_1);
if (ProfitOrLoss_2()==true) (newlot=Lots);
if (ProfitOrLoss_2()==false) (newlot=Lot_2);
if (ProfitOrLoss_3()==true) (newlot=Lots);
if (ProfitOrLoss_3()==false) (newlot=Lot_3);
if (ProfitOrLoss_4()==true) (newlot=Lots);
if (ProfitOrLoss_4()==false) (newlot=Lot_4);
if (ProfitOrLoss_5()==true) (newlot=Lots);
if (ProfitOrLoss_5()==false) (newlot=Lot_5);
if (ProfitOrLoss_6()==true) (newlot=Lots);
if (ProfitOrLoss_6()==false) (newlot=Lot_6);
if (ProfitOrLoss_7()==true) (newlot=Lots);
if (ProfitOrLoss_7()==false) (newlot=Lot_7);
if (ProfitOrLoss_8()==true) (newlot=Lots);
if (ProfitOrLoss_8()==false) (newlot=Lot_8);
if (ProfitOrLoss_9()==true) (newlot=Lots);
if (ProfitOrLoss_9()==false) (newlot=Lot_9);

}
return(0);
}

///////////////

bool ProfitOrLoss()
{
bool y = true ;
for (int i=0;i<OrdersHistoryTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if (OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNumber)
{
if (OrderProfit()>0)
{
y = true;
}
else
{
y = false;
}
}
}
return (y);
}

double lastlot()
{
double y = OrderLots();
for (int i=0;i<=OrdersHistoryTotal();i++)
{
OrderSelect (i,SELECT_BY_POS,MODE_HISTORY);
if (OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNumber)
{
y= OrderLots();
}
}
return (y);
}

/////////////////

bool ProfitOrLoss_1()
{
bool y = true ;
for (int i=0;i<OrdersHistoryTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if (OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNumber && OrderLots()==Lot_1)
{
if (OrderProfit()>0)
{
y = true;
}
else
{
y = false;
}
}
}
return (y);
}
/////////////
bool ProfitOrLoss_2()
{
bool y = true ;
for (int i=0;i<OrdersHistoryTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if (OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNumber && OrderLots()==Lot_2)
{
if (OrderProfit()>0)
{
y = true;
}
else
{
y = false;
}
}
}
return (y);
}
/////////////
bool ProfitOrLoss_3()
{
bool y = true ;
for (int i=0;i<OrdersHistoryTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if (OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNumber && OrderLots()==Lot_3)
{
if (OrderProfit()>0)
{
y = true;
}
else
{
y = false;
}
}
}
return (y);
}
/////////////
bool ProfitOrLoss_4()
{
bool y = true ;
for (int i=0;i<OrdersHistoryTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if (OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNumber && OrderLots()==Lot_4)
{
if (OrderProfit()>0)
{
y = true;
}
else
{
y = false;
}
}
}
return (y);
}
/////////////
bool ProfitOrLoss_5()
{
bool y = true ;
for (int i=0;i<OrdersHistoryTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if (OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNumber && OrderLots()==Lot_5)
{
if (OrderProfit()>0)
{
y = true;
}
else
{
y = false;
}
}
}
return (y);
}
/////////////
bool ProfitOrLoss_6()
{
bool y = true ;
for (int i=0;i<OrdersHistoryTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if (OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNumber && OrderLots()==Lot_6)
{
if (OrderProfit()>0)
{
y = true;
}
else
{
y = false;
}
}
}
return (y);
}
/////////////
bool ProfitOrLoss_7()
{
bool y = true ;
for (int i=0;i<OrdersHistoryTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if (OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNumber && OrderLots()==Lot_7)
{
if (OrderProfit()>0)
{
y = true;
}
else
{
y = false;
}
}
}
return (y);
}
/////////////
bool ProfitOrLoss_8()
{
bool y = true ;
for (int i=0;i<OrdersHistoryTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if (OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNumber && OrderLots()==Lot_8)
{
if (OrderProfit()>0)
{
y = true;
}
else
{
y = false;
}
}
}
return (y);
}
/////////////
bool ProfitOrLoss_9()
{
bool y = true ;
for (int i=0;i<OrdersHistoryTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if (OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNumber && OrderLots()==Lot_9)
{
if (OrderProfit()>0)
{
y = true;
}
else
{
y = false;
}
}
}
return (y);
}```

and i use "newlot" for volume in OrderSend
for example, If Lot_1 is closed in loss, then open Lot_2 , and the Lot_2 is closed in loss, then open Lot_3, and so