I do not have the current prices, but the previous tick prices

 

Hi,

I use the OnTick event to manage the position. When I want to have the current Profit requesting the position with PositionGetDouble(POSITION_PROFIT), I have only the previous tick Profit.

How can I have the very current datas using OnTick, or another event...

Christian

 
c2h:

Hi,

I use the OnTick event to manage the position. When I want to have the current Profit requesting the position with PositionGetDouble(POSITION_PROFIT), I have only the previous tick Profit.

How can I have the very current datas using OnTick, or another event...

Christian

I'm very curious, how do you know that profit value from PositionGetDouble(POSITION_PROFIT) was based on previous tick ?
 

Quite easy :

 

Look at the order console : the profit is always ahead of the datas from PositionGetDouble(POSITION_PROFIT).

 

Christian 

 
c2h:

Quite easy :

 

Look at the order console : the profit is always ahead of the datas from PositionGetDouble(POSITION_PROFIT).

 

Christian 

I'm using MetaQuotes Server, and no, the profit from toolbox's trade tab is the same one every tick with PositionGetDouble (POSITION_PROFIT).
 

Does that mean that if I use another server (from my broker in my case), the prices are not "true" ?

 
c2h:

Does that mean that if I use another server (from my broker in my case), the prices are not "true" ?

Nope, I also test that with Alpari UK, Mig Bank, and GoMarket MT5.
 

Thanks.

 

Would you have a hint for me to go ahead to solve this problem ?

 

Christian

 

 
c2h:

Thanks.

 

Would you have a hint for me to go ahead to solve this problem ?

 

Christian

 

I thought there's no problem, so I'm not so sure how did you came to this idea that the PositionGetDouble(POSITION_PROFIT) is late. I just simply run that function in EA and see its value on chart comment, and the value is updated at the same tick. 
 

SOLVED :

Need to refresh the graph to have very last datas shown. 

 
c2h:

SOLVED :

Need to refresh the graph to have very last datas shown. 

Maybe you need RefreshRates, which actually using SymbolInfoTick()