Dukascopy
 
 
Wiki JStore Search Login

APICLIENT-176 Renko - "Double cannot be cast to" error
 Post subject: APICLIENT-176 Renko - "Double cannot be cast to" error Post rating: 0   New post Posted: Wed 04 Jul, 2012, 10:27 

User rating: 0
Joined: Sun 22 Apr, 2012, 19:19
Posts: 54
Location: United KingdomUnited Kingdom
Attached is an example of "Double cannot be cast to" exception error on renko bars that has been mentioned in posts before. It stops the strategy.

I have run the strategy using eclipse as suggested and the error occurred again.

See end of log for the error info. Strategy that created error also attached.

T


Attachments:
errorlog.rtf [17.15 KiB]
Downloaded 440 times
RenkoMAOutByOne.java [6.83 KiB]
Downloaded 432 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: Renko - "Double cannot be cast to" error Post rating: 0   New post Posted: Wed 04 Jul, 2012, 14:19 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We replaced the line 72 with the following:
         Object[] maOutputArrays = indicators.calculateIndicator(feedDescriptor, new OfferSide[] { OfferSide.BID }, "MA",
               new AppliedPrice[] { AppliedPrice.CLOSE }, maOptInputs, candlesBefore, // 3 for trend change
               bar.getTime(), candlesAfter);
         double[] maOutput = (double[]) maOutputArrays[0]; //ma has just 1 output
         print(String.format("ma output line for last %s range bars: %s",candlesBefore, Arrays.toString(maOutput)));
And we ran the strategy from a program the following way (pay attention to the instrument subscription):
        Set<Instrument> instruments = new HashSet<Instrument>();
        instruments.add(Instrument.AUDUSD);
        LOGGER.info("Subscribing instruments...");
        client.setSubscribedInstruments(instruments);
        //start the strategy
        LOGGER.info("Starting strategy");
        client.startStrategy(new RenkoMAOutByOne());
Should have any additional problems, please also provide the program which launches the strategy.


 
 Post subject: Re: APICLIENT-176 Renko - "Double cannot be cast to" error Post rating: 0   New post Posted: Fri 06 Jul, 2012, 21:51 

User rating: 0
Joined: Sun 22 Apr, 2012, 19:19
Posts: 54
Location: United KingdomUnited Kingdom
Hello

The error occurred again after the prog had been running for about 5 hours.

Error log below

