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.

Backtest statistics
 Post subject: Backtest statistics Post rating: 0   New post Posted: Wed 28 Mar, 2012, 00:46 
User avatar

User rating: 11
Joined: Tue 27 Mar, 2012, 17:47
Posts: 111
Location: GermanyGermany
Hi Support,

sorry for the dumb question, I'm quite new to JForex.
When backtesting a strategy in JForex client, a report is generated as a .html file.
I cannot find the basic statstics of this backtest, for example ProfitFactor, Number of Winning Trades etc.
Where do I have to look?
In case those statistics are not available, how can I compute them on my own after the test?
Could you give me as an example the calculation of the total number of trades after the test?

Thank you very much in advance and best regards,
Juergen


 
 Post subject: Re: Backtest statistics Post rating: 0   New post Posted: Wed 28 Mar, 2012, 08:16 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Consider calculating the data in the onStop method of the strategy.
Get historical orders in the following way:
https://www.dukascopy.com/wiki/#Order_history
Get losing/winning trades in the following way (mind to change engine.getOrders() which gets all active orders to previousOrders from the previous example, which holds the historical orders):
https://www.dukascopy.com/wiki/#Order_Ma ... ing_orders


 
 Post subject: Re: Backtest statistics Post rating: 0   New post Posted: Wed 28 Mar, 2012, 09:02 
User avatar

User rating: 11
Joined: Tue 27 Mar, 2012, 17:47
Posts: 111
Location: GermanyGermany
For the getOrdersHistory method, where can I get the two dates parameters from and to?


 
 Post subject: Re: Backtest statistics Post rating: 0   New post Posted: Wed 28 Mar, 2012, 11:18 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
  1. Define two fields (between the class definition and onStart):
    long startTime;
    long endTime;
  2. in onStart set the startTime:
    startTime = history.getLastTick(Instrument.EURUSD);
  3. in onStop set the endTime:
    endTime = history.getLastTick(Instrument.EURUSD);
  4. then use the two as from and to parameters.


 
 Post subject: Re: Backtest statistics Post rating: 0   New post Posted: Wed 28 Mar, 2012, 11:37 
User avatar

User rating: 11
Joined: Tue 27 Mar, 2012, 17:47
Posts: 111
Location: GermanyGermany
Ok thank you, this makes sense.
I was just curious about the custom period option in the historical tester and if those two dates could be obtained via class attributes somehow.


 
 Post subject: Re: Backtest statistics Post rating: 0   New post Posted: Wed 28 Mar, 2012, 11:44 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
FXjuxe wrote:
I was just curious about the custom period option in the historical tester and if those two dates could be obtained via class attributes somehow.
JForex API does not have access to data of Historical Tester application. If you are back-testing in Standalone JForex-API, then you can pass these settings from the back-testing program to the strategy. Consider making the both time fields public and then assigning them the values of dateFrom.getTime() and dateTo.getTime() of the following example:
https://www.dukascopy.com/wiki/index.php#Standalone_JForex_API/Testing_over_a_particular_historical_time_interval


 

Jump to:  

  © 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