Download MetaTrader 5
To add comments, please log in or register
Track Market top sellers!
buju
151
buju 2016.02.03 08:48 

this works but its rubbish.

during the first 1 or < 5 minutes of a new hour or bar ,  I want to check for a condition:

 string check;

 Hr=Hour();

 Min=Minute();

 

   check = "n";

   if(Hr == 0 && Min == 0 )

     {check="y";}


   if(Hr==1 && Min==0)

     {check="y";}


   if(Hr==2 && Min==0)

     {check="y";}


   if(Hr==3 && Min==0)

     {check="y";}


   if(Hr==4 && Min==0)

     {check="y";}


   if(Hr==5 && Min==0)

     {check="y";}


   if(Hr==6 && Min==0)

     {check="y";}


   if(Hr==7 && Min==0)

     {check="y";}


   if(Hr==8 && Min==0)

     {check="y";}


   if(Hr==9 && Min==0)

     {check="y";}


   if(Hr==10 && Min==0)

     {check="y";}


   if(Hr==11 && Min==0)

     {check="y";}


   if(Hr==12 && Min==0)

     {check="y";}


   if(Hr==13 && Min==0)

     {check="y";}


   if(Hr==14 && Min==0)

     {check="y";}


   if(Hr==15 && Min==0)

     {check="y";}


   if(Hr==16 && Min==0)

     {check="y";}


   if(Hr==17 && Min==0)

     {check="y";}


   if(Hr==18 && Min==0)

     {check="y";}


   if(Hr==19 && Min==0)

     {check="y";}


   if(Hr==20 && Min==0)

     {check="y";}


   if(Hr==21 && Min==0)

     {check="y";}


   if(Hr==22 && Min==0)

     {check="y";}


   if(Hr==23 && Min==0)

     {check="y";}


//if (check == "y")

//Print (check);


   if(check=="y")

     { 

Carl Schreiber
5959
Carl Schreiber 2016.02.03 08:58  

1) User SRC-button for code!!

2) You want to check every full hour(?):

static datetime NewHour
...
if ( NewHour != iTime(_Symbol,PERIOD_H1,0) ) {
   NewHour = iTime(_Symbol,PERIOD_H1,0);
   check = y;
}
/
To add comments, please log in or register