Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1856
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
a multicurrency EA and everything is working as planned except for opening orders. I am looking for error messages.
It is not giving out any error, it is just not opening an order.
Did you notice where the error is?
https://docs.mql4.com/ru/trading/ordersend
Примечание
When opening a market order (OP_SELL or OP_BUY), only the latest Bid (for selling) or Ask (for buying) prices may be used as the opening price. If the operation is performed for a financial instrument, different from the current one, then to get the latest quotes for this instrument, one should use theMarketInfo() function with the MODE_BID or MODE_ASK parameter.
You cannot use an estimated or non-normalized price. If the requested opening price was not in the price flow, or the requested price is not normalized according to the number of decimal places, error 129 (ERR_INVALID_PRICE) will be generated. If the requested opening price is severely out of date, an error 138 (ERR_REQUOTE) will be generated regardless of the value of the slippage parameter. If, on the other hand, the requested price is out of date but is still present in the price flow, the order will be opened at the current price and only if the current price falls within the price+-slippage range.
...
It is also desirable to set a unique magic for the robot.
As far as I know, Ask and Bid are already normalised. A similar question has already been raised and there has been no contradiction.
The magik and digits of stoploss and profit may be appropriate, but the author's intention is not known.
As far as I know, Ask and Bid are already normalised. A similar question has already been raised and there has been no contradiction.
Perhaps it is appropriate to mention magik and digits of stop-loss and profit, but I don't know what the author's idea is.
As far as I know, the documentation doesn't say a word about it. So, you'd better take precautions. It won't make it worse.
Regarding the SL and TP, they are calculated. And therefore they should definitely be normalized according to the digits value.
Hello friends.
Good afternoon.
How do I get the opening time of the second and subsequent orders, because OpenOrderTime() gives out only the first one, and also how do I get the opening price of the second and subsequent orders, because the OpenOrderPrice() analogue also gives out the price of the first one?
collect (or remember/know) everything, sort by open time. That's what, but the open time doesn't change :-)
If the EA logic contains more than 1 order (e.g. grid), then you will have to remember them all. Or you will have to slow down trying to remember them all at every sneeze
Can you tell me if the profit in the history is circled in blue, does this include commission and swap?
The time and price of the order to be selected using the function OrderSelect() will be obtained.
As far as I know there is no mention of this in the documentation. So it's better to play it safe. It won't make things worse.
There have been complaints that this procedure takes a lot of CPU time.
As far as SL and TP are concerned, they are calculated. And therefore they should definitely be normalised according to the digits value.
Here, in any case, it is necessary to find out the author's intention.