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.

DMI Oscillator Request
 Post subject: DMI Oscillator Request Post rating: 0   New post Posted: Wed 03 Nov, 2010, 13:33 

User rating: 0
Joined: Mon 11 Oct, 2010, 13:42
Posts: 8
Hello,

I already searched the forum and found a link - however, it is broken.

Where do I get the right code for the DMI Oscillator? When activating it on the platform, there are always three values: +DI, -DI, ADX
In the library I found these 6 methods:

 double[]    adx(Instrument instrument, Period period, OfferSide side, int timePeriod, Filter filter, int numberOfCandlesBefore, long time, int numberOfCandlesAfter)
           
 double    adx(Instrument instrument, Period period, OfferSide side, int timePeriod, int shift)
          Calculates Average Directional Movement Index for bar specified with shift parameter.
 double[]    adx(Instrument instrument, Period period, OfferSide side, int timePeriod, long from, long to)
           
---------------------------------------
 double[]    dmi(Instrument instrument, Period period, OfferSide side, int timePeriod, Filter filter, int numberOfCandlesBefore, long time, int numberOfCandlesAfter)
           
 double    dmi(Instrument instrument, Period period, OfferSide side, int timePeriod, int shift)
           
 double[]    dmi(Instrument instrument, Period period, OfferSide side, int timePeriod, long from, long to)


Now, my questions are as follows:
1. If I want to implement it in the strategy as I see it visually on the platform (with +DI, -DI and ADX), do I have to use 2 methods?
2. If so, which method stands for +DI and -DI?
I'd be thankful if someone could post the right code here. I think this would be useful for future questions, also.


 
 Post subject: Re: DMI Oscillator Request Post rating: 0   New post Posted: Fri 19 Nov, 2010, 16:40 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
DMIOscillator source code is located here: viewtopic.php?f=6&t=8379
You can use the universal method calculateIndicator in order to get acces to all DMI outputs:
Object[] values =  indicators.calculateIndicator(Instrument.EURUSD, Period.ONE_HOUR, new  OfferSide[] {OfferSide.ASK}, "DMI",  
             new AppliedPrice[] {}, new Object[]{14}, shift); 
console.getOut().println("adx: " + ((Object[])values)[0] + ", +di: " +
             ((Object[])values)[1] + ", -di: " + ((Object[])values)[2]);

Also, have a look at the following JForex Wiki article: 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