In etwa so:
Code:
double GetLot()
{
int cnt=0;
double profit;
int ls = 1;
double lotmod = Lot; //Lot - initiale LotSize
if (MarketInfo(Symbol(), MODE_LOTSTEP) == 0.01) ls = 2;
for(i=OrdersHistoryTotal(); i >=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
{
if (OrderSymbol() == Symbol())
{
profit = OrderProfit() + OrderSwap() + OrderCommision();
if (profit < 0) cnt++;
else break;
if (cnt == 5)
{
lotmode = NormalizeDouble(Lot/2, ls);
return(lotmod);
}
}
}
}
return(lotmod);
}
traderdoc