CTrade class is buying with a random price. Why?

 

I coded my EA to buy this way:

  bool buyNow()
  {
    Print("*************************** PRICE: ", this.form.price);           
    return ckErro(cTrade.Buy(this.form.vol, this.form.name, this.form.price, this.form.stopLoss), "MyClass.buyNow ", this.sBoleta);
  }


But Metatrader is buying in a different price. When I open the log file, this is there:

*************************** PRICE : 109480.0
GF      0       10:37:13.229    Core 1  2021.12.14 09:46:00   exchange buy 1 WING22.8R at 1078272365 sl: 109375 (109480 / 1078272365 / 109480)

The price "109480.0" printed by "Print" function is right. But, the EA is buying with price  "1078272365".

I really I don't know what happened here. 

This is only happening in the 1st transaction. The other transactions seem to be ok.

Anyone may help me , please


Cristiano M. Magalhaes

 

Look for the problem yourself, here in these values:

this.form.vol, this.form.name, this.form.price, this.form.stopLoss
Reason: