PositionGetDouble(POSITION_PRICE_CURRENT) and SymbolInfoTick(targetSymbol,lastTick);

Alain Verleyen  
nicolasxu:

If I had a position on "EURUSD", there are 2 ways to get current price. 

1) PositionSelect("EURUSE")

    then call PositionGetDouble(POSITION_PRICE_CURRENT)

2)   SymbolInfoTick("EURUSD",lastTick);

 

My question is what is the difference? Which one I should use?

POSITION_PRICE_CURRENT give you directly the right price (Bid or Ask) depending if your position is BUY or SELL.
nicolasxu  
angevoyageur:
POSITION_PRICE_CURRENT give you directly the right price (Bid or Ask) depending if your position is BUY or SELL.
I see. Thank you!
Dua Yong Rew  
Alain Verleyen #:
POSITION_PRICE_CURRENT give you directly the right price (Bid or Ask) depending if your position is BUY or SELL.
Hi Alain

I tried using pricecurrent vs symbolinfotick and backtest results is different

Can kindly advise?

Laszlo Tormasi  
Dua Yong Rew #:
Hi Alain

I tried using pricecurrent vs symbolinfotick and backtest results is different

Can kindly advise?

Are you using Bid for Buy positions and Ask for Sell positions? 

Alain Verleyen  
Dua Yong Rew #:
Hi Alain

I tried using pricecurrent vs symbolinfotick and backtest results is different

Can kindly advise?

They should be the same. If you want me to check you will need to provide code and details to reproduce the issue.
Mr Anucha Maneeyotin  
nicolasxu:

If I had a position on "EURUSD", there are 2 ways to get current price. 

1) PositionSelect("EURUSE")

    then call PositionGetDouble(POSITION_PRICE_CURRENT)

2)   SymbolInfoTick("EURUSD",lastTick);

 

My question is what is the difference? Which one I should use?

Use  PositionGetDouble(POSITION_PRICE_CURRENT) is real price.

Reason: