|
Different values for the chart indicator and strategy calculations |
beamlight
|
Post subject: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Mon 11 Feb, 2013, 11:34
|
|
User rating: 0
Joined: Tue 16 Oct, 2012, 13:10 Posts: 17 Location: Russian FederationRussian Federation
|
Hi! I've problem with all my indicators values in strategy, when I looking to the chart all indicators that added from my strategy code have values that significally differs from values calculated by strategy. For example there is a code for adding MA indicator on chart: feedDescriptor = new TimePeriodAggregationFeedDescriptor (instrument, timeframe, offerSide, filter); this.chart = context.openChart(feedDescriptor);
if ( ma3Timeframe == timeframe ) { IIndicator ma3 = indicators.getIndicator("MA"); for (int i = 0; i < ma3.getIndicatorInfo().getNumberOfInputs(); i++) { InputParameterInfo inputParameterInfo = ma3.getInputParameterInfo(i); this.console.getOut ().println ("ma3 inputParameterInfo: " + inputParameterInfo.getName ()); inputParameterInfo.setAppliedPrice (ma3Price); } } this.chart.addIndicator(ma3, new Object[] {ma3Period, ma3Type.ordinal ()}, new Color[]{Color.GREEN}, new DrawingStyle[]{DrawingStyle.LINE}, new int[]{1}); But when the strategy calculates the MA indicator values later in code, I've see the very significant difference in values between chart values and strategy calculations. There is the piece of code, that calculating the values: long time = history.getBar(instrument, ma3Timeframe, offerSide, 0).getTime(); indicators.calculateIndicator(feedDescriptor, new OfferSide[] {offerSide}, "MA", new IIndicators.AppliedPrice[] {ma3Price}, new Object[] {ma3Period, ma3Type.ordinal ()}, 1, time, 0);
ma3Timeframe is the same as chart timeframe. Waiting for your advice.
|
|
|
|
 |
API Support
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Mon 11 Feb, 2013, 11:42
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Did you check that the chart filter matches the one of your feed descriptor (i.e. chart.getFeedDescriptor().getFilter() compare with feedDescriptor.getFilter())? Note that with IContext.openChart, the Filter parameter gets taken not from the passed IFeedDescriptor, but rather the common platform settings (i.e. Tools > Preferences > Chart > Flats Filtration).
|
|
|
|
 |
beamlight
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Thu 07 Mar, 2013, 07:28
|
|
User rating: 0
Joined: Tue 16 Oct, 2012, 13:10 Posts: 17 Location: Russian FederationRussian Federation
|
I've better results with my strategy, but on PERIOD.ONE_MINUTE Timeframe instrument: GBP/USD I got problems: Trendenvelopes indicator on chart and Trendenvelopes indicator calculations providing different values. The Filter is the same for Chart and Strategy: NO_FILTER The TrendEnvelopes indicator is added on chart with code: this.chart.addIndicator(indicators.getIndicator("TRENDENVELOPES"), new Object[] {trendEnvelopesPeriod, trendEnvelopesDeviation}); Than I'm using the Trendenvelopes in calculations: index= 1; long time = history.getBar(instrument, trendEnvelopesTimeframe, offerSide, 0).getTime(); double[][] envelopes = indicators.trendEnv(instrument, trendEnvelopesTimeframe, offerSide, trendEnvelopesPeriod, trendEnvelopesDeviation, filter, 2, time, 0); if ( !Double.isNaN(envelopes[0][index]) && price > envelopes[0][index] ) { envelopesTrailValue = envelopes[0][index]; trendEnvelopesSignal = +1; } else if ( !Double.isNaN(envelopes[1][index]) && price < envelopes[1][index] ) { envelopesTrailValue = envelopes[1][index]; trendEnvelopesSignal = -1; } else trendEnvelopesSignal = 0; And the problem is: I see on the chart that Trendenvelopes has only bottom(blue) line at 1.51000, but in the code I've received that it is switched to top line(yellow), e.g. envelopes[1][index] has some value: 1.53000, but must be: envelopes[0][index] = 1.51000 and envelopes[1][index] = NaN.
|
|
|
|
 |
API Support
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Thu 07 Mar, 2013, 08:37
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
beamlight
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Tue 12 Mar, 2013, 05:08
|
|
User rating: 0
Joined: Tue 16 Oct, 2012, 13:10 Posts: 17 Location: Russian FederationRussian Federation
|
OHLC shows the same as I see on chart, but indicator calculations are different from OHLC and chart values.
|
|
|
|
 |
