|
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.
Pattern double top |
c112
|
Post subject: Pattern double top |
Post rating: 0
|
Posted: Mon 20 Jan, 2014, 15:53
|
|
User rating: 1
Joined: Thu 02 Jan, 2014, 19:06 Posts: 16 Location: ThailandThailand
|
I'm trying to adapt https://www.dukascopy.com/wiki/#Indicator_catalog/CHANNEL_UP with DOUBLE_TOP. Object[] result = indicators.calculateIndicator( instrument, period, new OfferSide[] {OfferSide.BID}, "DOUBLE_TOP", new IIndicators.AppliedPrice[] {IIndicators.AppliedPrice.HIGH}, new Object[]{1, 50}, Filter.ALL_FLATS, 200, bidBar.getTime(), 0); for (Object o : result){ // (Pattern) o; ..? }
I couldn't find PatternIndicatorOutput class, I've found https://www.dukascopy.com/client/javadoc/com/dukascopy/api/drawings/IPatternWidgetChartObject.Pattern.html in the API which is just an enum. Also, I would like to know if calculateWholePattern can be set to false, like on jForex platform thanks edit: when running this strategy, defined in the wiki: int x1 = 10; // Start Count of Bars on Sides int x2 = 20; // Bars on Sides Increment Count double x3 = 50; // Centering Inaccuracy double x4 = 10; // Equality Inaccuracy public void onBar(Instrument instrument, Period period, IBar a, IBar b) throws JFException { if (period == Period.ONE_HOUR){ Object[] res = indicators.calculateIndicator( instrument, period, new OfferSide[] {OfferSide.BID}, "CHANNEL_UP", new IIndicators.AppliedPrice[] {IIndicators.AppliedPrice.CLOSE}, new Object[]{x1, x2, x3, x4}, Filter.ALL_FLATS, 200, b.getTime(), 0);
for (Object o : res){ console.getOut().println(new Date()+" "+res); } } } I get this Exception: 15:43:10 Strategy tester: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double @ jforex.Strategy.onBar(Strategy.java:60)
|
|
|
|
 |
tcsabina
|
Post subject: Re: Pattern double top |
Post rating: 2
|
Posted: Tue 21 Jan, 2014, 13:07
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
Quote: I get this Exception: 15:43:10 Strategy tester: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double @ jforex.Strategy.onBar(Strategy.java:60) Use an IDE, like Eclipse. That will help you track down issues with wrong parameter types...
|
|
|
|
 |
c112
|
Post subject: Re: Pattern double top |
Post rating: 1
|
Posted: Tue 21 Jan, 2014, 14:06
|
|
User rating: 1
Joined: Thu 02 Jan, 2014, 19:06 Posts: 16 Location: ThailandThailand
|
thanks tcsabina, I've finally made it with: Quote: import com.dukascopy.indicators.pattern.AbstractPatternIndicator.*; (which is marked deprecated in IDE's, but the other alternative com.dukascopy.figures.pattern.. doesn't exist when compiled in jForex, probably not the exact same version. Object[] channelOutputs = indicators.calculateIndicator(instrument, period, new OfferSide[] {OfferSide.BID}, "CHANNEL_UP", new IIndicators.AppliedPrice[] {IIndicators.AppliedPrice.CLOSE}, new Object[]{1, 50., 1, false}, // integer, double, integer, boolean history.getBar(instrument, period, OfferSide.BID, 2000).getTime(), history.getBar(instrument, period, OfferSide.BID,1).getTime());
now using double tops, It's not giving the same results on the chart: jForex chart preference is configured with Filter all flats like the strategy, with 1, 80%, High, false like the strategy, and tested from 2013-11-13 
Attachments: |
Test.java [2.76 KiB]
Downloaded 96 times
|
Test.java [2.76 KiB]
Downloaded 68 times
|
Sans titre22.png [70.47 KiB]
Downloaded 239 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.
|
|
|
|
|
 |
c112
|
Post subject: Re: Pattern double top |
Post rating: 0
|
Posted: Fri 24 Jan, 2014, 14:30
|
|
User rating: 1
Joined: Thu 02 Jan, 2014, 19:06 Posts: 16 Location: ThailandThailand
|
|
|
|
 |
API Support
|
 |
Post subject: Re: Pattern double top |
Post rating: 0
|
Posted: Mon 27 Jan, 2014, 13:20
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
The methods that you use are deprecated and are not used in the platform any more. There is no access from JForex-API to the pattern values provided by the pattern widget.
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|