Want to ad open condition if time > 9:30 server time

 

Hi, can anybody help me?

bool buy()
  {

   int get = cek();

   if(Cek2(get) && MA576_H4>MA1200_H4 && H4_H1>MA1200_H4 && MA384_H1>MA800_H1 && H1_H1>MA800_H1 && MA12_H4>MA128_H4 && MA12_H4-MA128_H4>MA121_H4-MA1281_H4 && MA12_H1>MA128_H1 && MA12_H1-MA128_H1>MA121_H1-MA1281_H1)
      return (true);

I want to add condition if (servertime > 9:30 && Cek2(get) && .... )

if use Hour()>=9 && Minutes()>=30, doesn't appropriate since during next hour minutes < 30 will be disregard.

 
Agus Widjaja:

Hi, can anybody help me?

I want to add condition if (servertime > 9:30 && Cek2(get) && .... )

if use Hour()>=9 && Minutes()>=30, doesn't appropriate since during next hour minutes < 30 will be disregard.

https://www.mql5.com/en/forum/356804

you can find information on the topic here

need help for coding a time window !
need help for coding a time window !
  • 2020.11.29
  • www.mql5.com
hi people. im new to this and im looking for a way to make a specific time window to trade in EA...
 
Agus Widjaja: I want to add condition if (servertime > 9:30 && Cek2(get) && .... )

if use Hour()>=9 && Minutes()>=30, doesn't appropriate since during next hour minutes < 30 will be disregard.

  1. Hour and minutes is appropriate for your condition only between 9:30 to 10:00.

  2. #define HR0930 34200 // 9*3600+30*60
    datetime now = TimeCurrent();
    if(time(now) >= HR0930 …) …
              Find bar of the same time one day ago - MQL4 programming forum 2017.10.06

  3.    if(Cek2(get) && MA576_H4>MA1200_H4 && H4_H1>MA1200_H4 && MA384_H1>MA800_H1 && H1_H1>MA800_H1 && MA12_H4>MA128_H4 && MA12_H4-MA128_H4>MA121_H4-MA1281_H4 && MA12_H1>MA128_H1 && MA12_H1-MA128_H1>MA121_H1-MA1281_H1)
    
    Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code. I'm not going to go scrolling (or moving my eyes) back and forth trying to read it.