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.

Bollinger band calcs super slow in historical tester
 Post subject: Bollinger band calcs super slow in historical tester Post rating: 0   New post Posted: Tue 30 Dec, 2014, 16:26 

User rating: 0
Joined: Thu 23 Jun, 2011, 07:26
Posts: 18
Location: United KingdomUnited Kingdom
Hi,
I'm implementing a strategy where I need to calculate Bollinger band values at a faster rate than the candle time frame the strategy is running at.

For example: 15 minute time frame for EUR/USD, and calculating bollinger band values on the 1 minute candle using this version of the indicator:
double[][] bbands(Instrument instrument,
Period period,
OfferSide side,
IIndicators.AppliedPrice appliedPrice,
int timePeriod,
double nbDevUp,
double nbDevDn,
IIndicators.MaType maType,
Filter filter,
int numberOfCandlesBefore,
long time,
int numberOfCandlesAfter)
throws JFException

with these parameters:
bbands(EURUSD, 15Mins, Bid, ClosePrice, 593, 1.6, 1.6, EMA, Filter.Weekends, 1, bar.getTime(), 0);
So calculating the BBand values on the 15 minute time frame using 1 candle before and 0 candles after every minute.

This is typically taking 50 milliseconds to calculate. When you calculate 15 times per 15 minute candle, this works out at 0.75 seconds. Very quickly, this slows the historical back testing down to a crawl. For some testing, I need to run at 20 second candle, which means for every 15 minute candle, there is a delay of 2.25seconds of BB Calcs / 15 minute candle. It doesn't become feasible to run this strategy on the historical back tester over long time periods at this rate.

So, my question is, why is this Bollinger Band calculation taking 50 milliseconds each time? Surely with the historical test data local on my PC this should fly?


 
 Post subject: Re: Bollinger band calcs super slow in historical tester Post rating: 0   New post Posted: Fri 09 Jan, 2015, 10:12 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We will investigate that.


 
 Post subject: Re: Bollinger band calcs super slow in historical tester Post rating: 0   New post Posted: Sun 18 Jan, 2015, 12:25 

User rating: 0
Joined: Thu 23 Jun, 2011, 07:26
Posts: 18
Location: United KingdomUnited Kingdom
Thanks. Any idea when you might be able to come back with an idea of the problem?

In the meantime, we're going to cache the BBand calcs in a local file to speed up historical testing. That way, if we ever hit the same currency, same period and same BBand parameters from a previous run, we'll have a pre-existing file of cached values we can use for the calcs.


 

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