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.

Strategy Testing Speed
 Post subject: Strategy Testing Speed Post rating: 0   New post Posted: Fri 23 Aug, 2019, 18:10 
User avatar

User rating: 13
Joined: Mon 27 Jul, 2015, 16:30
Posts: 101
Location: Canada, Mission
Once a strategy test passed sluggish for the set interval (15 years in max interval for EUR/USD) then becomes faster next time for the same currency pair and same interval.

It is faster then for other strategies using the same currency pair and the same interval.

The Proof:
I did this test on two computers with the same configuration and the one used before to run strategies is faster than the other one who just started running strategies.
Then I did a HDD clone from the comp who run faster to the other one and booth computers run faster (same fast speed) for the same tests.


Conclusions:
1. trading history is written somewhere in the computer - not in windows temporal files folder
OK - thank you ! "On windows cached tick data is stored here C:\Users\<UserName>\AppData\Local\JForex\.cache."

2. those hidden files improve next test on same or other strategies for the same period and currency pair used
Yes - they contain history tick data
3. probably if we can locate this hidden files we might copy them on other computers to make the test faster ....
Yes confirmed - works faster - files located OK - "On windows cached tick data is stored here C:\Users\<UserName>\AppData\Local\JForex\.cache." can be copied on other computers to make them work faster - by eliminating tick data downloads time from servers.

4. after those hidden files are in your computer, then the computer performance has its say - the faster computers will perform faster
Yes - statement confirmed.

....more to come if discovered....


 
 Post subject: Re: Strategy Testing Speed Post rating: 0   New post Posted: Fri 23 Aug, 2019, 18:12 
User avatar

User rating: 13
Joined: Mon 27 Jul, 2015, 16:30
Posts: 101
Location: Canada, Mission
mtnfx wrote:
Unfortunately, "performance of back testing" and "reporting" are not of high-priority for Dukas's developers, for years :( ... I'm pretty much sure this highly wanted feature by many users, but instead effort is spent onto adding new fancy (not sure about useful) things ... and I also pretty much sure back-testing may run at least 10 times quicker if Jforex developers would address that thing appropriately.

Ok, back to question (actually - it is better to move onto other thread for this):

1. Xeon CPUs are better used in highly-threaded applications. JForex runs user strategy in the single thread - so ... you'll get better performance with CPU having more "Instructions Per Second" what nowadays same as "having higher clock rate - Ghz". If you would want to solve that issue from hardware perspective - refer to this link (sorted down by SuperPI 32M, which is a "simple single thread test")

(... next things depend on how much you are away from programming ... )

2. I recommend running empty strategy on 1 year interval (1 month / 1 week) - this will give you baseline and let you known how much time on top of JForex is added by you strategy. Then - you may enabled/disable some lines in you strategy to understand what is consuming most of the time.

3. I'm pretty much sure processing all the ticks is not really needed. I would recommend in your strategy skipping ticks coming more frequently than "once per N seconds" and having no significant price change - i think this may speed up testing by 2-3-5 times. Note: at some hot periods tick-rate may rich N*10/sec.

4. Reporting ... the one provided by JForex is [email protected][email protected]@#. I would recommend listening to notification messages provided by JForex and writing results to a CSV files - this way you'll be able to open that file in Excel while strategy is still in progress and build graphs, data filtering or whatever else you may need.


 
 Post subject: Re: Strategy Testing Speed Post rating: 0   New post Posted: Fri 23 Aug, 2019, 18:13 
User avatar

User rating: 13
Joined: Mon 27 Jul, 2015, 16:30
Posts: 101
Location: Canada, Mission
It is clear to me now that the speed is not given by a high end computer but by the speed feed form dealer servers.


 
 Post subject: Re: Strategy Testing Speed Post rating: 0   New post Posted: Fri 23 Aug, 2019, 18:14 
User avatar

User rating: 13
Joined: Mon 27 Jul, 2015, 16:30
Posts: 101
Location: Canada, Mission
NightOwl wrote:
Hello!


Yeah the speed is dependant on the networks speed to the servers. There are for example some VPS that have 1ms latency to dukascopy server, but this does not mean that the data will spaw between the servers at that speed as the protocols and scripts that orchestrate the whole datafeed transfer affects the speed that data can be downloaded.

Nice thread!
This is cool concept, when you have enough of these with 10 year proofs, you can start e hedge fund where you allocate money on these different strategies. WOW! It is like not only investing in one strategy but, we say 30, and if one 5 fails, the others are safe. This is really nice idea man, lol.

