|
JFOREX-3669 Indicator for Renko |
bunyip
|
Post subject: JFOREX-3669 Problems retrieving history with range bars |
Post rating: 0
|
Posted: Wed 21 Mar, 2012, 20:59
|
|
User rating: 2
Joined: Thu 01 Mar, 2012, 17:17 Posts: 42
|
Hi Support,
I'm trying to retrieve range bars from history for a strategy (just one bar in the first instance, although I'd like eventually to use more of them as inputs for an indicator), and the onBar method seems to get trapped in a loop.
The attached code shows what I mean: I've just put the bar retrieval method into the simplest possible strategy and got it to print out one bar, and it just repeats printing the same bar endlessly in the Historical Tester. I'm using version 2.6.60.1 of the API.
2012-03-21 19:52:31 StartTime: 2012-03-21 19:36:30.0 EndTime: 2012-03-21 19:50:15.0 O: 1.3208 C: 1.32101 H: 1.32101 L: 1.32051 V: 3459.995 FEC: 56 2012-03-21 19:52:31 StartTime: 2012-03-21 19:36:30.0 EndTime: 2012-03-21 19:50:15.0 O: 1.3208 C: 1.32101 H: 1.32101 L: 1.32051 V: 3459.995 FEC: 56 2012-03-21 19:52:31 StartTime: 2012-03-21 19:36:30.0 EndTime: 2012-03-21 19:50:15.0 O: 1.3208 C: 1.32101 H: 1.32101 L: 1.32051 V: 3459.995 FEC: 56 2012-03-21 19:52:31 StartTime: 2012-03-21 19:36:30.0 EndTime: 2012-03-21 19:50:15.0 O: 1.3208 C: 1.32101 H: 1.32101 L: 1.32051 V: 3459.995 FEC: 56
I'm really sorry if I've missed something obvious--I'm a total novice to Java and JForex--but I'd be very grateful for your help!
Thanks a lot,
Bunyip
Attachments: |
BarRetrievalStrategy.java [1.57 KiB]
Downloaded 491 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: Problems retrieving history with range bars |
Post rating: 0
|
Posted: Thu 22 Mar, 2012, 08:32
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
bunyip wrote: the onBar method seems to get trapped in a loop. In IStrategy.onBar arrive candle stick bars, which receives all candlesticks for all periods and instruments that are subscribed. To see what you actually receive there, consider printing the arriving candle sticks: console.getOut().println(instrument + " " + period + " bidBar: " + bidBar + " askBar: " + askBar); For more performant historical feed loading, consider subscribing to the range bar feed first, see (you can also not print the range bars, just subscribe): https://www.dukascopy.com/wiki/#Range_BarsFor indicators using feed data, see: https://www.dukascopy.com/wiki/#Indicato ... price_feed
|
|
|
|
 |
bunyip
|
Post subject: Re: Problems retrieving history with range bars |
Post rating: 0
|
Posted: Mon 26 Mar, 2012, 16:00
|
|
User rating: 2
Joined: Thu 01 Mar, 2012, 17:17 Posts: 42
|
Hi Support,
Many thanks for this. It's really helpful, and subscribing to the range bar feed worked fine for me even in the Historical Tester with the incoming bars set to 10 sec (although not for some reason if they were set to single ticks).
Talking of indicators, though, I'd really appreciate any clues you can give me as to why the code for the MACD in the attached strategy isn't working, and why the code for an EMA (which does work) fails if the code 'EMA.setOptInputParameter(1, 12);' at line 53 is enabled.
Thanks a lot,
Bunyip
Attachments: |
BarRetrievalStrategy3.java [7.17 KiB]
Downloaded 534 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: Problems retrieving history with range bars |
Post rating: 0
|
Posted: Tue 27 Mar, 2012, 08:14
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
bunyip wrote: Talking of indicators, though, I'd really appreciate any clues you can give me as to why the code for the MACD in the attached strategy isn't working - There is no necessity to calculate the indicator on array if you use the actual price feed, consider using methods that use the IFeedDescriptor already:
https://www.dukascopy.com/wiki/#Indicato ... price_feed Maybe try the following example, by changing the parameter - indName = "MACD: https://www.dukascopy.com/wiki/#Calculat ... _on_a_feed And then simplify the indicator call like in the next example. - Also there is no necessity to call the indicators from within the feed, you just need to subscribe to it and you might just leave the IRangeBarFeedListener.onBar method empty.
bunyip wrote: why the code for an EMA (which does work) fails if the code 'EMA.setOptInputParameter(1, 12);' at line 53 is enabled. This is because EMA has only 1 optional input. Try EMA with the following example: https://www.dukascopy.com/wiki/#Indicator_metadata/Retrieve_optional_input_value_ranges
|
|
|
|
 |
bunyip
|
Post subject: Re: Problems retrieving history with range bars |
Post rating: 0
|
Posted: Tue 27 Mar, 2012, 15:49
|
|
User rating: 2
Joined: Thu 01 Mar, 2012, 17:17 Posts: 42
|
Thanks very much for your help. It's greatly appreciated!
Sadly, though, I still don't seem to be having much luck. If I change the code for the EMA to 'EMA.setOptInputParameter(0, 12);', which I take it should set the only input parameter (length) to 12, it still makes the code fail if it's enabled.
And if I try running either FeedsMinMaxIndicator.java or CalculateParticularIndicator.java from the two other wiki entries you mention, I get a printout for just one bar (which gives the wrong figures in the case of the MinMax) followed by nothing, either in the Historical Tester or in Demo (or indeed when I try to import their code into the strategy I attached above).
Is there something I haven't understood, or is there a setting in my JForex installation I should change? I'm using JForex 2.6.60.1. I'm really sorry to keep bothering you, but I'd very much like to get this sorted out.
Thanks a lot,
Bunyip
|
|
|
|
 |
API Support
|
Post subject: Re: Problems retrieving history with range bars |
Post rating: 0
|
Posted: Wed 28 Mar, 2012, 11:18
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
bunyip
|
Post subject: Re: Problems retrieving history with range bars |
Post rating: 0
|
Posted: Wed 28 Mar, 2012, 19:10
|
|
User rating: 2
Joined: Thu 01 Mar, 2012, 17:17 Posts: 42
|
Thank you so much! A purpose-built strategy is fantastic!
But much as I would like to, I *still* can't make it work. When I run the MacdEmaOnFeed.java on a demo 5-pip chart, it prints out only a single set of indicator values for the time at which it starts to run and then does nothing (unless of course that's what you wrote it to do--in which case, what I'm afraid I need is a strategy that can get these values for each successive bar). And when I run it on a 5-pip chart in the Historical Tester, it prints a starting time of around 15:00 on the day before I've set, adds a single set of indicator values that aren't correct for that or any other time during the requested period, and then again does nothing on any of the subsequent bars.
I can only think there must be something in my JForex installation that I haven't set right. Do you know of anything that could have this effect? Or could it be because my computer is running under Windows XP? Whatever it is, I'd really appreciate your help in getting it sorted out.
Many many thanks,
Bunyip
|
|
|
|
 |
API Support
|
Post subject: Re: Problems retrieving history with range bars |
Post rating: 0
|
Posted: Thu 29 Mar, 2012, 10:59
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
bunyip wrote: When I run the MacdEmaOnFeed.java on a demo 5-pip chart, it prints out only a single set of indicator values for the time at which it starts to run and then does nothing (unless of course that's what you wrote it to do--in which case, what I'm afraid I need is a strategy that can get these values for each successive bar) This is as designed. If you wish to do calculations on every range bar, then move the logic to the IRangeBarListener.onBar method. bunyip wrote: And when I run it on a 5-pip chart in the Historical Tester, it prints a starting time of around 15:00 We received: 2012-03-29 09:56:23 Last range bar start time: 23:54:30.000 which seems correct. Please provide more precise case of your Historical Tester settings.
|
|
|
|
 |
