Quote:
Originally Posted by forextrend
Has anyone got code i can use to control the number of trades and EA opens in a day.
Such as open just 3 trades per day and do not open anymore trades until the next trading day.
|
Call this function :
PHP Code:
int DailyCount()
{
int i, DailyCount = 0;
for(i = OrdersTotal()-1; i >= 0; i --)
{
if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
if(OrderSymbol() != Symbol()) continue;
if(OrderMagicNumber() != Magic) continue;
if(TimeDayOfYear(OrderOpenTime()) == DayOfYear()) DailyCount ++;
}
return(DailyCount);
}