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.

Edit indicators
 Post subject: Edit indicators Post rating: 0   New post Posted: Tue 12 Jul, 2011, 11:25 

User rating: 0
Joined: Wed 01 Jun, 2011, 09:57
Posts: 5
Location: Poland,
Hello ,
What code describes : Width , Transparency , Value ??


 
 Post subject: Re: Edit indicators Post rating: 0   New post Posted: Tue 12 Jul, 2011, 12:11 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See:
https://www.dukascopy.com/wiki/index.php ... s_on_chart
Consider the following example of formatting and output value options for MAX indicator:
package jforex.strategies.indicators;

import java.awt.Color;

import com.dukascopy.api.*;
import com.dukascopy.api.indicators.IIndicator;
import com.dukascopy.api.indicators.OutputParameterInfo.DrawingStyle;

public class AddIndicatorToChart3 implements IStrategy {
   private IIndicators indicators;
   private IChart chart;

   public void onStart(IContext context) throws JFException {
      this.indicators = context.getIndicators();
      this.chart = context.getChart(Instrument.EURUSD);
      
      //MAX with default input AND default formatting AND custom output
      IIndicator max = indicators.getIndicator("MAX");
      for (int i = 0; i < max.getIndicatorInfo().getNumberOfOutputs(); i++) {
         max.getOutputParameterInfo(i).setShowValueOnChart(false); //don't show value on chart
      }        
      chart.addIndicator(max);
      
      //MAX with customized input AND default formatting
      chart.addIndicator(indicators.getIndicator("MAX"), new Object[]{10});
      //MAX with customized input AND customized formatting
      chart.addIndicator(indicators.getIndicator("MAX"), new Object[]{10}, new Color[]{Color.ORANGE},
        new DrawingStyle[]{DrawingStyle.DASHDOT_LINE}, new int[]{5});
   }

   public void onAccount(IAccount account) throws JFException {   }
   public void onMessage(IMessage message) throws JFException {   }
   public void onStop() throws JFException {   }
   public void onTick(Instrument instrument, ITick tick) throws JFException {   }
   public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {   }
}


 

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