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.

Caching and min/max indicators?
 Post subject: Caching and min/max indicators? Post rating: 0   New post Posted: Tue 29 Sep, 2009, 23:01 

User rating: 0
Joined: Thu 27 Aug, 2009, 12:09
Posts: 23
Can someone please tell me if the min and max indicators work ok and what they do exactly as I'm having a problem with them?

For instance is there an issue using them as soon as your strategy starts?

I'm not too sure how the caching works with indicators. Is there any previous bar data available as soon as your strategy starts assuming chart data has been loaded already?

Sorry if this is a dumb question!

Thanks


 
 Post subject: Re: Caching and min/max indicators? Post rating: 0   New post Posted: Thu 01 Oct, 2009, 12:40 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
All indicators could be used only for candles.
min/max indicators calculates lowest/highest price for defined number of candles.
For example min indicator, as we see from documentation (https://www.dukascopy.com/swiss/docs/api/com/dukascopy/api/IIndicators.html#min(com.dukascopy.api.Instrument,%20com.dukascopy.api.Period,%20com.dukascopy.api.OfferSide,%20com.dukascopy.api.IIndicators.AppliedPrice,%20int,%20int)),
could be used in three different ways. But for all these functions is common several parameters:
  • Instrument instrument - define for which instrument(currency's pair) indicator should calculate value;
  • Period period - define which candles should bee used (don't use Period.TICK - it's not a candle);
  • OfferSide side - define which offer side bid or ask;
  • IIndicators.AppliedPrice appliedPrice - define which of four main candle prices(OHLC) should be used for calculations;
  • int timePeriod; - define amount of candles that should be used for calculations

    As well there is
  • int shift - define number of candle back in time staring from current bar.
      0 - current bar (currently generated from ticks),
      1 - previous bar (last formed bar),
      2 - current bar minus 2 bars and so on

  • long from, long to - interval where "from" is the start time of first tick/bar in range and "to" is the time of the last bar in range

  • Filter filter, int numberOfCandlesBefore, long time, int numberOfCandlesAfter - method with those parameters allow to filter flat bars

For example:
double minBid = indicators.min(Instrument.EURUSD, Period.TEN_SECS, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, 5, 2);

Previous example will calculate minimum of bid price in EURUSD instrument last 5 ten second candles starting from (current bar minus 2 bars) bar.

Quote:
For instance is there an issue using them as soon as your strategy starts?
At the moment as far as we know there is'nt any issues with min and max indicators.

Quote:
I'm not too sure how the caching works with indicators. Is there any previous bar data available as soon as your strategy starts assuming chart data has been loaded already?

Yes, if data is loaded, its accessible.


 
 Post subject: Re: Caching and min/max indicators? Post rating: 0   New post Posted: Thu 01 Oct, 2009, 19:38 

User rating: 0
Joined: Thu 27 Aug, 2009, 12:09
Posts: 23
Thanks for the extensive answer. Very helpful :)


 
 Post subject: Re: Caching and min/max indicators? Post rating: 0   New post Posted: Thu 26 Nov, 2009, 19:24 

User rating: 0
Joined: Sat 07 Nov, 2009, 00:25
Posts: 11
Can I have a bit of clarity for the last question:
Support wrote:
sparkz wrote:
I'm not too sure how the caching works with indicators. Is there any previous bar data available as soon as your strategy starts assuming chart data has been loaded already?

Yes, if data is loaded, its accessible.

If I only loaded a weeks worth of data and have an indicator with a two-day lookback, will the engine load an extra two days to allow the indicator to work strsight away (from the first tick)?

Thanks.


 
 Post subject: Re: Caching and min/max indicators? Post rating: 0   New post Posted: Mon 30 Nov, 2009, 09:41 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
if you have a lookback == 2 and indicator is calculated on daily candles, then it will load 2 more candles (2 daily candles)
if the same indicator is calculated on 1min candles then it will load 2 more candles, but in this case it will be 2 minutes (2 1min candles)
It doesn't matter what data you loaded before. All the needed data will be loaded on request if it's not in cache already


 

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