DayOfWeek() function

 

Hi..


I need to stop my order opening on Fridays. and i tried to get day from  DayOfWeek function. its working with one broker and for other every day returning 0. can someone help me on this.

int DA=DayOfWeek();

(0-Sunday,1,2,3,4,5,6) 

 
dwijedasa:

Hi..

I need to stop my order opening on Fridays. and i tried to get day from  DayOfWeek function. its working with one broker and for other every day returning 0. can someone help me on this.

int DA=DayOfWeek();

(0-Sunday,1,2,3,4,5,6) 

Then try the 2nd variant of TimeCurrent() instead. Then see if the MqlDateTime structure contains the right value.

TimeCurrent - Date and Time - MQL4 Reference
TimeCurrent - Date and Time - MQL4 Reference
  • docs.mql4.com
Returns the last known server time, time of the last quote receipt for one of the symbols selected in the "Market Watch" window. In the OnTick() handler, this function returns the time of the received handled tick. In other cases (for example, call in handlers OnInit(), OnDeinit(), OnTimer() and so on) this...
 
Seng Joo Thio:

Then try the 2nd variant of TimeCurrent() instead. Then see if the MqlDateTime structure contains the right value.

Hi Seng

thanks for your comment, i am new for MQL. can you describe this in detail or can you give sample code of this.

 
dwijedasa:

Hi Seng

thanks for your comment, i am new for MQL. can you describe this in detail or can you give sample code of this.

See if '1' and '2' below produce the same output:

   // 1
   Print ("DayOfWeek() = ", DayOfWeek());
   
   // 2
   MqlDateTime dt;
   TimeCurrent(dt);
   Print ("dt.day_of_week = ", dt.day_of_week);
 
dwijedasa: DayOfWeek function. its working with one broker and for other every day returning 0.

Where are you calling it?

Reason: