Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 844
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
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...
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)?
Good question. И?
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...
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 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.