API Support
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Tue 12 Mar, 2013, 08:17
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
please provide your example strategy which uses the value putting in ohlc and chart feed comparison with the indicator feed.
|
|
|
|
 |
beamlight
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Tue 12 Mar, 2013, 09:28
|
|
User rating: 0
Joined: Tue 16 Oct, 2012, 13:10 Posts: 17 Location: Russian FederationRussian Federation
|
Here is the strategy. The bug was on GBPUSD, M1 timeframe, TrendEnvelopes choosed, MA3, MA4, MA5 disabled, RSI disabled, Stoch disabled, ADX enabled
|
|
|
|
 |
API Support
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Tue 12 Mar, 2013, 09:54
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
By strategy we mean full source code of the example strategy which replicates the case.
|
|
|
|
 |
beamlight
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Wed 13 Mar, 2013, 13:00
|
|
User rating: 0
Joined: Tue 16 Oct, 2012, 13:10 Posts: 17 Location: Russian FederationRussian Federation
|
Here the full source code of the strategy(in attached)
|
|
|
|
 |
API Support
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Wed 13 Mar, 2013, 14:19
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Please provide an example strategy which replicates the case and does not contain any additional logic which is not related to the problem that you reported.
|
|
|
|
 |
beamlight
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Wed 20 Mar, 2013, 05:36
|
|
User rating: 0
Joined: Tue 16 Oct, 2012, 13:10 Posts: 17 Location: Russian FederationRussian Federation
|
Hi! Check attached tiny version of the whole strategy, I've make it as much simple as possible, test it with default params on GBP/USD from 2013.03.05 to 2013.03.06 M1 timeframe. Also check attached screenshot for the issue drawed by red ellipses. The OHLC shows completely different value form strategy calculations. 
Attachments: |
JForex Strategy Issue.png [73.04 KiB]
Downloaded 878 times
|
TrendSarOrMaxTiny.java [14.65 KiB]
Downloaded 447 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.
|
|
|
|
|
 |
beamlight
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Thu 28 Mar, 2013, 06:05
|
|
User rating: 0
Joined: Tue 16 Oct, 2012, 13:10 Posts: 17 Location: Russian FederationRussian Federation
|
When I can get the answer for my previous post from support team???
|
|
|
|
 |
Platform Support
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Wed 03 Apr, 2013, 15:50
|
|
JForex Master |  |
User rating: ∞
Joined: Wed 16 Sep, 2009, 18:23 Posts: 1054 Location: Geneva, Switzerland
|
TrendEnvelopes, when added on chart, gets recalculated on all currently available data (see the description of the "recalculateAll" property for more info: https://www.dukascopy.com/wiki/#Indicato ... icatorInfo). Unlike when it's called from your strategy. This means the calculation results will match only when you compare results calculated on the matching time intervals and the time interval used when calculating from strategy is much shorter.
|
|
|
|
 |
beamlight
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Fri 05 Apr, 2013, 08:49
|
|
User rating: 0
Joined: Tue 16 Oct, 2012, 13:10 Posts: 17 Location: Russian FederationRussian Federation
|
How I can calculate indicator values on all chart bars in the strategy?
|
|
|
|
 |
fxdav
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Wed 10 Apr, 2013, 09:07
|
|
User rating: 0
Joined: Fri 26 Oct, 2012, 10:52 Posts: 1
|
Why does it take so long for each answer? I'd help you, but unfortunately I dont know.
|
|
|
|
 |
Platform Support
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 2
|
Posted: Wed 10 Apr, 2013, 09:37
|
|
JForex Master |  |
User rating: ∞
Joined: Wed 16 Sep, 2009, 18:23 Posts: 1054 Location: Geneva, Switzerland
|
You can calculate on a larger time interval by using 'from', 'to' or 'numberOfCandlesBefore'/'numberOfCandlesAfter' parameters of the indicator calculation methods
|
|
|
|
 |
beamlight
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Wed 15 May, 2013, 06:02
|
|
User rating: 0
Joined: Tue 16 Oct, 2012, 13:10 Posts: 17 Location: Russian FederationRussian Federation
|
How I can get the number of all bars in chart?
|
|
|
|
 |
API Support
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Fri 17 May, 2013, 13:02
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
beamlight
|
Post subject: Re: Different values for the chart indicator and strategy calculations |
Post rating: 0
|
Posted: Thu 30 May, 2013, 06:52
|
|
User rating: 0
Joined: Tue 16 Oct, 2012, 13:10 Posts: 17 Location: Russian FederationRussian Federation
|
I mean how to get all bars that can be rendered on chart, not only visible bars.
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|