|
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.
Backtesting on Demo since API update |
jalodge
|
Post subject: Backtesting on Demo since API update |
Post rating: 0
|
Posted: Mon 20 Aug, 2012, 10:03
|
|
User rating: 0
Joined: Tue 02 Aug, 2011, 11:35 Posts: 32 Location: United Arab Emirates, Dubai
|
I use the following code in my renko strategy and testing on the latest API demo account is now the same as if I ran the strategy on a live account. i.e. 1 bar late on order entry. (known problem) ..what i want to know is the way i have it coded is right ? Is it possible to get latest demo to backtest same as current live api backtests ?? public void onBar(Instrument instrument, OfferSide offerSide, PriceRange priceRange, IRenkoBar bar ) {
try { if (!isActive(order)) { order = null; } else if (order.equals(IOrder.State.CREATED)) { return; }
boolean sellSign = false; boolean buySign = false;
Object[] output = indicators.calculateIndicator(feedDescriptor, new OfferSide[]{offerSide}, "JAMES_INDI", new IIndicators.AppliedPrice[]{IIndicators.AppliedPrice.CLOSE}, new Object[]{20}, 100, bar.getEndTime(), 0); if (!(output[0] instanceof double[])) { return; } double firstvalue = ((double[]) output[0])[98]; double secondvalue = ((double[]) output[0])[99]; double thirdvalue = ((double[]) output[1])[98]; double fourthvalue = ((double[]) output[1])[99]; print(secondvalue, bar.getEndTime()); print(fourthvalue, bar.getEndTime());
if (firstvalue ==3 && secondvalue >3 ) { print("buying"); buySign = true; } if (thirdvalue == -3 && fourthvalue <-3 ) { print("selling"); sellSign = true; } thanks
|
|
|
|
 |
API Support
|
Post subject: Re: Backtesting on Demo since API update |
Post rating: 0
|
Posted: Mon 27 Aug, 2012, 08:24
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
jalodge wrote: what i want to know is the way i have it coded is right ? This you can find out by back-testing. jalodge wrote: Is it possible to get latest demo to backtest same as current live api backtests ?? There have been fixes in renko generation between JForex-API versions of LIVE and DEMO. Meaning that the renko back-testing results between the two may differ. The results should match once the current JForex DEMO version will get released in LIVE.
|
|
|
|
 |
jalodge
|
Post subject: Re: Backtesting on Demo since API update |
Post rating: 0
|
Posted: Tue 28 Aug, 2012, 05:18
|
|
User rating: 0
Joined: Tue 02 Aug, 2011, 11:35 Posts: 32 Location: United Arab Emirates, Dubai
|
the way i have it coded backtests very slowly on Demo ... Is there a better way to code for the latest Api?
|
|
|
|
 |
API Support
|
Post subject: Re: Backtesting on Demo since API update |
Post rating: 0
|
Posted: Tue 28 Aug, 2012, 07:28
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Renko and range bar feeds in general take longer time to generate (as opposed to timeframe-based candle sticks). Try different Historical Tester settings in order to speed up your backtests (e.g. by deselecting Visual mode and changing time period and tick generation methods).
|
|
|
|
 |
jalodge
|
Post subject: Re: Backtesting on Demo since API update |
Post rating: 0
|
Posted: Tue 28 Aug, 2012, 07:46
|
|
User rating: 0
Joined: Tue 02 Aug, 2011, 11:35 Posts: 32 Location: United Arab Emirates, Dubai
|
thanks for the quick answer... I have tried all those .. my strategy tests at good speed in the live API version but is untestable in demo API I ask if we have to change the way is coded as the strategy in this post viewtopic.php?f=112&t=47731tests at very good speed in Demo API and Live API
|
|
|
|
 |
API Support
|
Post subject: Re: Backtesting on Demo since API update |
Post rating: 0
|
Posted: Wed 29 Aug, 2012, 07:31
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
jalodge wrote: my strategy tests at good speed in the live API version but is untestable in demo API See if the indicator calculation time is the bottleneck, e.g. long start = System.currentTimeMillis(); Object[] output = indicators.calculateIndicator(//... console.getOut().println("indicator calculated in: " + (System.currentTimeMillis() - start) + " milliseconds");
|
|
|
|
 |
jalodge
|
Post subject: Re: Backtesting on Demo since API update |
Post rating: 0
|
Posted: Wed 29 Aug, 2012, 08:33
|
|
User rating: 0
Joined: Tue 02 Aug, 2011, 11:35 Posts: 32 Location: United Arab Emirates, Dubai
|
ok will try that thanks...
I have this in the strategy as well
Object[] stddev = indicators.calculateIndicator(feedDescriptor, new OfferSide[] {OfferSide.BID}, "STDDEV", new IIndicators.AppliedPrice[] {AppliedPrice.CLOSE}, new Object[]{timePeriod, nbDev}, shift); double result = (Double) stddev[0];
and is producing this error in console
29.08.2012 15:26:23.720 WARNING connect.ce ] White Label Image is not received 29.08.2012 15:26:27.843 WARNING impl.cm ] There is not enough data to calculate value for STDDEV 29.08.2012 15:26:28.561 WARNING impl.cm ] There is not enough data to calculate value for STDDEV 29.08.2012 15:26:29.387 WARNING impl.cm ] There is not enough data to calculate value for STDDEV 29.08.2012 15:26:30.308 WARNING impl.cm ] There is not enough data to calculate value for STDDEV 29.08.2012 15:26:31.142 WARNING impl.cm ] There is not enough data to calculate value for STDDEV
just took it out is now backtesting is fine in demo api in terms of speed... how can i make it work with stddev?
|
|
|
|
 |