EDIT: depentant on other factors also.

EDIT2: I would point out that dukascopy demo has some odd anomalities, sometimes the price jumps really really odd to your take profit, like dirty odd. I have seen it twice.


 
 Post subject: Re: Strategy Testing Speed Post rating: 0   New post Posted: Fri 23 Aug, 2019, 18:29 
User avatar

User rating: 13
Joined: Mon 27 Jul, 2015, 16:30
Posts: 101
Location: Canada, Mission
BE PATIENT

Use a computer just for this purpose with minimal software installation

Set up the computer to never sleep - HDD and processor

Continuous uninterrupted fast internet connection _ LAN in better

Test on Demo accounts - looks faster - and no worries

First run Empty Strategy just once, for each trading instrument and time period, to load the cached tick data stored in C:\Users\<UserName>\AppData\Local\JForex\.cache.

Reduce continuous tick feed if not necessary from Processing All Ticks to lower options - be careful here - my tests gave me different results from reducing from continuous data feed to other intervals - and I have no idea how to adapt this reduced feed intervals in real time strategy trading. For this reason continuous data feed - process all ticks - remains the standard reference for testing in my views.


After platform crushing or freezing restart the platform - if still sluggish restart computer.

Do not delete the platform cache files C:\Users\<UserName>\AppData\Local\JForex\.cache - they contain history data

Restart testing !

P.S. From my point of view I think the strategies are crushing when they are restarting the servers at rollover time each day and on Fridays at close and Sundays on open.

When you notice that the strategy barely moves, and it used to work faster before, that means the server is overloaded and there is no point to continue in this conditions. Stop and Restart.

Run strategy when Europe People are sleeping start past midnight and when you walk up in the morning look for results!

Good Luck !


Attachments:
Subscribe_to_realtime_tick_data.java [2.76 KiB]
Downloaded 8 times
EmptyStrategy_instrument_getTick_Data.java [1.59 KiB]
Downloaded 5 times
EmptyStrategy.java [1.2 KiB]
Downloaded 5 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Strategy Testing Speed Post rating: 1   New post Posted: Fri 23 Aug, 2019, 21:35 

User rating: 13
Joined: Thu 20 Apr, 2017, 22:42
Posts: 144
Location: Russian Federation,
JP7 wrote:
Conclusions:
1. trading history is written somewhere in the computer - not in windows temporal files folder

It took quite a while for you to know that :)

On windows cached tick data is stored here C:\Users\<UserName>\AppData\Local\JForex\.cache.
Once strategy has fetched some portion - it stays there forever (as far as i see it).
Yes - first run depends on speed of internet (plus throughput of Dukas's) servers. Next runs - solely depends on performance of your computer and complexity of the strategy.


 
 Post subject: Re: Strategy Testing Speed Post rating: 1   New post Posted: Fri 23 Aug, 2019, 21:59 

User rating: 13
Joined: Thu 20 Apr, 2017, 22:42
Posts: 144
Location: Russian Federation,
BTW - it seems like Dukascopy developers enhanced something in terms of backtesting performance.
I vaguely remember 1 year ago it took around 5 minutes to play 1 year of "Empty" strategy (EUR/USD) - on pre-cached data.
Now it takes around 1:20 minutes (i5-9600K). Roughly - 4 times quicker. Good improvement ... though I still expect it should take less than 20-30 seconds for that dumb thing - so there is still plenty space for improvement :).


 
 Post subject: Re: Strategy Testing Speed Post rating: 0   New post Posted: Sat 24 Aug, 2019, 03:26 
User avatar

User rating: 13
Joined: Mon 27 Jul, 2015, 16:30
Posts: 101
Location: Canada, Mission
OK - thank you ! "On windows cached tick data is stored here C:\Users\<UserName>\AppData\Local\JForex\.cache."


Now the next test is to copy cash files from the old computer to a cleaned one to see if works and if it is faster.

My Cache is 80 GB
Test confirmed - coping the cache from the old computer to the new one works and computer run faster and uses tick data I have copied from the old computer

Image


Attachments:
Cache and JForex.PNG [41.3 KiB]
Downloaded 81 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Strategy Testing Speed Post rating: 1   New post Posted: Sat 31 Aug, 2019, 16:57 

