Download MetaTrader 5
To add comments, please log in or register
Do you keep a blog? Place a link to MQL5.community there and make money!
Christian
91
Christian 2012.11.23 12:04 

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

phi nuts
2184
phi nuts 2012.11.24 01:21  
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 ?
Christian
91
Christian 2012.11.24 17:11  

Quite easy :

 

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

 

Christian 

phi nuts
2184
phi nuts 2012.11.28 02:03  
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).
Christian
91
Christian 2012.11.28 19:43  

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

phi nuts
2184
phi nuts 2012.11.29 09:04  
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.
Christian
91
Christian 2012.11.29 19:50  

Thanks.

 

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

 

Christian

 

phi nuts
2184
phi nuts 2012.11.30 07:15  
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. 
Christian
91
Christian 2013.01.05 20:50  

SOLVED :

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

phi nuts
2184
phi nuts 2013.01.06 06:14  
c2h:

SOLVED :

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

Maybe you need RefreshRates, which actually using SymbolInfoTick()
/
To add comments, please log in or register