API Support
|
Post subject: Re: Backtesting on Demo since API update |
Post rating: 0
|
Posted: Wed 29 Aug, 2012, 12:43
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Please provide an example strategy which replicates the case. Also please post a precise launch scenario.
|
|
|
|
 |
jalodge
|
Post subject: Re: Backtesting on Demo since API update |
Post rating: 0
|
Posted: Fri 31 Aug, 2012, 03:06
|
|
User rating: 0
Joined: Tue 02 Aug, 2011, 11:35 Posts: 32 Location: United Arab Emirates, Dubai
|
jalodge wrote: ok will try that thanks...
I have this in the strategy as well
Object[] stddev = indicators.calculateIndicator(feedDescriptor, new OfferSide[] {OfferSide.BID}, "STDDEV", new IIndicators.AppliedPrice[] {AppliedPrice.CLOSE}, new Object[]{timePeriod, nbDev}, shift); double result = (Double) stddev[0];
and is producing this error in console
29.08.2012 15:26:23.720 WARNING connect.ce ] White Label Image is not received 29.08.2012 15:26:27.843 WARNING impl.cm ] There is not enough data to calculate value for STDDEV 29.08.2012 15:26:28.561 WARNING impl.cm ] There is not enough data to calculate value for STDDEV 29.08.2012 15:26:29.387 WARNING impl.cm ] There is not enough data to calculate value for STDDEV 29.08.2012 15:26:30.308 WARNING impl.cm ] There is not enough data to calculate value for STDDEV 29.08.2012 15:26:31.142 WARNING impl.cm ] There is not enough data to calculate value for STDDEV
just took it out is now backtesting is fine in demo api in terms of speed... how can i make it work with stddev? stddev calculation time is around the 1000 millisecond if I use new Object[]{timePeriod, nbDev}, shift); if I use new Object[]{timePeriod, nbDev}, 1); calculation time drops to 0 - 1 millisecond
|
|
|
|
 |
API Support
|
Post subject: Re: Backtesting on Demo since API update |
Post rating: 0
|
Posted: Fri 31 Aug, 2012, 09:00
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
API Support wrote: Please provide an example strategy which replicates the case. Also please post a precise launch scenario.
|
|
|
|
 |
jalodge
|
Post subject: Re: Backtesting on Demo since API update |
Post rating: 0
|
Posted: Tue 04 Sep, 2012, 11:07
|
|
User rating: 0
Joined: Tue 02 Aug, 2011, 11:35 Posts: 32 Location: United Arab Emirates, Dubai
|
I have added it to this strategy you wrote..mine is based of this so would be very similar if you can get this to work... and can you make inversefisher call in progress bar... Thanks
Attachments: |
InverseFisherStrat.java [13.41 KiB]
Downloaded 339 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.
|
|
|
|
|
 |
