Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 844

 
AlexeyVik:

It's not a script. It's just a command to open an order. The OrderSend function returns the order ticket if the opening was successful. But before closing it must first determine the ticket of the order. To determine it, we first need to select the order from the list of orders by its index. If there is only 1 order open, its index in the list will be 0. Accordingly, if there is only one open order, we can do this without looping and checking for a symbol match and magic match. It is not very smart, but still. Exclusively for the sake of example.

Such an undocumented trick in mql4 can be used to close an order OrderClosePrice() instead of Ask or Bid, and in this case, we don't have to distinguish between the order types. It will close in any case.

Look here, you've written it, but who will be responsible for the "faults"? :))))

He doesn't understand that it is a very incorrect code for work in real world. Well ... it's like he's rolling down a hill sitting in a barrel thinking he's riding in a car.

I tried to show the man how to do it properly, not how to do it randomly... Ehhhhh...

 
Escapee:

Wait... Understand finally what I need...

Here is the order opening I needed - OrderSend(Symbol(),OP_SELL,0.1,Bid,3,0,0); . And this script works.

Now I need to close......

I understand perfectly what you need. And I'm trying to explain to you how to do it right. But you shut your ears and don't want to listen. I guess I have to take my leave.

As an example, you give a simple command to send a trade request to the server. Of course it will send you the request. But are the data in it correct? And what does the trade server return?

And yes: this is not a script. This is an mql4 command

 
Good evening, is there a question, is it necessary to put a block in the Expert Advisor to work with errors or the terminal itself overcomes them (errors such as the server does not respond, the price has changed)?
 
Pokrov:
Good evening, is there a question, is it necessary to put a block in the Expert Advisor to work with errors or the terminal itself overcomes them (errors such as the server does not respond, the price has changed)?
Good question. И?
 
Pokrov, you need to put in error handling if you want the EA to overcome them.
 
artmedia70:
Good question. И?
So that was the question, there's a question mark at the end, is that necessary or optional?
 
artmedia70:

Look here, you've written it, but who will be responsible for the "faults"? :))))

He doesn't understand that it is a very incorrect code for work in real world. Well ... it's like him going down a hill in a barrel thinking he's riding in a car.

I was trying to teach a man how to do things right, not just do them... Ehhh...

I'll take it. You should drink less. :) Although there's a caveat. Not literate, but still. Just to give you an example.
 
Pokrov:
So that was the question, there's a question mark at the end, is that necessary or optional?
If you are writing a tester toy, you don't have to. But it is better for the working EA. If the EA will keep pounding the brokerage server with wrong commands or order modifications without changing the parameters, the brokerage company may block the EA and, consequently, the orders set by the EA will become "unattended".
 
AlexeyVik:
If you are writing a tester toy, you don't have to. But it is desirable for a working EA. If your EA will keep pounding the server with wrong commands or modifying orders without changing parameters, your brokerage company will block your EA and, consequently, the orders set by your EA will become unattended.
Thank you!
 
Pokrov, I told you what you're looking at...