Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

IOhlcChartObject.setFillColor(Color color)
 Post subject: IOhlcChartObject.setFillColor(Color color) Post rating: 0   New post Posted: Thu 12 Mar, 2015, 15:52 
User avatar

User rating: 7
Joined: Tue 28 Feb, 2012, 09:45
Posts: 45
Location: JapanJapan
I think, IOhlcChartObject.setFillColor(Color color) method not working??

Sample Code:
package jforex;

import java.util.*;

import com.dukascopy.api.*;
import com.dukascopy.api.drawings.*;
import java.awt.Color;
import java.awt.Dimension;

public class fillteset implements IStrategy {
    private IEngine engine;
    private IConsole console;
    private IHistory history;
    private IContext context;
    private IIndicators indicators;
    private IUserInterface userInterface;
   
    @Configurable(value="Color")
    public Color color = Color.red;
    @Configurable(value="setFillColor()?")
    public boolean isSetFillColor = true;
   
    private IOhlcChartObject cobj;
   
    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();
       
        IChart chart = context.getLastActiveChart();
        IChartObjectFactory objf = chart.getChartObjectFactory();
        cobj = objf.createOhlcInformer();
        cobj.setFillOpacity(1f);
        cobj.setPreferredSize(new Dimension(200, 250));
        if(isSetFillColor) cobj.setFillColor(color);
        else cobj.setColor(color);
        chart.add(cobj);
    }
   
    public void onStop() throws JFException {
        context.getLastActiveChart().remove(cobj);
    }

    public void onAccount(IAccount account) throws JFException {
    }

    public void onMessage(IMessage message) throws JFException {
    }


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


Result:
Image

setFillColor(Color.red) did not working???

best regards


Attachments:
fillteset.java [1.73 KiB]
Downloaded 127 times
filltestpng.png [8.39 KiB]
Downloaded 305 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: IOhlcChartObject.setFillColor(Color color) Post rating: 1   New post Posted: Tue 17 Mar, 2015, 09:39 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
This is fixed and will be available in the next JForex API version.


 

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