| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Deleting pending orders https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=2605 |
Page 2 of 2 |
| Author: | traderuk [ Tue Jun 25, 2013 3:20 pm ] |
| Post subject: | Re: Deleting pending orders |
That works great and makes sense, thank you! |
|
| Author: | traderuk [ Tue Jun 25, 2013 6:27 pm ] |
| Post subject: | Re: Deleting pending orders |
Any ideas why my original method wasn't working... to help with the learning? |
|
| Author: | dietcoke [ Wed Jun 26, 2013 8:25 am ] |
| Post subject: | Re: Deleting pending orders |
this would work, except it will only ever close one order due to the positioning of the return(0) line Code: Select all Code: Select all |
|
| Author: | traderuk [ Wed Jun 26, 2013 10:51 am ] |
| Post subject: | Re: Deleting pending orders |
I can't thank you enough for your time! I understand how the loop works and why we would move return to the outside of for loop, that makes sense. From what I've read on mql4 docs I may be a bit confused about the return(0); actually does. "A return(expression); operator terminates the current function execution with result transmission" If for example we did return(-1); instead would this continuous loop, as it would return -1 and effectively set the condition trade=trades-1 on the next pass of the loop? So the return(); effectively sets the value once the loop is made completed and is probably just a way to break out of the loop if I understand it right? Thanks again |
|
| Author: | traderuk [ Thu Jun 27, 2013 9:18 am ] |
| Post subject: | Re: Deleting pending orders |
Think I understand it some more... It turns out that in a function void it doesn't return anything so the return() wouldn't do anything. If I wanted to return something we'd use int or bool etc. ClosePendings Code: Select all |
|
| Author: | phil_trade [ Thu Jun 27, 2013 1:37 pm ] |
| Post subject: | Re: Deleting pending orders |
it's also better to use a bool function that return True or False depending if action required was executed it's also better to test if OrderSelect was well executed Code: Select all |
|
| All times are UTC | Page 2 of 2 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|