even If I send a seell order, for some reason the MT5 send buy order with the same values, crazy thing :o(
2024.07.15 00:28:00.381 Trades '1471449': sell stop 1 MNQZ24 at 20818.50 (20818.50)
2024.07.15 00:28:00.406 Trades '1471449': accepted sell stop 1 MNQZ24 at 20818.50 (20818.50)
2024.07.15 00:28:00.406 Trades '1471449': order #264238885 sell stop 1 / 1 MNQZ24 at 20818.50 done in 25.210 ms
2024.07.15 00:28:00.427 Trades '1471449': failed exchange buy 1 MNQU24 at 20534.88 [Invalid price]
I found the issue, it's due to the fact that orders and position opening need to use ask and bid prices to avoid wrong prices, in my cas the opening process failed to open a position, the database was not updated and thus the position opening get stuck in wrong value
Thanks
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I've a weired behaviour in my VPS MT5 compared to my local computer
the codes is used to reopen orders that I already stored into a database, the issue that I have is the values that I use in trade.OrderOpen function is the right one buth in my VPS (where I only have my ex5 and my database) I get an incorrect instrument and buy price (the instrument from positions opening but always get a unkown price)
Here is the code
if I execute this code in my local computer I get
2024.07.14 23:19:00.319 Trades '1471576': buy stop 1 MNQZ24 at 21041.00 (21041.00)
2024.07.14 23:19:00.367 Trades '1471576': accepted buy stop 1 MNQZ24 at 21041.00 (21041.00)
2024.07.14 23:19:00.368 Trades '1471576': order #264238644 buy stop 1 / 1 MNQZ24 at 21041.00 done in 49.116 ms
the same code compiled in ex5 executed in my VPS computer I get :
2024.07.14 23:49:00.208 Trades '1471449': buy stop 1 MNQZ24 at 20874.25 (20874.25)
2024.07.14 23:49:00.233 Trades '1471449': accepted buy stop 1 MNQZ24 at 20874.25 (20874.25)
2024.07.14 23:49:00.233 Trades '1471449': order #264238745 buy stop 1 / 1 MNQZ24 at 20874.25 done in 25.090 ms
2024.07.14 23:49:00.270 Trades '1471449': failed exchange buy 1 MNQU24 at 20534.88 [Invalid price]
in the code attached I put print the values that I pass to the OrderOpen function to be suure and here is the print
2024.07.14 23:49:00.208 rollover (MNQU24,M1) symbol:MNQZ24
2024.07.14 23:49:00.208 rollover (MNQU24,M1) reopenPrice:20874.25
2024.07.14 23:49:00.208 rollover (MNQU24,M1) reopenSL:0.00
2024.07.14 23:49:00.208 rollover (MNQU24,M1) reopenTP:0.00
so completely different from what the function sends into market
I suspect that OrderOpen send something from a cash or an old transaction? Did I forget to clear something before sending the order open?
Any idea ?