
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 would like to see an example where the code I posted would fail.
I gave you several links which explain it. Here's a graphic FIFO example.
LMAO
Typical Rhoeder
In the 3 years I have been using this function, in every situation in which I could see the need to close multiple positions on multiple charts or just 1, this function has never failed to close all the orders.
OP can use this function or not doesn't matter to me. I am still waiting on something better to come along, haven't seen anything but links and graphics so far.
Donald Gibson:
LMAO
Typical Rhoeder
In the 3 years I have been using this function, in every situation in which I could see the need to close multiple positions on multiple charts or just 1, this function has never failed to close all the orders.
LMAO
Typical Rhoeder
In the 3 years I have been using this function, in every situation in which I could see the need to close multiple positions on multiple charts or just 1, this function has never failed to close all the orders.
OP can use this function or not doesn't matter to me.
I'm going to side with whordor on this one. No matter what programming language you use you should never mutate an iterable while you are iterating it. With MQL you are forced against your will to iterate a mutating iterable and need to adjust your code accordingly. First, iterating index forward over the iterable (while mutating it explicitly) is an absolute recipe for failure. I also don't agree that reversing the index is the best fix, but it's better than forward since it won't skip over elements when they are removed. No matter what, working with FIFO and the MQL order-pool is always a race-condition. Therefore it is best to find the (F)irst ticket in the pool, deal with it, then recursively call back to the function so that you can limit the race-condition to just the nanosecond it takes to iterate over the pool (w/o trade ops).
I am still waiting on something better to come along, haven't seen anything but links and graphics so far.
This is better.
And shouldn't use iteration when a loop will do. Perhaps this, for both of us:
And shouldn't use iteration when a loop will do. Perhaps this, for both of us:
Iteration is looping. I think you meant recursion? Your function would only work on non-FIFO brokers, and even still, recursion is much more explicit than mutating the index.
Wasn't yet awake, yes I meant recursion. Function works on both.
Wasn't it you who said, "don't assume the order is ordered"? ...don't assume the order pool is ordered.
Could EA Really Live By Order_History Alone? (ubzen) - MQL4 and MetaTrader 4 - MQL4 programming forum
Count how many lost orders from the last profit order - MQL4 and MetaTrader 4 - MQL4 programming forum