Generated MQL5 codes using wrong way to get price quotes

Hi,
  
     I tried to generate some strategies with SQ4 Beta 8, and generate the MQL codes MT5. When trying to open a position, it uses the following codes to get the quote price in openPosition() function

double curPrice = price > 0 ? price : SymbolInfoDouble(correctSymbol(symbol), isLongOrder(type) ? SYMBOL_ASK : SYMBOL_BID);

     It often generates the following error message:

2018.04.15 16:09:05.588    Core 2    2015.05.15 01:00:00   failed buy stop 1.00 AUDUSD at 0.80585 [Invalid price]
2018.04.15 16:09:05.588    Core 2    2015.05.15 01:00:00   Alert: The order request could not be completed. Error no.: 4756

    and the OrderSend failed.

    I fixed this with the following change:

      MqlTick last_tick;
double curPrice = price > 0 ? price : SymbolInfoDouble(correctSymbol(symbol), isLongOrder(type) ? SYMBOL_ASK : SYMBOL_BID); // Original code
      Alert("-----SLPT: ", slPrice, ", ", ptPrice, ", Price Ori:=", curPrice);
  
     SymbolInfoTick(_Symbol,last_tick);
     curPrice = isLongOrder(type) ? last_tick.ask : last_tick.bid;  
     Alert("-----SLPT: ", slPrice, ", ", ptPrice, ", Price Updated:=", curPrice);

    The output message becomes:

2018.04.15 16:13:22.119    Core 2    2015.06.29 00:00:00   Alert: -----SLPT: 0.0, 0.0, Price Ori:=0.766433
2018.04.15 16:13:22.119    Core 2    2015.06.29 00:00:00   Alert: -----SLPT: 0.0, 0.0, Price Updated:=0.76246

     Obviously, the price is off by around 200 points if the original quotation method is used. I think it's a wrong way to get price quotes.
     Please fix this issue in next beta or release.

Thank!
Attachments
No attachments
  • Votes 0
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority High

History

I
#1

Wincent Yeh

15.04.2018 10:19

Task created

MF
#2

Mark Fric

15.04.2018 20:06

Priority changed from Normal to High

Tomas please look at it if you have an error there
TB
#3

Tomas Brynda

16.04.2018 08:11
Hi, 

thank you for your report. It will be fixed it in next release.


Have a nice day

Tomas

TB
#4

Tomas Brynda

17.04.2018 07:10

Status changed from New to Fixed


Votes: 0

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please