Alain Verleyen:
Okay.Noted.
Sudhanshu Gupta:
Hi,
...It's impossible to help you without a complete view of your problem. Can you post the full code related to order sending ?
Can you post the logs ?

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,
I am using metatrader 5 and am currently developing an EA for the platform. I hope you guys can help me out with a small problem.
I am using the below code to check if there is a trade placed in my expert advisor and if there is what kind of trade is it (BUY/SELL).
-------------------------------------------------------
FIRST BLOCK
---------------------------------------------------------Further, I use the value of Buy_opened/Sell_Opened to send an order in the respective opposite direction (i.e. to close an open trade).
I use the following code to close an open position :
-------------------------------------------------------
SECOND BLOCK
-------------------------------------------------------------The problem is that when first block is executed Buy_Opened and Sell_Opened become false, after that suppose a sell order is placed and hence sell_opened becomes true now when it enters if(Sell_Opened) in the second block, it executes a buy order in opposite direction,therefore, closing the previous opened trade...Now no trades are opened...Now when First Block is executed again it does not set the values of BUY_OPENED and SELL_OPENED to false instead it sets the value of Buy_Opened(the last order that was used to close the previous order) as true. Can anyone help me with amateur problem of mine? Thank you in advance.