Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

How to find out/specify commission on backtesting?
 Post subject: How to find out/specify commission on backtesting? Post rating: 0   New post Posted: Wed 22 Dec, 2010, 16:42 
User avatar

User rating: 0
Joined: Thu 16 Jun, 2011, 21:37
Posts: 98
Location: SwitzerlandSwitzerland
Hello all,

how do I find out what commission is being used in the backtesting and possibly specify it?

Does
getProfitLossInAccountCurrency() from the IOrder class include commission?

Any other info relating to commission regarding backtesting would be great.

Thanks,
jForexUser


 
 Post subject: Re: How to find out/specify commission on backtesting? Post rating: 0   New post Posted: Mon 27 Dec, 2010, 15:46 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
Commissions in the historical tester is used according the Dukascopy Bank commission policy https://www.dukascopy.com/swiss/english/ ... on-policy/. You can see order commission in USD in the historical tester report.

The method getProfitLossInAccountCurrency() does not include commission.


 
 Post subject: Re: How to find out/specify commission on backtesting? Post rating: 0   New post Posted: Thu 15 Dec, 2011, 13:20 

User rating: 0
Joined: Wed 18 May, 2011, 08:40
Posts: 43
Location: RU
API Support wrote:
Hi,
Commissions in the historical tester is used according the Dukascopy Bank commission policy https://www.dukascopy.com/swiss/english/ ... on-policy/. You can see order commission in USD in the historical tester report.

The method getProfitLossInAccountCurrency() does not include commission.


But this is total commission. Can you please post code which calculates net profit without commission after an order has been closed?


 
 Post subject: Re: How to find out/specify commission on backtesting? Post rating: 0   New post Posted: Thu 15 Dec, 2011, 16:54 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Quote:
The method getProfitLossInAccountCurrency() does not include commission.


 
 Post subject: Re: How to find out/specify commission on backtesting? Post rating: 0   New post Posted: Thu 15 Dec, 2011, 18:31 

User rating: 0
Joined: Wed 18 May, 2011, 08:40
Posts: 43
Location: RU
API Support wrote:
Quote:
The method getProfitLossInAccountCurrency() does not include commission.


I have used this method for creating reports for historical back tests. My strategy doesn't allow multiple opened/active orders at the same time. Thus one trade follows the other.

Trade A:
enter date: 30 January 2006 06:00:00
enter equity: 5000.0
exit date: 30 January 2006 18:37:30
net profit: 70.0

Trade B:
enter date: 30 January 2006 19:00:00
enter equity: 5069.1
exit date: 30 January 2006 23:37:30
net profit: 89.50

If the mentioned method returns real profit why then the enter equity of Trade B isn't equal to the sum of enter equity of Trade A and profit of Trade A ?


 
 Post subject: Re: How to find out/specify commission on backtesting? Post rating: 0   New post Posted: Fri 16 Dec, 2011, 08:36 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
How is the net profit computed?


 
 Post subject: Re: How to find out/specify commission on backtesting? Post rating: 0   New post Posted: Fri 16 Dec, 2011, 12:49 

User rating: 0
Joined: Wed 18 May, 2011, 08:40
Posts: 43
Location: RU
API Support wrote:
How is the net profit computed?


enter date: IOrder.getCreationTime()
enter equity: before I submit order I get current equity with IAccount.getEquity() and put it into order's comment. And after the order has been closed I parse the comment.
exit date: IOrder.getCloseTime()
net profit: IOrder.getProfitLossInAccountCurrency()


 
 Post subject: Re: How to find out/specify commission on backtesting? Post rating: 0   New post Posted: Fri 16 Dec, 2011, 13:04 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The method getProfitLossInAccountCurrency() does not include commission.


 
 Post subject: Re: How to find out/specify commission on backtesting? Post rating: 0   New post Posted: Fri 16 Dec, 2011, 15:04 

User rating: 0
Joined: Wed 18 May, 2011, 08:40
Posts: 43
Location: RU
API Support wrote:
The method getProfitLossInAccountCurrency() does not include commission.


So why is then enter equity of previous trade (5000.0) + profit of previous trade (70.0) is greater than enter equity of the next trade? (5069.1)


 
 Post subject: Re: How to find out/specify commission on backtesting? Post rating: 0   New post Posted: Mon 19 Dec, 2011, 15:26 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
enter equity of Trade B = (equity of Trade A) + (profit/loss of Trade A) - commission


 
 Post subject: Re: How to find out/specify commission on backtesting? Post rating: 0   New post Posted: Mon 19 Dec, 2011, 15:43 

User rating: 0
Joined: Wed 18 May, 2011, 08:40
Posts: 43
Location: RU
API Support wrote:
enter equity of Trade B = (equity of Trade A) + (profit/loss of Trade A) - commission


Yes. I have already figured it out.
But the original question was "Can you please post code which calculates net profit without commission after an order has been closed?"
I meant method which would return 69.1 instead of 70.


 
 Post subject: Re: How to find out/specify commission on backtesting? Post rating: 0   New post Posted: Tue 20 Dec, 2011, 08:17 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
In the next release of JForex client a new method will be available - IOrder.getCommission().


 
 Post subject: Re: How to find out/specify commission on backtesting? Post rating: 0   New post Posted: Tue 20 Dec, 2011, 13:24 

User rating: 0
Joined: Wed 18 May, 2011, 08:40
Posts: 43
Location: RU
API Support wrote:
In the next release of JForex client a new method will be available - IOrder.getCommission().


It would be great.
If your strategy doesn't allow multiple active/opened orders then you can iterate over all trades and calculate it by substracting enter equity from enter equity of the next trade.
But I don't have an idea how to "derive" profit without commission when your strategy allows multiple opened/active orders.

When this release is planned for?


 
 Post subject: Re: How to find out/specify commission on backtesting? Post rating: 0   New post Posted: Tue 20 Dec, 2011, 13:50 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please refer to Desktop Platforms > FAQ section of this forum: viewforum.php?f=81


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com