Only 2 trade per day, how? - page 2

 

To save Phy's fingers, this version tracks trades for the day by the pair of the chart

int start()
{


if(CheckTodaysOrders() >= 2){

return(0); // abort

}

//...

//... EA code...

//...

return(0);

}


// function

int CheckTodaysOrders(){

int TodaysOrders = 0;

for(int i = OrdersTotal()-1; i >=0; i--){

OrderSelect(i, SELECT_BY_POS,MODE_TRADES);

if(TimeDayOfYear(OrderOpenTime()) == TimeDayOfYear(TimeCurrent()) && OrderSymbol() == Symbol()){

TodaysOrders += 1;

}

}

for(i = OrdersHistoryTotal()-1; i >=0; i--){

OrderSelect(i, SELECT_BY_POS,MODE_HISTORY);

if(TimeDayOfYear(OrderOpenTime()) == TimeDayOfYear(TimeCurrent()) && OrderSymbol() == Symbol()){

TodaysOrders += 1;

}

}

return(TodaysOrders);

}

 
Hi, phy's fingers must be happy now.. thanks very much for the help!
BarrowBoy:

To save Phy's fingers, this version tracks trades for the day by the pair of the chart