API Support
|
Post subject: Re: Backtesting on Demo since API update |
Post rating: 0
|
Posted: Tue 04 Sep, 2012, 13:41
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
The strategy you posted uses a custom indicator, the source code of which you did not provide. For more efficient assistance always please try to keep the example strategies as compact and simple as possible. Also when we ask you to provide a launch scenario, please describe if you launch the strategy with live data or historical data, what are the settings of historical tester, etc. Here is the strategy which we tested both in Historical Tester and with live-data, and we could not replicate the problem that you reported: package jforex.feed.test;
import com.dukascopy.api.*; import com.dukascopy.api.IIndicators.AppliedPrice; import com.dukascopy.api.feed.*; import com.dukascopy.api.feed.util.*;
public class RenkoStdDev implements IStrategy {
private IIndicators indicators; private IConsole console;
@Override public void onStart(final IContext context) throws JFException { indicators = context.getIndicators(); console = context.getConsole(); IFeedDescriptor feedDescriptor = new RenkoFeedDescriptor(Instrument.EURUSD, PriceRange.TWO_PIPS, OfferSide.ASK); context.subscribeToFeed(feedDescriptor, new IFeedListener() { @Override public void onFeedData(IFeedDescriptor feedDescriptor, ITimedData feedData) { try { Object[] stddev = indicators.calculateIndicator(feedDescriptor, new OfferSide[] { OfferSide.BID }, "STDDEV", new IIndicators.AppliedPrice[] { AppliedPrice.CLOSE }, new Object[] { 5, 1.0 }, 0); console.getOut().println(String.format("____ \n Completed renko: %s \nstddev=%.5f",feedData, stddev[0])); } catch (JFException e) { e.printStackTrace(); } } }); }
public void onTick(Instrument instrument, ITick tick) throws JFException {} public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {} public void onMessage(IMessage message) throws JFException {} public void onAccount(IAccount account) throws JFException {} public void onStop() throws JFException {} }
Attachments: |
RenkoStdDev.java [1.62 KiB]
Downloaded 342 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.
|
|
|
|
|
 |
