Hi all, I manually opened a sell order on USDCAD, size 0.10, order ticket 162078588.
I wrote a simple expert that I attached on the USDCAD graph.
The expert does not close the order. In the Journal tab there is nothing, no errors or advice.
Where is the problem?
Check your return value from the function OrderClose() and report the error and any other useful information, when you don't understand what is happening check that you are using the functions correctly.
Read these:
Hi all, I manually opened a sell order on USDCAD, size 0.10, order ticket 162078588.
I wrote a simple expert that I attached on the USDCAD graph.
int start() { OrderClose(162078588,OrderLots(),Ask,NULL,PaleGoldenrod) ; }
The expert does not close the order. In the Journal tab there is nothing, no errors or advice.
Where is the problem?
- Not checking your function return codes
- Useing OrderLots() BEFORE doing a successful OrderSelect()
- The fourth argument to OrderClose is NOT a string.
This give you an idea how to process :
for (int position = OrdersTotal()-1; position >= 0; position--) { if (OrderSelect(position, SELECT_BY_POS, MODE_TRADES) && OrderTicket() == 162078588 ) { if (!OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 0, PaleGoldenrod) { //TODO process error Print("Error .... ", GetLastError()); } } }
I have not compiled and tested.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all, I manually opened a sell order on USDCAD, size 0.10, order ticket 162078588.
I wrote a simple expert that I attached on the USDCAD graph.
The expert does not close the order. In the Journal tab there is nothing, no errors or advice.
Where is the problem?