equity amount... opposite side to close net position vs using last traded price

Created at 16 May 2013, 04:50
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!
BA

Balena

Joined 17.12.2012

equity amount... opposite side to close net position vs using last traded price
16 May 2013, 04:50


I based my profit and loss target triggers using 

profitTarget = startingEquity + x

and

lossTarget = startingEquity - x

then I compare these with Account.Equity

ie if (Account.Equity > startingProfit + profitTarget)

 Trade.Close(position);

 

which works fine if I've only made a few trades and the spread happens to be tight at that moment...

 

my problem is this...

 

if I have a lot of trades, sometimes once I close the position based on my target, my actual equity is much lower than my target

so I assume equity calculation in cAlgo is based on last trade? is there anyway to set the backtester to calculate it based on the opposite side price

(other than tracking fills and programming the calculation within my bot?)

ie if I'm net long calculate equity on closing out at the bid or if I'm net short calculate equity based on the offer price

thanks


@Balena
Replies

cAlgo_Fanatic
16 May 2013, 16:52

The equity is calculated according to what would have been the balance if all trades were closed at that instance. If a position is long the profit will be calculated according to the bid and if a position is short according to the offer. Equity is unrealized profit and loss.


@cAlgo_Fanatic

Balena
16 May 2013, 18:31

thanks support...

but that's not what I'm seeing...

my profit target of 100 is reached (10,000 starting equity + 100) ; see equity column

but when the position is closed at 10,100...  I end up with only 10, 089

what is causing this difference from desired target to ending result?

notice all closing prices are the same...

does you equity calculation not include commissions maybe?

please see pic

 


@Balena

tradermatrix
16 May 2013, 20:44

RE:
Balena said:

thanks support...

but that's not what I'm seeing...

my profit target of 100 is reached (10,000 starting equity + 100) ; see equity column

but when the position is closed at 10,100...  I end up with only 10, 089

what is causing this difference from desired target to ending result?

notice all closing prices are the same...

does you equity calculation not include commissions maybe?

please see pic

 

hello
I have the same problem
c is the commission of the closing of the order.
because the commission is not taken into account in the equity or p & l
c is boring for algorithms to several orders.
we believe to be positive, but net of fees is going negative.
I would like équity and p & l displayed with the deduction of commissions.

 


@tradermatrix

Balena
16 May 2013, 23:05

I agree... at least give us a toggle switch to include/not include in display gui...

but... easy enough, I coded it in


@Balena

cAlgo_Development
17 May 2013, 11:46

We will consider this change, but not now. Right now client application does not have data on closing order commisions. Server just do not send it. Morover, broker can change commisions or some other settings while your trade is open.


@cAlgo_Development