Why when I'm going to place an order I have to specify the price?

 

Hello folks, I would like to know why when I'm going to place an order I have to specify the price?

I have noticed that I have to specify the price for the two ways I know I can place an order:

"CTrade.PositionOpen(...)" and "OrderSend(request, ...);" where request contains the bid/ask price depending on if it is a buy or sell operation.


Thanks in advance, Cyberglassed.

 
Because buy and sell dont use the same price when opening due to the spread so that either way its the broker that eats the spread.
 
cyberglassed:

Hello folks, I would like to know why when I'm going to place an order I have to specify the price?

I have noticed that I have to specify the price for the two ways I know I can place an order:

"CTrade.PositionOpen(...)" and "OrderSend(request, ...);" where request contains the bid/ask price depending on if it is a buy or sell operation.

Where you specify the price you also specify deviation (slippage),  the price is the price you would like to buy/sell at if that price cannot be met then you allow an amount of latitude, deviation.  You can't specify a deviation without also specifying a price.  If you don't want to specify a price then you need to be able to use Market or Exchange execution,  but they may not be available for the symbol you want to trade from the Broker you are using . . .  it is possible to check . . .

It depends on the symbol execution type  ( ENUM_SYMBOL_TRADE_EXECUTION ) if it's Market or Exchange execution then you don't send the open price,  if it's Request or Instant execution then you need to send the open price.

There is a little more info in this thread:  https://www.mql5.com/en/forum/11303  

stop losses not showing up in backtest
stop losses not showing up in backtest
  • www.mql5.com
stop losses not showing up in backtest.
 
Thank you very much RaptorUK.
Reason: