Replies

Zocchi
31 Jul 2024, 07:55 ( Updated at: 01 Aug 2024, 06:21 )

RE: OnTick() gives me penultimate profit/loss

PanagiotisCharalampous said: 

Hi there,

I assume that the process of updating the net profit succeeds the OnTick event handler.

Best regards,

Panagiotis

Can you perhaps elaborate on this a little?

On the screenshot you can see that it does not work. 

 

I tried this: (https://help.ctrader.com/ctrader-algo/references/EventArgs/TicksTickEventArgs/)

private void Ticks_Tick(TicksTickEventArgs args){

MessageBox.Show(Positions[0].NetProfit.ToString());

}

 

And this: (https://help.ctrader.com/ctrader-algo/references/EventArgs/SymbolTickEventArgs/?h=symboltickeventargs)

private void Ticks_Tick(SymbolTickEventArgs args){

MessageBox.Show(Positions[0].NetProfit.ToString());

}

 

But I always get the profit of the older price...


@Zocchi