| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Please critique what was wrong with this code https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=1636 |
Page 1 of 1 |
| Author: | dudest [ Sun Mar 17, 2013 5:09 pm ] |
| Post subject: | Please critique what was wrong with this code |
Hallo coders, I put the following code into an EA for the following reasons: a) If day is Monday: only open new trades after 9am ( broker/Empty4 platform time) b) If day is Friday: only open new trades before 3pm ( broker/Empty4 platform time) c) If day is Tue, Wed, or Thur: open new trades any time However, this last Fri (15th), the EA opened new trades after 3pm What was wrong with the code below? Thanks Code: Select all |
|
| Author: | garyfritz [ Sun Mar 17, 2013 7:28 pm ] |
| Post subject: | Re: Please critique what was wrong with this code |
I suspect your problem is the "1 < DoW < 5" bit. One never knows with MQL, but I suspect that's being evaluated as "(1 < DoW) < 5", and "(1 < DoW)" will evaluate to true or false, which have the integer values 1 and 0. Which is less than 5 so it's always true. See if "1 < DoW && DoW < 5" works any better. |
|
| Author: | dietcoke [ Mon Mar 18, 2013 1:54 am ] |
| Post subject: | Re: Please critique what was wrong with this code |
This is the wrong function. it returns the day of the month. (1-31). you should be using Code: Select all |
|
| Author: | dudest [ Mon Mar 18, 2013 6:05 am ] |
| Post subject: | Re: Please critique what was wrong with this code |
Thanks Gary! Changed it to the form above just incase MQL is doing funny evaluation Cheers! |
|
| Author: | dudest [ Mon Mar 18, 2013 6:06 am ] |
| Post subject: | Re: Please critique what was wrong with this code |
Thanks dc!, you're absolutely right, Scite IDE confirms what you've said. I've made the correction Cheers! |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|