How can I obtain the price of an open position? I'm gonna use this price to specify the StopLoss and TakeProfit.
I've traied PositionGetDouble(POSITION_PRICE_OPEN) but it's not working.
I'm using mql5
"Not working", what that means exactly ? why are you checking position type, volume or open price when Position.Select() is false ?
What I'm trying to do is after the Sell position is open m_Trade.Sell(1,my_symbol) I'm gonna set the StopLoss and TakeProfit based on the Price that I've openned. To do this I'm trying to use the code: m_Trade.PositionOpen(my_symbol,ORDER_TYPE_SELL,1,last_tick.ask,Open_Price+1,Open_Price-5). MetaTrader5 says that sl=1 and tp=-5 are invalid. It seens that Open_Price is "0".
So, how can I get obtain the price of an open position?
If position.Select() is false, that means there is no position.
Your code to set sl/tp must in the true case, not false.