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.

Indicators - usage with context.getHistory() derived prices
 Post subject: Indicators - usage with context.getHistory() derived prices Post rating: 0   New post Posted: Sat 01 Jan, 2011, 11:40 

User rating: 0
Joined: Sat 01 Jan, 2011, 11:29
Posts: 6
I am trying to back-test one of my strategies using Eclipse and the various jars, etc. All builds and works so far, but I have a question on how I should use Indicators, if running using prices derived from the getHistory() call.

At the moment, I have added a section to the onStart() method to build price bar lists on history.getBars(). However, as much as I can call my strategies main entry-point onBar(), passing in the historic values, I have a number of methods that subsequently use technical indicators as part of the Indicators class - these seem to only be based on 'real-time' date and certain offsets from that point?

How can I use the Indicators with historic data? For example if I wanted a simple moving average (sma) of 50 bars from a date/time 4 month ago, not 50 bars from the actual system/real date.

Thanks,


 
 Post subject: Re: Indicators - usage with context.getHistory() derived pri Post rating: 0   New post Posted: Tue 04 Jan, 2011, 11:28 

User rating: 0
Joined: Sat 01 Jan, 2011, 11:29
Posts: 6
bump


 
 Post subject: Re: Indicators - usage with context.getHistory() derived pri Post rating: 0   New post Posted: Mon 14 Feb, 2011, 09:09 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
Use History.getBars(..) to fetch the bar or bars you need from history and then IBar.getTime() when calling the indicator.
Have a look at the examples: https://www.dukascopy.com/wiki/index.php ... Indicators


 

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