tenlau: How to code this without for() loop ? In fact I do not need it.
|
|
tenlau: How to code this without for() loop ? In fact I do not need it. |
|
A - I wanted to avoid loosing time with for loop; since is only one order opened I thought is faster to close it....But I don't know how to find it....
B - About "persistent storage (GV+flush/file)" please give some more details...
- Faster is irrelevant. The platform completes in microseconds (0.000 0xx.) The network transmits in tens-thousands of milliseconds (0.030 xxx.) The server can take minutes (during news) to close the order (120.xxx xxx.)
- You have to find the ticket number. What part of "OrderSelect loop or persistent storage" is unclear "to find it?"
- What part of Global Variables of the Terminal - MQL4 Reference including using GlobalVariablesFlush or using File Functions - MQL4 Reference is unclear?
- Faster is irrelevant. The platform completes in microseconds (0.000 0xx.) The network transmits in tens-thousands of milliseconds (0.030 xxx.) The server can take minutes (during news) to close the order (120.xxx xxx.)
- You have to find the ticket number. What part of "OrderSelect loop or persistent storage" is unclear "to find it?"
- What part of Global Variables of the Terminal - MQL4 Reference including using GlobalVariablesFlush or using File Functions - MQL4 Reference is unclear?
! and 3 is clear.
For 2: I open an order with:
int OrderSend (string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=1234, datetime expiration=0, color arrow_color=CLR_NONE)
when I look for close it, it's ticket is 1234 ? (magic number). In other words magic=ticket number? If not: a- what are the differences between ticket and magic? b- how to find ticket of the open order without OrderSelect loop?
If you open a ticket (OrderSend) you get the ticket number (e.g. 115719094.) A ticket is not a magic number.
In the OrderSelect loop you can filter all orders to find the ticket with your magic number and pair.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hy, beginner question,
I have an EA that closes open positions like this:
Please see attached file for OrderCloseZ() function; it is also used for opening orders.
I am unable to simplify the code like this: I want to open a single order and then close it when conditions are "true". How to code this without for() loop ? In fact I do not need it. It is a single order, but I do not know how to code it's opening , then finding it an code it's close.
Thanks in advance for suggestions!