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 repeat you again: you open new position when you call CloseAll(). It is your error in your code.
I repeat you again: you open new position when you call CloseAll(). It is your error in your code.
I call CloseAll() is to close position ,not to create new position. You say call CloseAll() is to open new positon, Can you give a explain?
I have already explained that
It is mistake. PositionSelect can return true if the client terminal didn't get yet information from trade server. In this case your EA will send new trade request to trade and open a new position without SL and TP because I see this in your code:
...
Read the article Trade Events in MetaTrader 5.
I have already explained that
I think the function OrderSend() will wait until the serve return information.
No, it isn't. The trade functions are asynchronous. You don't need to wait for result of your trade request from OrderSend().
At the moment of the order processing, the trade server sends to the terminal a message about the occurrence of the Trade event, which can be processed by the OnTrade() function.