if(UseMartingle&&HistoryProfit(MagicNumber2)<0){Lots=NextLot(MagicNumber2);}else{Lots=LotSize;}(BUY CONDITION..)
AND
//==========
double HistoryProfit(int magic){
double hp=0;
for(int i=0;i<=OrdersHistoryTotal();i++){
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
if(OrderSymbol()==Symbol()&&OrderMagicNumber()==magic){
hp=OrderProfit();
}
}
return(hp);
}
double NextLot(int magic)
{
double lot=0;
for(int i=0;i<=OrdersHistoryTotal();i++){
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
if(OrderSymbol()==Symbol()&&OrderMagicNumber()==magic){
lot=OrderLots()*2;
}
}
return(lot);
}
AND
//==========
double HistoryProfit(int magic){
double hp=0;
for(int i=0;i<=OrdersHistoryTotal();i++){
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
if(OrderSymbol()==Symbol()&&OrderMagicNumber()==magic){
hp=OrderProfit();
}
}
return(hp);
}
double NextLot(int magic)
{
double lot=0;
for(int i=0;i<=OrdersHistoryTotal();i++){
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
if(OrderSymbol()==Symbol()&&OrderMagicNumber()==magic){
lot=OrderLots()*2;
}
}
return(lot);
}