How do you calculate how many ticks of profit been made?

Created at 12 Mar 2023, 05:00
YS

ys2310

Joined 03.12.2021

How do you calculate how many ticks of profit been made?
12 Mar 2023, 05:00


position.NetProfit property gives you an amount you made.

Is there anything like position.NetProfitInTicks ? 

If not, how can I calculate my profit in ticks when a trade closes?

Thank you very much.


@ys2310
Replies

firemyst
13 Mar 2023, 07:29

Would it just be as easy as:

1) set a tickCount variable to zero (0) when your order is successful

2) while in the position, on each "OnTick" event, add 1 to your variable.

3) when the position is closed, save the tick count.

 

??


@firemyst

pick
13 Mar 2023, 12:37

There is a variable for pips. Or you could calculate it manually from "EntryPrice" and "ClosingPrice" from the HistoricalTrade interface.


@pick

ncel01
13 Mar 2023, 13:04 ( Updated at: 13 Mar 2023, 13:05 )

Hello,

Try the following:

var netProfitInTicks = position.NetProfit / (position.VolumeInUnits * Tick.Size);

 


@ncel01