time condition

 

Hi.

I would like to add to my open conditions sth like that:

OrderOpenTime()  of last trade + 4 Hours <= TimeCurrent()


plz help

 
Brt88: I would like to add to my open conditions
learn to code it, or pay someone. We're not going to code it FOR you.
We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
 
https://www.mql5.com/en/forum/91432/page2#comment_2662193
 
WHRoeder:
Brt88: I would like to add to my open conditions
learn to code it, or pay someone. We're not going to code it FOR you.
We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.

U R right :) but im learning to code so its not easy.

Nature of problem: I want to find moments of false breakouts over d1 highs and lows in period of 5 previous days. I made loop but it doesnt for properly. I would like to make it check for i=5 that daily high[5]> H[4],H[3],H[2] and H[1]

but in case of i=2 i will compare: daily high[2]> daily high[1] .  My attempt below with next conditions to fulfill.

 //--- sell conditions
  for (i=5; i>1;i--)
      //{ for(n=i-1; n>0; n--)
            { if (iHigh(NULL,PERIOD_D1,i)>iHigh(NULL,PERIOD_D1,n)) 
               {if (     
                    High[1] > iHigh(NULL,PERIOD_D1,i)          
                   && Close[1] < iHigh(NULL,PERIOD_D1,i)   
                   && High[1] == iHigh(NULL,PERIOD_D1,0)    
                   &&  (SLs-Close[1]) <wprofit*ATRd     
                   && (High[1]-Close[1])>( Close[1]-Low[1])           
                   && 10000*( iHigh(NULL,PERIOD_D1,0)-iHigh(NULL,PERIOD_D1,i))>= 5  
                   && TimeCurrent()- LastOpenTime()> 4*60*60 
                     )
                        {
                      // OrderSend(Symbol(),OP_SELL,0.1,Bid,3,SLs,TPs0,"",11111111,0,Red);
                      res=OrderSend(Symbol(),OP_SELL,0.1,Bid,3,SLs,TPs,"",MAGICMA,0,Red);
                      return;
                         } 
             }  //}
       }
Reason: