Download MetaTrader 5

What mean open_pricc on trade.Buy(volume,symbol,open_price,SL,TP,comment)

To add comments, please log in or register
robaczek122
10
robaczek122  

Hi,

when I test EA strategy and put (for example random) open_price=9.999 program still open position. Why?

Rodrigo Malacarne
Moderator
10108
Rodrigo Malacarne  
robaczek122:

Hi,

when I test EA strategy and put (for example random) open_price=9.999 program still open position. Why?

Hello ,

Please take a look at the CTrade standard library documentation. When using the CTrade standard library, the Buy() function is used for opening positions "at market", i.e. using the available ask price.

So, even if you use 0 (instead of 9.999) it will still open positions using the ask price.

Regards,
Malacarne 

Alain Verleyen
Moderator
32063
Alain Verleyen  
robaczek122:

Hi,

when I test EA strategy and put (for example random) open_price=9.999 program still open position. Why?

It depends of the execution type for the symbol you are using, in general this is fixed by your broker for a given account.

For Instant and Request execution, you need to provide a price. For Exchange and Market execution, the market price is taken into account as explained by Rodrigo Malacarne (and the price you specified doesn't matter).

To add comments, please log in or register