It appears that the price parameter for PositionOpen() is indeed not needed because, as you have determined, PositionOpen() only allows market orders (TRADE_ACTION_DEAL) and the documentation for MqlTradeRequest confirms:
price |
Price, reaching which the order must be executed. Market orders of symbols, whose execution type is "Market Execution" (SYMBOL_TRADE_EXECUTION_MARKET), of TRADE_ACTION_DEAL type, do not require specification of price. |
Perhaps it is there for future consideration, or was an artifact left over from changes in the code base.
It appears that the price parameter for PositionOpen() is indeed not needed because, as you have determined, PositionOpen() only allows market orders (TRADE_ACTION_DEAL) and the documentation for MqlTradeRequest confirms:
price |
Price, reaching which the order must be executed. Market orders of symbols, whose execution type is "Market Execution" (SYMBOL_TRADE_EXECUTION_MARKET), of TRADE_ACTION_DEAL type, do not require specification of price. |
Perhaps it is there for future consideration, or was an artifact left over from changes in the code base.
Thank you - exactly the information I was seeking for but couldnt find on my own. Have a nice day :)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey friends,
i am a bit in trouble with the "PositionOpen" function.
I want to use the "price" parameter in combination with the "order_type" parameter to accomplish a pending order.
So I gave "ORDER_TYPE_BUY_STOP" as order_type and expected the function to create a pending order for my specified price - which doesnt work.
So how can I use the "price" parameter correctly for pending orders? Or can the function just execute direct buy/sell orders on the current price? (if yes: why is there a "price" parameter?).
(I know the "OrderOpen" function can accomplish pending orders, but I want to avoid that one when i can use PositionOpen instead)
best regards :)
EDIT: Checked the source of "PositionOpen". Actually this function can only execute "ODER_TYPE_BUY/SELL". So i am still wondering about the 'price' parameter which is pretty useless in this case isn't it?