fulltilt:
i should stop trading between dec15 and jan15, but in BT nothing gets blocked ... what is wrong?
Print the values of Month() and Day() to see if they are correct . . . alternatively . . .
Try using TimeMonth( TimeCurrent() ) and TimeDay( TimeCurrent() )
RaptorUK:
Print the values of Month() and Day() to see if they are correct . . . alternatively . . .
Try using TimeMonth( TimeCurrent() ) and TimeDay( TimeCurrent() )
thank you, now it's working :-)
fulltilt:
i should stop trading between dec15 and jan15, but in BT nothing gets blocked ... what is wrong?
if (Month()==12 && Day()>=15 || Month()==1 && Day()<=15) return(0);
- What is the priority between && and ||? If you don't know (and you shouldn't rely on it anyway) then make it explicit
if ( (Month()==12 && Day()>=15) || (Month()==1 && Day()<=15) ) return(0);
- You using the tester, you don't want the CURRENT month/day which is now April. You want the BAR's month/day. Use TimeMonth(Time[0])/TimeDay(Time[0])
Ref: https://www.mql5.com/en/forum/127483 reports DayOfWeek() always returns 5 in the tester.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
i should stop trading between dec15 and jan15, but in BT nothing gets blocked ... what is wrong?