2012-07-06 13:19:50.703 1.0230587
2012-07-06 13:22:07.979 ma output line for last 3 range bars: [1.023006243695344, 1.023058744535965, 1.023104245264503]
2012-07-06 13:22:07.979 1.0231042
2012-07-06 15:23:41.514 ERROR PostRenkoTask - java.lang.Double cannot be cast to [D
java.lang.ClassCastException: java.lang.Double cannot be cast to [D
at singlejartest.RenkoMAOutByOne.onBar(RenkoMAOutByOne.java:85)
at com.dukascopy.api.impl.execution.post.PostRenkoTask.postData(PostRenkoTask.java:54)
at com.dukascopy.api.impl.execution.AbstractPostDataTask.call(AbstractPostDataTask.java:43)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at com.dukascopy.api.impl.execution.ScienceThreadPoolExecutor$Worker.runTask(ScienceThreadPoolExecutor.java:904)
at com.dukascopy.api.impl.execution.ScienceThreadPoolExecutor$Worker.run(ScienceThreadPoolExecutor.java:926)
at java.lang.Thread.run(Thread.java:680)
2012-07-06 15:23:41.786 ERROR DCClientImpl$DefaultStrategyExceptionHandler - Exception thrown while running onBar method: java.lang.Double cannot be cast to [D
java.lang.ClassCastException: java.lang.Double cannot be cast to [D
at singlejartest.RenkoMAOutByOne.onBar(RenkoMAOutByOne.java:85)
at com.dukascopy.api.impl.execution.post.PostRenkoTask.postData(PostRenkoTask.java:54)
at com.dukascopy.api.impl.execution.AbstractPostDataTask.call(AbstractPostDataTask.java:43)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at com.dukascopy.api.impl.execution.ScienceThreadPoolExecutor$Worker.runTask(ScienceThreadPoolExecutor.java:904)
at com.dukascopy.api.impl.execution.ScienceThreadPoolExecutor$Worker.run(ScienceThreadPoolExecutor.java:926)
at java.lang.Thread.run(Thread.java:680)
Stopping "RenkoMAOutByOne" strategy at 2012-07-06 13:23:41.786 GMT on the local computer
2012-07-06 15:23:41.811 INFO Main - Strategy stopped: 38
java.lang.ClassCastException: java.lang.Double cannot be cast to [D @ singlejartest.RenkoMAOutByOne.onBar(RenkoMAOutByOne.java:85)
java.lang.Double cannot be cast to [D: java.lang.ClassCastException: java.lang.Double cannot be cast to [D
at singlejartest.RenkoMAOutByOne.onBar(RenkoMAOutByOne.java:85)
at com.dukascopy.api.impl.execution.post.PostRenkoTask.postData(PostRenkoTask.java:54)
at com.dukascopy.api.impl.execution.AbstractPostDataTask.call(AbstractPostDataTask.java:43)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at com.dukascopy.api.impl.execution.ScienceThreadPoolExecutor$Worker.runTask(ScienceThreadPoolExecutor.java:904)
at com.dukascopy.api.impl.execution.ScienceThreadPoolExecutor$Worker.run(ScienceThreadPoolExecutor.java:926)
at java.lang.Thread.run(Thread.java:680)


Attachments:
Main.java [5.03 KiB]
Downloaded 385 times
RenkoMAOutByOne.java [7.52 KiB]
Downloaded 368 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: java.lang.ClassCastException: java.lang.Double cannot be cast to [D Post rating: 0   New post Posted: Tue 10 Jul, 2012, 15:27 
User avatar

User rating: 0
Joined: Mon 30 Jan, 2012, 21:50
Posts: 32
Location: Czech Republic, Staré Buky
Hello support,
bellow is exception, what I´am receiving sometimes and after that is strategy stopped.

Pls should you advice me what is wrong?

thank you



java.lang.ClassCastException: java.lang.Double cannot be cast to [D
at jforex.strategies.renko.Brick_v2.onBar(Brick_v2.java:177)
at com.dukascopy.api.impl.execution.a.e.bx(Unknown Source)
at com.dukascopy.api.impl.execution.a.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at com.dukascopy.api.impl.execution.g$a.f(Unknown Source)
at com.dukascopy.api.impl.execution.g$a.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)



// calculate indicator
double[] slowMAfeed = (double[]) indicators.calculateIndicator( feedDescriptor, new OfferSide[]{OfferSide.BID}, "MA",
new AppliedPrice[]{AppliedPrice.CLOSE}, new Object[]{slowMaPeriod, slowMaType.ordinal()}, 2, bar.getTime(), 0)[0];

double[] fastMAFeed = (double[]) indicators.calculateIndicator( feedDescriptor, new OfferSide[]{OfferSide.BID}, "MA",
new AppliedPrice[]{AppliedPrice.CLOSE}, new Object[]{fastMaPeriod, fastMaType.ordinal()}, 2, bar.getTime(), 0)[0];


 
 Post subject: Re: APICLIENT-176 Renko - "Double cannot be cast to" error Post rating: 0   New post Posted: Wed 11 Jul, 2012, 07:45 

User rating: 0
Joined: Sun 22 Apr, 2012, 19:19
Posts: 54
Location: United KingdomUnited Kingdom
Hello

Is there any feedback on this one. It seems many users are encountering this error. It is difficult to test strategies in a live environment for any length of time at the moment. Do you have any temporary workarounds?

Tin


 
 Post subject: Re: APICLIENT-176 Renko - "Double cannot be cast to" error Post rating: 0   New post Posted: Wed 11 Jul, 2012, 08:28 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The topic has issue prefix and it has been moved to Bug Reports, which means that the issue has been registered and will be fixed as soon as possible.


 

Jump to:  

cron
  © 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