Errors, bugs, questions - page 2410
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
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