Wow thank you, I think this method is more versatile.
By the way, how to declare in EA that the order has been opened, OrderSend as I understand sends only the order ticket. Maybe, this can be implemented using OrderSelect?
Before the initialization block, let's declare a variable which will carry the order ticket. For example:
Since the OrderSend() function returns a ticket of the order, then we check if the Ticket variable is greater than zero, then the order has been placed. Otherwise, we have no order - see OrderSend reference - it is written there that if the order cannot be set, the function will return the value = (-1), not a tick. On the next tick, because the variable is first initialised with value = -1 and no order is set, the variable will remain negative until the end of the code. And this continues until a new order is placed.
So once an order has assigned its number to the Ticket variable, there is no need to output it with return, the variable will not be deleted further on the next tick?
Is it possible to open several orders at the same time? For example like this
It may not work that way, because the first request will be handled by the server and the next ones will get an error - the trade thread is busy. It would be better to use your own orders with error handling.
Wow thank you, I think this method is more versatile.
By the way, how to declare in EA that the order has been opened, OrderSend as I understand sends only the order ticket. Maybe, this can be implemented using OrderSelect?
Before the initialization block, let's declare a variable which will carry the order ticket. For example:
int Ticket;
In the start () function, before calling OrderSend(), we write:
Ticket=-1;
Since the OrderSend() function returns a ticket of the order, then we check if the Ticket variable is greater than zero, then the order has been placed. Otherwise, we have no order - see OrderSend reference - it is written there that if the order cannot be set, the function will return the value = (-1), not a tick. On the next tick, because the variable is first initialised with value = -1 and no order is set, the variable will remain negative until the end of the code. And this continues until a new order is placed.
Could you please show me an example, because I'm having a hard time.
Why is Ticket=(-1); in brackets?
What kind of nonsense is this, the order is open and the ticket is still -1.
return(Ticket);?Is it possible to open several orders at the same time? For example like this
Is it possible to open several orders at the same time? For example like this
Is it possible to open several orders at the same time? For example like this?
You cannot do it all at once.
Only consecutively.