Send Order each day at hour 01:00

 

Hello guys,

I have been working on a little script for days and I can't make it to work in my strategy tester. This is the concept:

1) If time = 01:00, sendorder()

2) if time = 23:00, closeorders()

3) no trading in weekends

 

The problem is that I can't find any good working IF statement that triggers the IF 01 hour or the IF 23hour. Please, could anybody just give me a step in the good direction?

Thanks if highly appreciated!!!

 

//==================================== my program
int start()  
{
if(Hour()==01)				//start loop at time 01:00
{
   if(OrdersTotal()<1){			//place only 1 order	
   placeorders();
   }
}
}//end start

//==================================== functions

int placeorders(){

int    ticket;//,expiration;
double point;
point=MarketInfo(Symbol(),MODE_POINT);

double TakeProfitLevel;
double StopLossLevel;
int et = TimeCurrent()+86400; //24hours
   
   TakeProfitLevel = Ask + TakeProfit*Point*10;   //0.00001 * 10 = 0.0001
   StopLossLevel = Ask - StopLoss*Point*10;
      
      ticket=OrderSend(Symbol(),OP_BUY, 0.01, Ask, 10*10, StopLossLevel, TakeProfitLevel, "My 1st Order!",et,clrNONE); 
      if(ticket<=0){ Print("De Error is volgende = ",GetLastError());}
      else { Print("ticket = ",ticket);  }
      //---- 10 seconds wait
      Sleep(10000);
//Print("new expiration time = ",TimeToStr(et,TIME_DATE|TIME_SECONDS));
return;
}
 

That is not the code that you are testing.

You declare your function as an integer, but do not return a value. It will not compile. 

Reason: