realtime profit (gross) calculation on open positions

Created at 04 Jul 2019, 13:05
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
AB

abierbrauer

Joined 29.01.2019

realtime profit (gross) calculation on open positions
04 Jul 2019, 13:05


Hello there,

 

I'm currently stuck in a simple problem but I can't get it my head solved. I want to calculate the real time gross profit on an open position.

 

Account currency is EUR. The position I want to check is for example USDCHF.

 

Step 1)

Calculating the current profit

profit = (CurrentMarket - OpenPrice) * volumeOfPosition;

Step 2)
Converting it to EUR

EURUSD_bidprice = getting realtime price of EURUSD

realtime_gross = profit * EURUSD_bidprice

 

I know it's simple but I don't get it at present. Is there any extra convertion which cTrader does internally ?


@abierbrauer
Replies

PanagiotisCharalampous
04 Jul 2019, 14:14

Hi abierbrauer,

If you want to convert the profit from USD to EUR then you need to divide by EURUSD Bid, not multiply.

Best Regards,

Panagiotis


@PanagiotisCharalampous

abierbrauer
04 Jul 2019, 14:44

Hi again,

 

yeah you're right and I had it this way. Corrected it again and run into the same problem in another currency.

 

GBPAUD to EURUSD

 

I was thinking I simply had to use EURGBP to do the translation, but no AUDUSD is used to convert it to USD. That's my problem! I need to use ProtoOASymbolsForConversionReq to receive the complete convertion chain.

But thanks so far! At least, I'm not stuck anymore and can continue ;)


@abierbrauer

abierbrauer
04 Jul 2019, 15:47

Hello again ;)

 

So, I've fetched the convertion chain via the open api.

But is it really true, that if you want to convert GBPUSD to EURUSD you will have to use AUDCAD in the convertion chain ?

 

Regards, Alex


@abierbrauer

PanagiotisCharalampous
04 Jul 2019, 16:01

Hi Alex,

You need ot use all the symbols fethced by the conversion chain. 

Best Regards,

Panagiotis


@PanagiotisCharalampous