Dukascopy
 
 
Wiki JStore Search Login

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

    Submit JForex API function requests in this forum only.
    Off topics are strictly forbidden.

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

Strategy draw on IChart with a general Polygon java.awt.Shape ?
 Post subject: Strategy draw on IChart with a general Polygon java.awt.Shape ? Post rating: 0   New post Posted: Sat 28 Sep, 2013, 16:56 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
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


 
 Post subject: Re: Strategy draw on IChart with a general Polygon java.awt.Shape ? Post rating: 0   New post Posted: Mon 30 Sep, 2013, 08:14 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
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.


 
 Post subject: Re: Strategy draw on IChart with a general Polygon java.awt.Shape ? Post rating: 0   New post Posted: Fri 13 Dec, 2013, 22:01 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
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


 
 Post subject: Re: Strategy draw on IChart with a general Polygon java.awt.Shape ? Post rating: 0   New post Posted: Thu 16 Jan, 2014, 16:33 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We don't plan to provide access to the chart graphics from strategies, if you lack some functionality please make a corresponding feature request.


 
 Post subject: Re: Strategy draw on IChart with a general Polygon java.awt.Shape ? Post rating: 0   New post Posted: Tue 21 Jan, 2014, 03:30 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
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


 
 Post subject: Re: Strategy draw on IChart with a general Polygon java.awt.Shape ? Post rating: 0   New post Posted: Tue 21 Jan, 2014, 16:01 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
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?


 
 Post subject: Re: Strategy draw on IChart with a general Polygon java.awt.Shape ? Post rating: 0   New post Posted: Sat 25 Jan, 2014, 02:13 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
OK, thanks. I'll study what's available with polyline.
HyperScalper


 

Jump to:  

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