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.

IChartObject.setVisibleInWorkspaceTree method problem
 Post subject: IChartObject.setVisibleInWorkspaceTree method problem Post rating: 0   New post Posted: Tue 07 May, 2013, 16:03 

User rating: 3
Joined: Thu 28 Jul, 2011, 19:40
Posts: 72
Location: PolandPoland
Hi
I draw lines on chart (from strategy).
But I do not want to make them visible in workspace-tree, so I'm using IChartObject.setVisibleInWorkspaceTree method, but it do not work.
In attachment simple strategy which show the problem.

Moreover I have to use always method chat.remove, otherwise come new lines and they can not be thrown away.
Moreover if new line is drawn then on the upper left site of platform instrument is changed to this where line is draw.

Once there was a similar problem but it was solved, now back again:
viewtopic.php?f=85&t=46099&p=61027&hilit=setVisibleInWorkspaceTree#p61027

Please solve the problem


Attachments:
ObjectLinesTest01.java [1.67 KiB]
Downloaded 303 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: IChartObject.setVisibleInWorkspaceTree method problem Post rating: 0   New post Posted: Thu 09 May, 2013, 17:11 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please don't use the deprecated methods, try:
package jforex.charts;

import java.awt.Color;

import com.dukascopy.api.*;

public class ObjectLinesTestNonDeprecated implements IStrategy {
    private IContext context;
   
    @Configurable("Instrument:")
    public Instrument instrumentThis = Instrument.EURUSD;
   
    public void onStart(IContext context) throws JFException {
        this.context = context;
    }

    public void onAccount(IAccount account) throws JFException {
    }

    public void onMessage(IMessage message) throws JFException {
    }

    public void onStop() throws JFException {
        IChart chart = context.getChart(instrumentThis);
        if(chart != null){
            chart.remove("BidLine");
            chart.remove("AskLine");
        }
    }

    public void onTick(Instrument instrument, ITick tick) throws JFException {
        if(instrument!=instrumentThis) return;
        IChart chart = context.getChart(instrument);
        if (chart != null){
            IChartObject bidLine = chart.getChartObjectFactory().createHorizontalLine("BidLine", tick.getBid());
            bidLine.setVisibleInWorkspaceTree(false);
            bidLine.setColor(Color.GRAY);
            chart.add(bidLine);

            IChartObject askLine = chart.getChartObjectFactory().createHorizontalLine("AskLine", tick.getAsk());
            askLine.setVisibleInWorkspaceTree(false);
            askLine.setColor(Color.GRAY);
            chart.add(askLine);
        }
    }
   
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
    }
}


Attachments:
ObjectLinesTestNonDeprecated.java [1.53 KiB]
Downloaded 302 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: IChartObject.setVisibleInWorkspaceTree method problem Post rating: 0   New post Posted: Fri 10 May, 2013, 10:56 

User rating: 3
Joined: Thu 28 Jul, 2011, 19:40
Posts: 72
Location: PolandPoland
Thank you very much :)


 

Jump to:  

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