Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

Strategy draw on IChart with a general Polygon java.awt.Shape ?
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=83&t=50106
Page 1 of 1

Author:  hyperscalper [ Sat 28 Sep, 2013, 16:56 ]
Post subject:  Strategy draw on IChart with a general Polygon java.awt.Shape ?

Apologies, but I couldn't see a way to define and use a Chart object
described by the generalized java.awt.Shape interface with Java2d.

Can this be done using some method in Interface IChartObjectFactory ?
Could I somehow extend IChartObject to create an arbitrary polygon shape
which would be closed and filled with a color and transparency, etc?

Is the java.awt.Polygon representation intended to be implemented
through the com.dukascopy.api.drawings.IPolyLineChartObject interface?
Maybe that's how I could define a subclass
IChartObject and define an arbitrary polygon shape? (I'm not really a
graphics guy... :(

But IPolyLineChartObject would need to be a sub-interface of IFillableChartObject
for me to be able to fill in the area enclosed, I guess.

Is this the generalized form which could do that ? Could somebody
show an example using this in Interface IChartObjectFactory:

<T extends IChartObject> T create(Class<T> objectClass) 


This would be from within a standalone IStrategy implementation, and NOT from
a custom Indicator.

Using standalone API, can a strategy define and plot arbitrary 2D objects on charts
which are specified using the Interface java.awt.Shape?

Thanks for any tips,
HyperScalper

Author:  API Support [ Mon 30 Sep, 2013, 08:14 ]
Post subject:  Re: Strategy draw on IChart with a general Polygon java.awt.Shape ?

hyperscalper wrote:
Using standalone API, can a strategy define and plot arbitrary 2D objects on charts
which are specified using the Interface java.awt.Shape?
No, the JForex Strategy API can't do that. Only Indicators can do it by using the IDrawingIndicator interface (see usages in JForex-API).
Quote:
But IPolyLineChartObject would need to be a sub-interface of IFillableChartObject
for me to be able to fill in the area enclosed, I guess.

Is this the generalized form which could do that ?
In the current API implementation you can't do that with the poly line chart object, but you can achieve this by combining opaque triangles.

Author:  hyperscalper [ Fri 13 Dec, 2013, 22:01 ]
Post subject:  Re: Strategy draw on IChart with a general Polygon java.awt.Shape ?

I'd like to request that we be able to use a
java.awt.Shape object specification to create
IChartObjects from within a Strategy, without
having to write custom indicators.

Has there been any development toward that in
the API since this original post? It seems to me
this would be a useful feature which I would
certainly use.

Sorry if this has already been addressed, but I
didn't see a way to use arbitrary shapes from a
Strategy in placing marks on a chart.

Thanks,
HyperScalper

Author:  API Support [ Thu 16 Jan, 2014, 16:33 ]
Post subject:  Re: Strategy draw on IChart with a general Polygon java.awt.Shape ?

We don't plan to provide access to the chart graphics from strategies, if you lack some functionality please make a corresponding feature request.

Author:  hyperscalper [ Tue 21 Jan, 2014, 03:30 ]
Post subject:  Re: Strategy draw on IChart with a general Polygon java.awt.Shape ?

Well, I use ISignalDownChartObject and ISignalUpChartObject markers from strategies.

There are just not many choices of shape to use. So I thought I'd ask whether other user defined
closed Pologon shapes could be implemented to provide some variety.

I'm definitely not going to go to the trouble of learning how to write Indicators
just so that I can put a few interesting marks on the chart from a Strategy.
Circles, squares, triangles small user-defined filled polygon shapes
using the java.awt.Shape interface would be my request. Wouldn't want
the Strategy module to have to have a Graphics context and draw, but to
be able to define such simple shapes to provide some variety.

HyperScalper

Author:  API Support [ Tue 21 Jan, 2014, 16:01 ]
Post subject:  Re: Strategy draw on IChart with a general Polygon java.awt.Shape ?

hyperscalper wrote:
There are just not many choices of shape to use. So I thought I'd ask whether other user defined
closed Pologon shapes could be implemented to provide some variety.
Polygon's are already available by using polyline, you only need to connect the end points and fill the polygon with triangles - for this consider cutting off polygon's "ears" (i.e., less than 180 degree vertices) until there is a single triangle left.
hyperscalper wrote:
Circles, squares, triangles small user-defined filled polygon shapes
using the java.awt.Shape interface would be my request.
So what are the shortcomings of the currently available shapes?

Author:  hyperscalper [ Sat 25 Jan, 2014, 02:13 ]
Post subject:  Re: Strategy draw on IChart with a general Polygon java.awt.Shape ?

OK, thanks. I'll study what's available with polyline.
HyperScalper

  Page 1 of 1