User rating: 1
Joined: Fri 06 Apr, 2018, 17:06
Posts: 18
Location: Poland,
JP7 wrote:
Once a strategy test passed sluggish for the set interval (15 years in max interval for EUR/USD) then becomes faster next time for the same currency pair and same interval. I did this test on two computers with the same configuration and the one used before to run strategies is faster than the other one who just started running strategies.
Then I did a HDD clone from the comp who run faster to the other one and booth computers run faster (same fast speed) for the same tests.

You tracked how many process was running on this machine. Maybe operating system (which means CPU and scheduler / context of tasks) skip to time frame in other moment because on this 2 computers probably works different task / different programs at the same time. And frame for execute java is different for each one.
Maybe check stuff like this and track performance. You slow down program creating very long loop 10 x 1.000.000.000
Of course try this one in historical tester...
package jforex;

import java.util.*;

import com.dukascopy.api.*;

public class Strategy_31082019_BenchmarkTest_SpeedTest implements IStrategy {
    private IEngine engine;
    private IConsole console;
    private IHistory history;
    private IContext context;
    private IIndicators indicators;
    private IUserInterface userInterface;
   
    private long start = 0;
    private int counter = 0;
   
    private long average_time = 0;
    private long average_time_cycle_counter = 0;
   
    public void onStart(IContext context) throws JFException {
        this.engine = context.getEngine();
        this.console = context.getConsole();
        this.history = context.getHistory();
        this.context = context;
        this.indicators = context.getIndicators();
        this.userInterface = context.getUserInterface();
    }

    public void onAccount(IAccount account) throws JFException {
    }

    public void onMessage(IMessage message) throws JFException {
    }

    public void onStop() throws JFException {
        console.getWarn().println(" average time = " + (average_time / average_time_cycle_counter) );
    }

    public void onTick(Instrument instrument, ITick tick) throws JFException {
    }   
   
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
       
        if (period.equals(Period.FIFTEEN_MINS)) {
            start = System.currentTimeMillis();
            for (int x = 0; x < 10; x ++) {
                for (int i = 0; i < 1000000000; i++) {
                    counter ++;
                }
                counter = 0;
            }
            long now = System.currentTimeMillis();
            long delta = now - start;
            average_time_cycle_counter ++;
            average_time = (average_time + delta);
            console.getOut().println(bidBar + " --> " + delta + " --average time update: " + average_time + " | " + average_time_cycle_counter);
        }
       
    }
}

I have Intel i3, 6GB RAM and my average time is something like 852 for this loop settings loop 10 x 1.000.000.000
for loop 1 x 1.000.000.000 something between 66-90
Without visual mode*
Linux Ubuntu 14.04 LTS.

And then open web browser like firefox, opera sth like that and few tabs on Youtube ;p and check this out... what performance is now. Probably cpu work harder and this means this strategy slow down. And do few tests with this.. You will see different value of "average_time" .

btw. this is a deep topic for analysis... there are many variables, many ways, many things that affect performance, but my knowledge about this is very... poor :x


 
 Post subject: Re: Strategy Testing Speed Post rating: 0   New post Posted: Thu 05 Sep, 2019, 19:02 
User avatar

User rating: 13
Joined: Mon 27 Jul, 2015, 16:30
Posts: 101
Location: Canada, Mission
My cache is now 120 GB and there is no room to the laptop HDD so I am moving it to an external HDD and change the cache path in the platform: Settings - Preference - Advanced - Paths

I intend to keep the cache on an external HDD and move it from a computer to another ! As external HDD will accumulate cache data and as "growing larger" will not interfere with the internal operation system hard drive.

Data cache for each instrument for the max period available and processing all ticks is huge: examples EURGBP 5.39 GB,
EURJPY = 7.94 GB, EURCAD = 6.33 GB, EURAUD 6.79 GB and so on.

Image
Image


Attachments:
EURAUD.PNG [55.35 KiB]
Downloaded 26 times
paths.PNG [161.98 KiB]
Downloaded 28 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Strategy Testing Speed Post rating: 0   New post Posted: Fri 06 Sep, 2019, 18:14 
User avatar

User rating: 13
Joined: Mon 27 Jul, 2015, 16:30
Posts: 101
Location: Canada, Mission
Test Confirmed - platform uses now data cache from the external HDD

Image


Attachments:
external hdd cache.PNG [154.76 KiB]
Downloaded 19 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 

Jump to:  

  © 1998-2011 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