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
Hi
This approach only works if the current position size is zero and the new trade is executed successfully with the desired position size.
See code:
But what if your EA is turning the position around: from a LONG to a SHORT position or vice versa and this action is performed in 2 different trades?
After the first trade the "position_opened" boolean is set to "TRUE" and the EA can't open the 2e trade because the condition is checking "if(conditions_to_open && !position_opened)", so the second trade will be blocked.
And what if the position size is only partially opened? You need a second trade to get your position size to the correct size.
In the end, to make "a long story short", you always need the PositionSelect(Symbol()) function to calculate the CURRENT position size and this is where the problem all started (and this forum thread).
At the critical moment, when the EA is calling the PositionSelect(Symbol()), the terminal as not yet updated the CURRENT position size and the EA is working with the wrong position size and sends in a new double order to the trade server.
I think the approach from (figurelli) is better because you are forced to wait until the EA has updated the PositionSelect(Symbol()) function to the right position size.
Hi
This approach only works if the current position size is zero and the new trade is executed successfully with the desired position size.
See code:
But what if your EA is turning the position around: from a LONG to a SHORT position or vice versa and this action is performed in 2 different trades?
After the first trade the "position_opened" boolean is set to "TRUE" and the EA can't open the 2e trade because the condition is checking "if(conditions_to_open && !position_opened)", so the second trade will be blocked.
And what if the position size is only partially opened? You need a second trade to get your position size to the correct size.
In the end, to make "a long story short", you always need the PositionSelect(Symbol()) function to calculate the CURRENT position size and this is where the problem all started (and this forum thread).
At the critical moment, when the EA is calling the PositionSelect(Symbol()), the terminal as not yet updated the CURRENT position size and the EA is working with the wrong position size and sends in a new double order to the trade server.
I think the approach from (figurelli) is better because you are forced to wait until the EA has updated the PositionSelect(Symbol()) function
You are right, both approach have limitations.
The origin of this issue is now identified clearly. Each one have to adapt his code depending of his strategy. I don't think there is a general method that can apply on all cases.
Do we need an OrderSendReliable() Library for the Great & Powerful mql5?
You are right, both approach have limitations.
The origin of this issue is now identified clearly. Each one have to adapt his code depending of his strategy. I don't think there is a general method that can apply on all cases.
Or we have to wait for an "official statement" from the Metaquotes guys themselves.
Is there already a response from the service desk?
If I agreed with you would you consider it un-helpful? .
I just taught that the solution of Sleeping until Terminating Trading reminded me of OrderSendReliable(). I taught these would have been addressed more elegantly.
It also reminds me of the old_documents handling ... where it goes { and all trading should be stopped }.
Anyways, apologies didn't mean to pick on mql5.
Or we have to wait for an "official statement" from the Metaquotes guys themselves.
Is there already a response from the service desk?
No. I was just thinking about that...It would be probably useful if all concerned people write a ticket to ServiceDesk about this issue. However I am very sceptical if MQ is willing to change this design. But we can try.
People can write to ServiceDesk and report the ticket# here. Mine is
If I agreed with you would you consider if un-helpful? .
I just taught that the solution of Sleeping until Terminating Trading reminded me of OrderSendReliable(). I taught these would have been addressed more elegantly.
It also reminds me of the old_documents handling ... where it goes { and all trading should be stopped }.
Anyways, apologies didn't mean to pick on mql5.
Yes, but its hard to tell if its because of bad coding. Double trading was a problem even before the multiple trading thread. The way its traditionally handled is the way snelle_moda handles it.
Yes, but its hard to tell if its because of bad coding. Double trading was a problem even before the multiple trading thread. The way its traditionally handled is the way snelle_moda handles it.