Getting price of open position of other symbols

 

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. 

 

 

PositionSelect(mysymbol);

double BUYTP,SELLTP,CurrentPrice,CurrentTP;

double RiskAmt,AccProfit,AccBalance;

BUYTP=PositionGetDouble(POSITION_PRICE_OPEN)+(TPDistance*_Point);

SELLTP=PositionGetDouble(POSITION_PRICE_OPEN)-(TPDistance*_Point);

RiskAmt=AccountInfoDouble(ACCOUNT_BALANCE)*Risk*-1;

AccProfit=AccountInfoDouble(ACCOUNT_PROFIT);

AccBalance=AccountInfoDouble(ACCOUNT_BALANCE);


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

 
You should check result code of PositionSelect. It may fail if, for example, you specified incorrect mysymbol.
 

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?

 regards 

 

Solved. 

Thanks  

 
What is the solution Rian Yeo ???
 
Rian Yeo: Solved. 

Don't do that. Someone searching might find this thread and still be clueless. What solved what?

How To Ask Questions The Smart Way. 2004
     When You Ask.
          Follow up with a brief note on the solution.

 
Rian Yeo2014.10.15 11:05

Solved. 

Thanks  

douglas14:
What is the solution Rian Yeo ???
William Roeder:

Don't do that. Someone searching might find this thread and still be clueless. What solved what?

Rian Yeo has not been seen on the forum for nearly 6 years!

I doubt very much that there will be any reply.

Reason: