Dukascopy
 
 
Wiki JStore Search Login

JFOREX-1960 : Draw built-in indicators through API
 Post subject: JFOREX-1960 : Draw built-in indicators through API Post rating: 0   New post Posted: Tue 15 Sep, 2009, 10:19 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
How to draw an indicator through API-functionality:

package jforex;

import java.util.*;

import com.dukascopy.api.*;
import com.dukascopy.api.indicators.*;

public class Strategy1156 implements IStrategy {
   private IEngine engine;
   private IConsole console;
   private IHistory history;
   private IContext context;
   private IIndicators indicators;
   private IUserInterface userInterface;
   
    private IChart chart;
    private IIndicator indicator;
   
   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();
       
        chart = context.getChart(Instrument.EURUSD);

   chart.addSubIndicator(indicators.getIndicator("ALLIGATOR"));
        indicator = indicators.getIndicator("VOLUME");
        chart.addSubIndicator(1, indicator);
   }

   public void onAccount(IAccount account) throws JFException {
   }

   public void onMessage(IMessage message) throws JFException {
   }

   public void onStop() throws JFException {
       chart.removeIndicator(indicator);
   }

   public void onTick(Instrument instrument, ITick tick) throws JFException {
   }
   
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
    }
}


Attachments:
Strategy1156.java [1.31 KiB]
Downloaded 644 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: Draw built-in indicators through API Post rating: 0   New post Posted: Mon 21 Jun, 2010, 18:15 
User avatar

User rating: 5
Joined: Fri 02 Sep, 2011, 10:08
Posts: 157
Location: FranceFrance
Thanks, please how do you set and get the parameters for the indicator loaded
with getIndicator() ?

For exemple for stDev :
(Instrument instrument, Period period, OfferSide side,IIndicators.AppliedPrice appliedPrice, int timePeriod, double nbDev, int shift)

Thanks.


 
 Post subject: Re: Draw built-in indicators through API Post rating: 0   New post Posted: Mon 28 Jun, 2010, 09:00 

User rating: 0
Joined: Mon 28 Jun, 2010, 08:19
Posts: 4
nicofr0707 wrote:
Thanks, please how do you set and get the parameters for the indicator loadedwith getIndicator() ?

Good question, i would like to find that out as well.


 
 Post subject: Re: Draw built-in indicators through API Post rating: 0   New post Posted: Mon 28 Jun, 2010, 09:09 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Sorry, at the moment this functionality is not available, but we will implement it in a near future.


 
 Post subject: Re: JFOREX-1960 : Draw built-in indicators through API Post rating: 0   New post Posted: Mon 28 Jun, 2010, 11:03 

User rating: 0
Joined: Mon 28 Jun, 2010, 08:19
Posts: 4
Support wrote:
Sorry, at the moment this functionality is not available, but we will implement it in a near future.

Thanks for the info.

Also, when I add indicator with getIndicator() method (stochastic for example) - both lines are black for some reason. Do I need to set indicator colors manually?

Thanks.


 
 Post subject: Re: JFOREX-1960 : Draw built-in indicators through API Post rating: 0   New post Posted: Thu 15 Jul, 2010, 14:05 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
This is our bug. It will be fixed.


 
 Post subject: Re: JFOREX-1960 : Draw built-in indicators through API Post rating: 0   New post Posted: Sun 01 Aug, 2010, 04:51 

User rating: 0
Joined: Wed 18 May, 2011, 23:26
Posts: 40
Location: Switzerland,
Has this been fixed? If so, is there sample code available?

Thanks Duka support!


 
 Post subject: Re: JFOREX-1960 : Draw built-in indicators through API Post rating: 0   New post Posted: Sun 01 Aug, 2010, 04:58 
User avatar

User rating: 0
Joined: Thu 16 Jun, 2011, 21:37
Posts: 98
Location: SwitzerlandSwitzerland
Hi, I'd like to also second the request for being able to editing the parameter info for loaded Indicators.

Has this been added as setInputParameter(int index, Object array) for IIndicator? Could you use an example please...

thanks in any case,
jForexUser


 
 Post subject: Re: JFOREX-1960 : Draw built-in indicators through API Post rating: 0   New post Posted: Fri 15 Oct, 2010, 00:39 
User avatar

User rating: 0
Joined: Thu 16 Jun, 2011, 21:37
Posts: 98
Location: SwitzerlandSwitzerland
I just noticed that this has been updated. thanks for doing this :)

edit://just realized that on the API documentation site this has been marked although the API I have downloaded does not have this. Any idea when this API will be released?

Using JForex-API 2.6.17 and jForex 2.5.1

Thanks!


 

Jump to:  

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