stop EA from trading on a specific day [?]

 

hi there, every body.


was wondering if any one could throw in a line of code to disable EA from trading on a specific day?

i, personally dislike fridays, so lets take that for example.

so, this is the code - it closes all trades, and restarts the EA if equity has grown.

so, my idea is - after trades have been closed - check if its friday - if no, it continues - if yes - Well.. it doesnt restart, but checks again (later or still on every tick).

anyone care to share?


big thanks!


void OnTick()
  {
  

    
  if(FLUSH){
  if(AccountEquity()>=(accountbalance/100*FLUSH_Percent)+accountbalance){
     first=true;
   nAll=nBuy=nSell=0;
   LastBuy=LastSell=0.0;
  close=CloseOrders();
        Print(" FLUSH ");



  accountbalance=AccountBalance();
  MagicNumber=MagicNumber+1;
  }}
 
naurismucenieks:

hi there, every body.


was wondering if any one could throw in a line of code to disable EA from trading on a specific day?

i, personally dislike fridays, so lets take that for example.

so, this is the code - it closes all trades, and restarts the EA if equity has grown.

so, my idea is - after trades have been closed - check if its friday - if no, it continues - if yes - Well.. it doesnt restart, but checks again (later or still on every tick).

anyone care to share?


big thanks!


G'day

All you need to do is check the DayOfWeek (int) parameter. 0=Sunday through to 6=Saturday. So just chuck in something like this

 if(DayOfWeek()==5) return;   // Or whatever else you want to do if it's a Friday

 

Cheers 

 
Filter:

G'day

All you need to do is check the DayOfWeek (int) parameter. 0=Sunday through to 6=Saturday. So just chuck in something like this

 

Cheers 

hey there!


big thanks, works like a charm!

 
naurismucenieks:

hey there!


big thanks, works like a charm!

Awesome! Happy to help :)
 
damm i'll try to be faster))
 
goverkms:
damm i'll try to be faster))
hehehehe