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.

IChartObjectFactory??
 Post subject: IChartObjectFactory?? Post rating: 0   New post Posted: Tue 18 Jan, 2011, 13:47 

User rating: 2
Joined: Mon 23 May, 2011, 09:25
Posts: 2
Location: Portugal,
Hi
With the last version of the API draw methods of the IChart are marked as deprecated.

So the question is, how to use the factory methods of IChartObjectFactory?
How to pass parameters to an objects on method invocation. What parameters to send?

Cannot find any example in the api, wiki or docs.

I'm trying to draw a simple rectangle with the new methods.

Thanks in advance.
Jorge


 
 Post subject: Re: IChartObjectFactory?? Post rating: 0   New post Posted: Mon 24 Jan, 2011, 13:34 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
To draw rectangle using IChartObjectFactory please consider the following code:

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.getChart(Instrument.EURUSD);

rectangle = chart.getChartObjectFactory().createRectangle();
rectangle.setTime(0, System.currentTimeMillis());
rectangle.setTime(1, System.currentTimeMillis() - 10 * 60 * 1000);
rectangle.setPrice(0, 1.3600);
rectangle.setPrice(1, 1.35024);

chart.addToMainChart(rectangle);
}


 
 Post subject: Re: IChartObjectFactory?? Post rating: 0   New post Posted: Mon 24 Jan, 2011, 19:16 

User rating: 0
Joined: Tue 27 Jul, 2010, 20:57
Posts: 49
And how do you remove the rectangle again?

What are the setAttrInt(IChartObject.ATTR_INT.CORNER, <value>) and setAttrInt(IChartObject.ATTR_INT.XDISTANCE, value>) and setAttrInt(IChartObject.ATTR_INT.YDISTANCE, <value>) methods for? They seem to have no effect!? For example, I would like to place an object at (fixed) pixel position corner+xdistance/corner+ydistance, instead of time/price..


 
 Post subject: Re: IChartObjectFactory?? Post rating: 0   New post Posted: Thu 27 Jan, 2011, 15:32 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
To remove the rectangle from the chart, you need to declare IChart object as a class variable/field and call the removeAll() method. Consider the following code:
   public void onStop() throws JFException {
      chart.removeAll();
   }

IChartObject.setAttrInt() will be fixed, please follow the isuue status: viewtopic.php?f=40&t=24530.


 
 Post subject: Re: IChartObjectFactory?? Post rating: 0   New post Posted: Tue 08 Feb, 2011, 12:19 
User avatar

User rating: 21
Joined: Thu 19 May, 2011, 20:50
Posts: 413
Location: Germany, Munich
Please maintain the javadoc IChartObjectFactory ( https://www.dukascopy.com/client/javadoc/ ) urgently!

Example:
IHorizontalLineChartObject    createHorizontalLine(Object... params) 

What does "Object... params" mean?

I have to use the new way, because e.g.
setAttrDouble(IChartObject.ATTR_DOUBLE.PRICE1, price)

in IChartObject does not work any more!!


 
 Post subject: Re: IChartObjectFactory?? Post rating: 0   New post Posted: Tue 08 Feb, 2011, 12:39 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
SFXbernhard wrote:
IChartObject does not work any more!!


We advice to use the IChartObjectFactory to draw on a chat, because many IChartObject methods are deprecated. Please take a look at the following topic: viewtopic.php?f=7&t=25837


 
 Post subject: Re: IChartObjectFactory?? Post rating: 0   New post Posted: Tue 15 Feb, 2011, 11:33 
User avatar

User rating: 21
Joined: Thu 19 May, 2011, 20:50
Posts: 413
Location: Germany, Munich
I have many problems with the new system IChartObjects. I don't know how to handle them (the java doc is catastrophic) and the old functions are very unsecure, because they are not working.

Please finish developing and testing first before you public new functions and leave the old deprecated!


 

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