bunyip
|
Post subject: Re: Problems retrieving history with range bars |
Post rating: 0
|
Posted: Thu 29 Mar, 2012, 20:22
|
|
User rating: 2
Joined: Thu 01 Mar, 2012, 17:17 Posts: 42
|
I really appreciate your help in getting this sorted out—it’s great!
So I’ve moved the logic to the IRangeBarListener.onBar method, as you suggested, and when I run the resulting strategy (attached) on a 5-pip Demo chart (starting at 14:31:58 chart time today), it does indeed print out values for each bar, which is splendid! But alas there are still two problems:
1) While the chart and the printout show exactly the same opening time and price for each bar, they show different indicator values (e.g. on the 14:41:38 bar, the EMA values on the chart are [9] 63.0 [8] 63.7 [7] 65.3 [6] 66.5 [5] 68.4 [4] 69.9 [3] 70.7 [2] 71.0 [1] 71.9 [0] 73.2, whereas the printout shows [9] 63.9 [8] 65.6 [7] 66.8 [6] 68.8 [5] 70.5 [4] 71.5 [3] 71.9 [2] 72.9 [1] 74.5 [0] 75.6, and there are similar discrepancies on the MACD)
2) [Moved to another topic]
And with the Historical Tester, the results are even stranger. Running the strategy on a 5-pip chart for 29 – 30 Nov 2011 and accepting every tick, the first bar printed out is at 28 Nov 23:48:30.000, at which point the indicator values exactly match those on the chart. But as time goes on, the bars in the printout begin to diverge from those on the chart, so that the chart and the printout eventually show different numbers of bars. By the 00:20:47 bar, for instance, the chart shows 10 bars in the same timespan that the printout shows 8 (the 00:20:47 bar opens at 1.32871 on the chart, preceded by 00:18:57 (1.32923), 00:16:45 (1.32885), 00:12:10 (1.32915), 00:11:43 (1.32865), 00:11:25 (1.32914), 00:10:51 (1.32967), 00:08:27 (1.33018), 00:03:38 (1.33040) and 00:00:42 (1.33060), whereas the last bar in the printout is at 00:18:30, opening at 1.32923, and is preceded by 00:16:30 (1.32870), 00:12:30 (1.32934), 00:11:30 (1.32863), 00:10:30 (1.32946), 00:08:30 (1.33008), 00:03:30 (1.33040) and 00:00:30 (1.33057)).
I can’t imagine what could cause these anomalies, but any help you can give me in getting it all to work properly would be fantastic!
Many many thanks,
Bunyip
Attachments: |
MacdEmaOnFeed2.java [7.17 KiB]
Downloaded 559 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.
|
|
|
|
|
 |
bunyip
|
Post subject: Re: JFOREX-3669 Problems retrieving history with range bars |
Post rating: 0
|
Posted: Sun 01 Apr, 2012, 19:08
|
|
User rating: 2
Joined: Thu 01 Mar, 2012, 17:17 Posts: 42
|
Just to follow up a bit, the received bars and the indicator values exactly match those on the chart when the code is set to use 1 pip range bars and applied to a 1 pip chart in the Historical Tester (using all ticks), but I can’t get a match otherwise.
|
|
|
|
 |
accord50
|
Post subject: JFOREX-3669 Indicator for Renko |
Post rating: 0
|
Posted: Mon 02 Apr, 2012, 15:20
|
|
User rating: 0
Joined: Thu 24 Nov, 2011, 14:24 Posts: 14 Location: Ukraine, Dnipro
|
On your advice, I wrote a program for Renco 3 Pip and indicators SUM(14) and PCHANNEL(2). But I can see that the values of indicators are similar, but not at all correspond to the values of indicators on the screen platform. Could you give some advice, whether I'm doing in the program?
Attachments: |
MaStrategia_Renko_ish1.java [3.35 KiB]
Downloaded 576 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: JFOREX-3669 Indicator for Renko |
Post rating: 0
|
Posted: Tue 03 Apr, 2012, 10:51
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
This is because the chart renko feed slightly differs from the one used in history and indicators. This will get fixed as soon as available.
|
|
|
|
 |
bunyip
|
Post subject: Re: JFOREX-3669 Problems retrieving history with range bars |
Post rating: 0
|
Posted: Tue 03 Apr, 2012, 11:20
|
|
User rating: 2
Joined: Thu 01 Mar, 2012, 17:17 Posts: 42
|
Hi Support,
Many thanks for taking the problem so seriously. I know it's often hard to say, but do you have any idea how long it's likely to take to get it fixed?
Thanks a lot,
Bunyip
|
|
|
|
 |
accord50
|
Post subject: Re: JFOREX-3669 Indicator for Renko |
Post rating: 0
|
Posted: Tue 03 Apr, 2012, 15:05
|
|
User rating: 0
Joined: Thu 24 Nov, 2011, 14:24 Posts: 14 Location: Ukraine, Dnipro
|
Additionally, I see that the change of tBar=lastRangeBar.getTime() does not correspond to the appearance of new bars on the graph of platform.
|
|
|
|
 |
