Hi,
I'm trying to code how much losses were in the last 10 trades I did this:
int CountLosses()
{
int Bistory = 10;
int ProfCout=0, LosCount=0;
int OrdHistory=OrdersHistoryTotal();
if(OrdHistory>0 && OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
{ for(int i=Bistory;i>=1;i--)
{
if(OrderSelect(OrdHistory-i,SELECT_BY_POS,MODE_HISTORY) && OrderProfit()<0)LosCount++;
}
}
return (LosCount);
}
but it doesn't work, it just starting to accumulate losses after 10 trades,
thanks
I'm trying to code how much losses were in the last 10 trades I did this:
int CountLosses()
{
int Bistory = 10;
int ProfCout=0, LosCount=0;
int OrdHistory=OrdersHistoryTotal();
if(OrdHistory>0 && OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
{ for(int i=Bistory;i>=1;i--)
{
if(OrderSelect(OrdHistory-i,SELECT_BY_POS,MODE_HISTORY) && OrderProfit()<0)LosCount++;
}
}
return (LosCount);
}
but it doesn't work, it just starting to accumulate losses after 10 trades,
thanks