
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 changed the closing mechanism from:
to
and now everything works as expected. Even though I don't understand why is that. Because i really don't understand the additional lines in the second code. But thank you guys!
I change the closing mechanism from:
to
and now everything works as expected. Thank you guys!
I changed the closing mechanism from:
to
and now everything works as expected. Even though I don't understand why is that. Because i really don't understand the additional lines in the second code. But thank you guys!
Your second code is correct but a little funny. Open MetaEditor, navigator window (Ctrl + D), dictionary tab, and select MQL4 Reference > Standard constants > Trade operations.
It probably won't always work . . . when closing open orders or deleting pending orders within a loop you MUST count down not up . . . you need to change your loop. And you need to put the chack back in for Symbol() . . . otherwise the EA for EURUSD will end up potentially closing orders for GBPUSD . . . what you needed to do was get rid of the continue . . . or make the == into !=
Just to get you right. What you say is that if I modify the first code to:
then it also should work?? Because I tried this and it's just opening one order per currency pair again.
Or if i change the second code to (k++ to k--) it also opens only one trade per currency pair.
Just to get you right. What you say is that if I modify the first code to:
then it also should work?? Because I tried this and it's just opening one order per currency pair again.
Or if i change the second code to (k++ to k--) it also opens only one trade per currency pair.
I'm talking about the first code, the loop you are using where you close orders . . . it must decrement . . . otherwise you will miss orders. I see you have removed the continue and added { } braces, very good :-)
Opening one Order per currency pair or one Order in total ?
Opening one Order per currency pair or one Order in total ?
Yea, in total of course. Okay 2nd code:
When we are talking about the loop I think you mean this:
Actually i would change it to something like this:
This line opens only one Order per currency Pair (as desired!)
Is the loop correct regarding to this problem now? :
RaptorUK:
It probably won't always work . . . when closing open orders or deleting pending orders within a loop you MUST count down not up . . . you need to change your loop. And you need to put the chack back in for Symbol() . . . otherwise the EA for EURUSD will end up potentially closing orders for GBPUSD . . . what you needed to do was get rid of the continue . . . or make the == into !=Yea, in total of course. Okay 2nd code:
When we are talking about the loop I think you mean this:
Actually i would change it to something like this:
This line opens only one Order per currency Pair (as desired!)
Is the loop correct regarding to this problem now? :
No, do this . . .
The first order position is 0 so if you have 5 orders the positions are 0, 1, 2, 3, 4 . . . so the last is OrdersTotal() - 1 . . . so to count down you start at OrdersTotal()-1 and end at 0
No, do this . . .
The first order position is 0 so if you have 5 orders the positions are 0, 1, 2, 3, 4 . . . so the last is OrdersTotal() - 1 . . . so to count down you start at OrdersTotal()-1 and end at 0
So it should look like this:
because you wrote this:
or am I wrong?
So it should look like this:
because you wrote this:
or am I wrong?