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
Let your idle PCs do something useful. Join MQL5 Cloud Network!
robaczek122
10
robaczek122 2015.01.03 23:09 

Hi,

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

Rodrigo Malacarne
Moderator
9892
Rodrigo Malacarne 2015.01.04 13:05  
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
30721
Alain Verleyen 2015.01.04 13:52  
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