OK. Enlighten us. What error in the code, or what code, can close a position in the tester at the price of another instrument. I'm really, really interested.
Торговая деятельность в платформе связана с формированием и отсылкой рыночных и отложенных ордеров для исполнения брокером, а также с управлением текущими позициями путем их модификации или закрытия. Платформа позволяет удобно просматривать торговую историю на счете, настраивать оповещения о событиях на рынке и многое другое. Открытие позиций...
The code is several thousand lines. There is no point in appending it. there are no static variables. There are classes. In any case it is the tester's error.
There is your error.
In debug mode, run a check before sending the trade order. Look at the symbol and prices. And test at least in "All ticks" mode.
OK. Enlighten us. What error in the code, or what code, could close a position in the tester at the price of another instrument. I am really, really curious.
Easily. It depends directly on the slavishness of the code. I did it myself :). Poorly thought-out system of character class initialization control. And plus there are static variables.
Anyway, it's meaningless to speak further without the code written by the person you are asking about.
Easily. It's a direct correlation to the curvature of the code. I have done it myself :). Insufficiently elaborate system of character class initialization control. And moreover there are static variables.
So it's meaningless to speak further without asking you about the code.
Can you show us an example of code? How do I close a position in EURUSD at GPBUSD price?
If so, it will not be a problem for you. I would be very grateful.
It's easy. The dependence of the code curvature. I made such mistakes myself :). Insufficiently well-thought-out system of character class initialization control. And plus static variables.
Anyway, it's meaningless to speak further without the code written by the person you are asking about.
Взаимодействие клиентского терминала и торгового сервера для проведения операций постановки ордеров производится посредством торговых запросов. Запрос представлен специальной предопределенной структурой MqlTradeRequest, которая содержит все поля, необходимые для заключения торговых сделок. Результат обработки запроса представлен структурой...
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Nuh-uh :)
OK. Enlighten us. What error in the code, or what code, can close a position in the tester at the price of another instrument. I'm really, really interested.
The code is several thousand lines. There is no point in appending it. there are no static variables. There are classes. In any case it is the tester's error.
There is your error.
In debug mode, run a check before sending the trade order. Look at the symbol and prices. And test at least in "All ticks" mode.
OK. Enlighten us. What error in the code, or what code, could close a position in the tester at the price of another instrument. I am really, really curious.
Easily. It depends directly on the slavishness of the code. I did it myself :). Poorly thought-out system of character class initialization control. And plus there are static variables.
Anyway, it's meaningless to speak further without the code written by the person you are asking about.
Easily. It's a direct correlation to the curvature of the code. I have done it myself :). Insufficiently elaborate system of character class initialization control. And moreover there are static variables.
So it's meaningless to speak further without asking you about the code.
Can you show us an example of code? How do I close a position in EURUSD at GPBUSD price?
If so, it will not be a problem for you. I would be very grateful.
Can you show me an example code? How do I close a EURUSD position at GPBUSD price?
If so, it would be no problem for you. I will be very grateful.
Forum on trading, automated trading systems & strategy testing
Bugs, bugs, questions
Vladimir Karputov, 2019.03.24 05:58
It's easy. The dependence of the code curvature. I made such mistakes myself :). Insufficiently well-thought-out system of character class initialization control. And plus static variables.
Anyway, it's meaningless to speak further without the code written by the person you are asking about.
There is no error in debugging, visualisation mode. The position is closed not by trade order, but by stop loss:
Quite possibly a logical error in the code, most likely here, I will look into it, of course, don't know how yet - no error in debug mode:
it manages to set a stop for an order at 1.60704, 3000 pips above the current price of the position.
The tester should have prohibited the stop setting in this case.
Here I am looking at the log:
the order to change the stop is sent for gpbusd, the highlighted line, but is actually executed for eurusd- next.
here's the code to set the stop
where
OrderSend( req, res )native mql function, not overloaded.
i.e. here
it says that it sets a stop for gbpusd and should be so, but in fact
OrderSend( req, res )sets it for eurusd
Here I am looking at the log:
the order to change the stop is sent for gpbusd, the highlighted line, but is actually executed for eurusd- the next one.
there are 2 mistakes.
№1. Your mistake. Somewhere in the code. You set a SL for a EURUSD position using GBPUSD price. The terminal should have nothing against it.
№2. Bug in the terminal. If this SL is triggered at a price that does not exist at the time in the EURUSD flow, using the GBPUSD price.
Here I am looking at the log:
the order to change the stop is sent for gpbusd, the highlighted line, but is actually executed for eurusd- next.
here's the code to set the stop
where
native mql function, not overloaded.
https://www.mql5.com/ru/docs/constants/structures/mqltraderequest
Apparently when sending a modification request, the position field takes precedence over the symbol. Printreq.position