Download MetaTrader 5

Getting price of open position of other symbols

To add comments, please log in or register
Rian Yeo
Rian Yeo 2014.10.13 17:21 

Hi there, 


i am trying to enter a code that would allow me to retrieve the open price of a specific symbol other than the current one being work on.


anyone know how do i do that?


 my code is something like , i tried Position Select, but on my last line i tried printing the value and it return the price of the current symbol only. 




double BUYTP,SELLTP,CurrentPrice,CurrentTP;

double RiskAmt,AccProfit,AccBalance;






Print(mysymbol,"= ",PositionGetDouble(POSITION_PRICE_OPEN)); 

Stanislav Korotky
Stanislav Korotky 2014.10.13 21:06  
You should check result code of PositionSelect. It may fail if, for example, you specified incorrect mysymbol.
Rian Yeo
Rian Yeo 2014.10.14 09:14  

Hi Marketeer, 

 mysymbol seems to be correct .


eg , EURUSD and USDJPY  ,  


these codes are in a function so i call the function with this two symbol,

 the print line prints the correct symbol and the code manage to open the chart for mysymbol in this case both EURUSD and USDJPY chart were open

print line:

  EURUSD = 1.2***

USDJPY = 1.2***

 let me do a print result of PositionSelect(mysymbol) see if it comes out the correct one 


but in any case is there a syntax or a better method where i can call PositionGetDouble(Position_price_open) to specific symbols?


Rian Yeo
Rian Yeo 2014.10.15 06:05  



To add comments, please log in or register