jalodge
|
Post subject: Re: Backtesting on Demo since API update |
Post rating: 0
|
Posted: Wed 05 Sep, 2012, 02:18
|
|
User rating: 0
Joined: Tue 02 Aug, 2011, 11:35 Posts: 32 Location: United Arab Emirates, Dubai
|
this is the results i get in demo back testing 2012-09-05 01:16:33 indicator1 calculated in: 754 milliseconds 2012-09-05 01:16:33 stddev=0.00023 2012-09-05 01:16:33 Completed renko: StartTime: 2012-08-27 06:00:03.044 EndTime: 2012-08-27 06:04:07.173 O: 1.2504 C: 1.2506 H: 1.2506 L: 1.2504 V: 365.57 FEC: 188 2012-09-05 01:16:33 ____ 2012-09-05 01:16:32 indicator1 calculated in: 748 milliseconds 2012-09-05 01:16:32 stddev=0.00015 2012-09-05 01:16:32 Completed renko: StartTime: 2012-08-27 05:56:13.224 EndTime: 2012-08-27 06:00:03.043 O: 1.2502 C: 1.2504 H: 1.2504 L: 1.2502 V: 683.51 FEC: 328 2012-09-05 01:16:32 ____ 2012-09-05 01:16:31 indicator1 calculated in: 736 milliseconds 2012-09-05 01:16:31 stddev=0.00015 2012-09-05 01:16:31 Completed renko: StartTime: 2012-08-27 05:52:20.886 EndTime: 2012-08-27 05:56:13.223 O: 1.2502 C: 1.2502 H: 1.2502 L: 1.25 V: 610.6 FEC: 291 2012-09-05 01:16:31 ____ 2012-09-05 01:16:30 indicator1 calculated in: 739 milliseconds 2012-09-05 01:16:30 stddev=0.00028 2012-09-05 01:16:30 Completed renko: StartTime: 2012-08-27 05:51:11.076 EndTime: 2012-08-27 05:52:20.885 O: 1.2504 C: 1.2502 H: 1.2504 L: 1.2502 V: 143.52 FEC: 70 2012-09-05 01:16:30 ____ 2012-09-05 01:16:30 indicator1 calculated in: 741 milliseconds 2012-09-05 01:16:30 stddev=0.00023 2012-09-05 01:16:30 Completed renko: StartTime: 2012-08-27 05:41:20.643 EndTime: 2012-08-27 05:51:11.075 O: 1.2506 C: 1.2504 H: 1.2506 L: 1.2504 V: 1053.84 FEC: 483 2012-09-05 01:16:30 ____ 2012-09-05 01:16:29 indicator1 calculated in: 737 milliseconds 2012-09-05 01:16:29 stddev=0.00016 2012-09-05 01:16:29 Completed renko: StartTime: 2012-08-27 05:36:41.873 EndTime: 2012-08-27 05:41:20.642 O: 1.2508 C: 1.2506 H: 1.2508 L: 1.2506 V: 364.04 FEC: 153 2012-09-05 01:16:29 ____ 2012-09-05 01:16:28 indicator1 calculated in: 737 milliseconds 2012-09-05 01:16:28 stddev=0.00008 2012-09-05 01:16:28 Completed renko: StartTime: 2012-08-27 02:42:45.319 EndTime: 2012-08-27 05:36:41.872 O: 1.2508 C: 1.2508 H: 1.251 L: 1.2508 V: 7805.92 FEC: 3672 2012-09-05 01:16:28 ____ 2012-09-05 01:16:27 indicator1 calculated in: 731 milliseconds 2012-09-05 01:16:27 stddev=0.00015 2012-09-05 01:16:27 Completed renko: StartTime: 2012-08-27 02:35:57.541 EndTime: 2012-08-27 02:42:45.318 O: 1.2506 C: 1.2508 H: 1.2508 L: 1.2506 V: 469.56 FEC: 208 2012-09-05 01:16:27 ____ 2012-09-05 01:16:27 indicator1 calculated in: 622 milliseconds 2012-09-05 01:16:27 stddev=0.00010 2012-09-05 01:16:27 Completed renko: StartTime: 2012-08-27 02:23:27.255 EndTime: 2012-08-27 02:35:57.540 O: 1.2506 C: 1.2506 H: 1.2506 L: 1.2504 V: 741.7 FEC: 344 2012-09-05 01:16:27 ____ 2012-09-05 01:16:26 indicator1 calculated in: 627 milliseconds 2012-09-05 01:16:26 stddev=0.00015 2012-09-05 01:16:26 Completed renko: StartTime: 2012-08-27 02:19:55.763 EndTime: 2012-08-27 02:23:27.254 O: 1.2506 C: 1.2506 H: 1.2508 L: 1.2506 V: 454.43 FEC: 228 2012-09-05 01:16:26 ____ 2012-09-05 01:16:25 indicator1 calculated in: 722 milliseconds 2012-09-05 01:16:25 stddev=0.00015 2012-09-05 01:16:25 Completed renko: StartTime: 2012-08-27 02:10:08.662 EndTime: 2012-08-27 02:19:55.762 O: 1.2504 C: 1.2506 H: 1.2506 L: 1.2504 V: 908.34 FEC: 436 2012-09-05 01:16:25 ____ 2012-09-05 01:16:25 indicator1 calculated in: 728 milliseconds 2012-09-05 01:16:25 stddev=0.00015 2012-09-05 01:16:25 Completed renko: StartTime: 2012-08-27 02:09:07.254 EndTime: 2012-08-27 02:10:08.661 O: 1.2504 C: 1.2504 H: 1.2504 L: 1.2502 V: 258.88 FEC: 123 2012-09-05 01:16:25 ____ 2012-09-05 01:16:24 indicator1 calculated in: 725 milliseconds 2012-09-05 01:16:24 stddev=0.00027 2012-09-05 01:16:24 Completed renko: StartTime: 2012-08-27 02:07:16.060 EndTime: 2012-08-27 02:09:07.253 O: 1.2504 C: 1.2504 H: 1.2506 L: 1.2504 V: 306.78 FEC: 148 2012-09-05 01:16:24 ____ 2012-09-05 01:16:23 indicator1 calculated in: 721 milliseconds 2012-09-05 01:16:23 stddev=0.00024 2012-09-05 01:16:23 Completed renko: StartTime: 2012-08-27 02:02:20.262 EndTime: 2012-08-27 02:07:16.059 O: 1.2504 C: 1.2504 H: 1.2504 L: 1.2502 V: 642.5 FEC: 319 2012-09-05 01:16:23 ____ 2012-09-05 01:16:23 indicator1 calculated in: 621 milliseconds 2012-09-05 01:16:23 stddev=0.00028 2012-09-05 01:16:23 Completed renko: StartTime: 2012-08-27 02:02:20.260 EndTime: 2012-08-27 02:02:20.261 O: 1.2506 C: 1.2504 H: 1.2506 L: 1.2504 V: 25.13 FEC: 15 2012-09-05 01:16:23 ____ 2012-09-05 01:16:22 indicator1 calculated in: 723 milliseconds 2012-09-05 01:16:22 stddev=0.00028 2012-09-05 01:16:22 Completed renko: StartTime: 2012-08-27 01:59:39.518 EndTime: 2012-08-27 02:02:20.259 O: 1.2508 C: 1.2506 H: 1.2508 L: 1.2506 V: 423.06 FEC: 210
|
|
|
|
 |
API Support
|
Post subject: Re: Backtesting on Demo since API update |
Post rating: 0
|
Posted: Wed 05 Sep, 2012, 07:45
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
What issue are you reporting? Indicator performance of shift=0 over feed has already been registered here: viewtopic.php?f=16&t=47923
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|