bunyip
|
Post subject: Re: JFOREX-3669 Indicator for Renko |
Post rating: 0
|
Posted: Thu 05 Apr, 2012, 12:00
|
|
User rating: 2
Joined: Thu 01 Mar, 2012, 17:17 Posts: 42
|
Hi Support,
I don't know if this is part of the previous bug and so belongs under this thread, or a new one; if it's the later, please feel free to move it to a new thread.
But I've noticed that if you take the earlier strategy (MacdEmaOnFeed2) running on 1 pip bars (which is the only way it now gives accurate results) and add two lines to print out details for the bar before the last one (see the attached code), what it actually prints is the bar before that (i.e. the code asks for the bar with shift 1, and what you get is the bar with shift 2).
For what it's worth, it's also remarkably slow. Even if you comment out all the code to calculate and print the indicators, it takes roughly three seconds per bar with the speed set on max, compared to the tens of bars per second you get without the 'context.subscribeToRangeBarFeed' block.
Many thanks for your help with all this; I hope it can be sorted out soon.
Bunyip
Attachments: |
MacdEmaOnFeed3.java [7.41 KiB]
Downloaded 474 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: JFOREX-3669 Indicator for Renko |
Post rating: 0
|
Posted: Thu 05 Apr, 2012, 16:08
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
bunyip wrote: For what it's worth, it's also remarkably slow. Even if you comment out all the code to calculate and print the indicators, it takes roughly three seconds per bar with the speed set on max, compared to the tens of bars per second you get without the 'context.subscribeToRangeBarFeed' block. This will get fixed with the following release. accord50 wrote: On your advice, I wrote a program for Renco 3 Pip and indicators SUM(14) and PCHANNEL(2). But I can see that the values of indicators are similar, but not at all correspond to the values of indicators on the screen platform. This is because of different candle generation algorithm for charts and feed, see: viewtopic.php?f=65&t=47024&p=63158
|
|
|
|
 |
accord50
|
Post subject: Re: JFOREX-3669 Indicator for Renko |
Post rating: 0
|
Posted: Fri 13 Apr, 2012, 13:23
|
|
User rating: 0
Joined: Thu 24 Nov, 2011, 14:24 Posts: 14 Location: Ukraine, Dnipro
|
Hello support.
In my strategy, I normally get the time of the last renkobar_0 (page1), but for this bar indicator SUM(10) values are calculated with the shift. In a report published this values corresponding to the renkobar_3 - sum[1] (page2) and renkobar_4 - sum[0] (page3). See the file "Pages of Renko.doc".
This is so, and should it be? On screen of platform everything is fine.
Attachments: |
Pages of Renko.doc [326 KiB]
Downloaded 508 times
|
Strategia_Renko1.java [2.98 KiB]
Downloaded 480 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.
|
|
|
|
|
 |
accord50
|
Post subject: Re: JFOREX-3669 Indicator for Renko |
Post rating: 0
|
Posted: Mon 16 Apr, 2012, 15:29
|
|
User rating: 0
Joined: Thu 24 Nov, 2011, 14:24 Posts: 14 Location: Ukraine, Dnipro
|
Hi, Suppot.
Why is in the program of the previous post,
IRenkoBar lastRenkoBar = history.getRenkoBar(instrument, side, priceRange, shift); tt=lastRenkoBar.getTime(); oo=lastRenkoBar.getOpen():
if shift = 0, we obtain the right tt and oo of renkobar_0. If shift = 1 we obtain tt and oo for renkobar_2 ??? If shift = 2 we obtain tt and oo for renkobar_3 ??? , etc.
How to get tt and oo of renkobar_1 ???
|
|
|
|
 |
API Support
|
Post subject: Re: JFOREX-3669 Indicator for Renko |
Post rating: 0
|
Posted: Mon 16 Apr, 2012, 15:34
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
accord50
|
Post subject: Re: JFOREX-3669 Indicator for Renko |
Post rating: 0
|
Posted: Wed 13 Jun, 2012, 14:55
|
|
User rating: 0
Joined: Thu 24 Nov, 2011, 14:24 Posts: 14 Location: Ukraine, Dnipro
|
Hello support. I see that problemma of my post from April 16, is solved. Thank you. But problemma of my post from April 13 has not been solved. Please tell me, this problemma will be resolved. And also the question: JFOREX-3669 and JFOREX-3778 has been resolved, or when she will be ready?
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|