How to send two orders that meet the same rule in different day...?

 

Dear all

I want to send two orders that meet the same rule in different day

below is my code

int p=20;
int a,aa;
double vol3=0.1;
double open,type;
datetime b;

if((Ask-Open[0]>=1000*Point || Ask-Open[1]>=1000*Point) && Ask >= iMA(NULL,0,p,0,MODE_SMA,PRICE_HIGH,1)+500*Point && OrdersTotal() == 0 )
{
a=OrderSend(Symbol(),OP_BUY,vol3,Ask,5,Ask-2000*Point,Ask+3000*Point,"LONG",2,0,Blue);
b=OrderOpenTime();
}



if(TimeDayOfYear(TimeCurrent())==TimeDayOfYear(b)+1)
{

if((Ask-Open[0]>=1000*Point || Ask-Open[1]>=1000*Point) && Ask >= iMA(NULL,0,p,0,MODE_SMA,PRICE_HIGH,1)+500*Point&& OrdersTotal() ==1 )
{
a=OrderSend(Symbol(),OP_BUY,vol3,Ask,5,Ask-2000*Point,Ask+3000*Point,"LONG",2,0,Blue);
}
}

but the two orders were sent at the same time,is there anybody knows how to solve the problem...?

 

OrderOpenTime()

Note: The order must be previously selected by the OrderSelect() function.

Reason: