|
Attention! Read the forum rules carefully before posting a topic.
Submit JForex API bug reports in this forum only. Submit Converter issues in Converter Issues. Off topics are strictly forbidden.
Any topics which do not satisfy these rules will be deleted.
Value to the value in the graph is not stable in the calculation method of SAR |
zhaoju
|
Post subject: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Mon 21 Oct, 2013, 09:37
|
|
User rating: 0
Joined: Thu 29 Aug, 2013, 01:01 Posts: 21 Location: ChinaChina
|
Management, I still have questions about parabolic SAR index, the gold in the spot, cycle is 1 minutes, the use of SAR (0.0024,1) such argument, in my own mobile technology used in the SAR in the strategy, parameters and environment are the same, but found that the numerical calculation is not the same, there are small in many cases, equal to or more than the phenomenon, I am really worried, you don't just give management link, can track the phenomenon, have a look how to solve?
Attachments: |
_03LongOrShortMoveSL.java [11.38 KiB]
Downloaded 310 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.
|
|
|
|
|
|
zhaoju
|
Post subject: Re: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Mon 21 Oct, 2013, 09:38
|
|
User rating: 0
Joined: Thu 29 Aug, 2013, 01:01 Posts: 21 Location: ChinaChina
|
Correction of SAR parameters are 0.0024 and 0.1
|
|
|
|
|
zhaoju
|
Post subject: Re: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Mon 21 Oct, 2013, 09:48
|
|
User rating: 0
Joined: Thu 29 Aug, 2013, 01:01 Posts: 21 Location: ChinaChina
|
According to the calculation and drawing on the track could not find the same value
Attachments: |
sar_02.JPG [293.75 KiB]
Downloaded 312 times
|
sar_01.JPG [78.7 KiB]
Downloaded 334 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: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Mon 21 Oct, 2013, 10:07
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
|
tcsabina
|
Post subject: Re: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Mon 21 Oct, 2013, 20:04
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
This strategy should give you the proper values, but you have to set chart filter accordingly: in the strategy Filter.WEEKENDS is used, so you have to set that for the charts (Tools->Preferences->Chart->Chart Filtatrion). package jforex;
import java.util.*; import java.text.SimpleDateFormat;
import com.dukascopy.api.*;
public class SAR_Value_onBar implements IStrategy { private IEngine engine; private IConsole console; private IHistory history; private IContext context; private IIndicators indicators; private IUserInterface userInterface; private SimpleDateFormat sdf;
@Configurable("Instrument") public Instrument selectedInstrument = Instrument.EURUSD; @Configurable("Period") public Period selectedPeriod = Period.ONE_MIN; @Configurable("Indicator Filter") public Filter indicatorFilter = Filter.WEEKENDS; public void onStart(IContext context) throws JFException { this.engine = context.getEngine(); this.console = context.getConsole(); this.history = context.getHistory(); this.context = context; this.indicators = context.getIndicators(); this.userInterface = context.getUserInterface(); sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); }
public void onAccount(IAccount account) throws JFException { }
public void onMessage(IMessage message) throws JFException { }
public void onStop() throws JFException { }
public void onTick(Instrument instrument, ITick tick) throws JFException { } public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException { if ( (instrument.equals(selectedInstrument)) && (period.equals(selectedPeriod))) { double SAR[] = indicators.sar(instrument, period, OfferSide.BID, 0.0024, 0.1, indicatorFilter, 1, bidBar.getTime(), 0); console.getOut().println(sdf.format(bidBar.getTime()) + " - SAR[0]: " + SAR[0]); } } }
|
|
|
|
|
zhaoju
|
Post subject: Re: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Tue 22 Oct, 2013, 02:50
|
|
User rating: 0
Joined: Thu 29 Aug, 2013, 01:01 Posts: 21 Location: ChinaChina
|
Dear tcsabina, thank you so much, I am now in the test, there are problems I will advice you, thank you!
|
|
|
|
|
zhaoju
|
Post subject: Re: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Tue 22 Oct, 2013, 08:47
|
|
User rating: 0
Joined: Thu 29 Aug, 2013, 01:01 Posts: 21 Location: ChinaChina
|
Dear tcsabina, bother you, this is my 1 minutes golden template, the calculation of the tracking this strategy you, begin very normal, calculated in real time in late a time interval, and this can be, but continue to track down and found the data will have some changes, especially after inversion track, especially serious inconsistent with the SAR locus in the chart, please have a look at what good solution, thank you!
Attachments: |
File comment: 只是模板
1min.tmpl [38.06 KiB]
Downloaded 370 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.
|
|
|
|
|
|
zhaoju
|
Post subject: Very badly in need of help, I'm crazy SAR |
Post rating: 0
|
Posted: Tue 22 Oct, 2013, 18:23
|
|
User rating: 0
Joined: Thu 29 Aug, 2013, 01:01 Posts: 21 Location: ChinaChina
|
Management: Hello, please carefully check the SAR function, I had this crazy, I use wiki demo, you give the link "https://www.dukascopy.com/wiki/#Indicator_usage_checklist", using the "CalculateIndicatorsFromChart.java" demo, but also is an incorrect calculation, when the value of SAR in (0.0024,0.1), here are my 2 strategy and screenshots and a gold 1 minutes template, you don't just give a link, I mean not only pay attention to the last value is different, in fact, the calculated SAR value and SAR value in the chart trajectory is easy to change, I was this crazy!!!!! Please help me, I rely on the mobile stop!!!!
Attachments: |
sar001.JPG [349.44 KiB]
Downloaded 299 times
|
SAR_Value_onBar.jfx [3.61 KiB]
Downloaded 280 times
|
CalculateIndicatorsFromChart.java [3.67 KiB]
Downloaded 298 times
|
File comment: Gold one_min.tmpl
1min.tmpl [14.39 KiB]
Downloaded 337 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.
|
|
|
|
|
|
tcsabina
|
Post subject: Re: Very badly in need of help, I'm crazy SAR |
Post rating: 0
|
Posted: Tue 22 Oct, 2013, 19:24
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
I reply here, as here you have the screenshot. 2 things to mention: 1) You are comparing not the same bar's SAR value. What you see on the right side of the chart (1340.203) is the current bar's SAR value. This value (1340.203) is for bar of 2013.10.22-17:12 (on 1M chart). The values that are shown on the different consoles (1340.576...) of the strategies are for a bar earlier, 2013.10.22-17:11. 2) What I don't understand is why was this value (1340.576...) calculated? As if I just check now what is the SAR value of the bar of 2013.10.22-17:11 (on M1 chart), I see 1340.191. If I run the sample strategy I posted on the Historical Tester, I also see this particular value: 2013-10-22 18:09:15 2013-10-22_17:16:00.000 - SAR[0]=1340.25149 2013-10-22 18:09:15 2013-10-22_17:15:00.000 - SAR[0]=1340.23948 2013-10-22 18:09:15 2013-10-22_17:14:00.000 - SAR[0]=1340.22741 2013-10-22 18:09:15 2013-10-22_17:13:00.000 - SAR[0]=1340.21528 2013-10-22 18:09:15 2013-10-22_17:12:00.000 - SAR[0]=1340.20310 2013-10-22 18:09:15 2013-10-22_17:11:00.000 - SAR[0]=1340.19085 //<-- this is it 2013-10-22 18:09:15 2013-10-22_17:10:00.000 - SAR[0]=1340.17855 2013-10-22 18:09:15 2013-10-22_17:09:00.000 - SAR[0]=1340.16618 2013-10-22 18:09:15 2013-10-22_17:08:00.000 - SAR[0]=1340.15376 2013-10-22 18:09:15 2013-10-22_17:07:00.000 - SAR[0]=1340.14128 2013-10-22 18:09:15 2013-10-22_17:06:00.000 - SAR[0]=1340.12873 2013-10-22 18:09:15 2013-10-22_17:05:00.000 - SAR[0]=1340.11613 2013-10-22 18:09:15 2013-10-22_17:04:00.000 - SAR[0]=1340.10346 2013-10-22 18:09:15 2013-10-22_17:03:00.000 - SAR[0]=1340.09074 2013-10-22 18:09:15 2013-10-22_17:02:00.000 - SAR[0]=1340.07795
So I don't know why was the strategy giving you this other, 1340.576 value. I cannot replicate that value. Maybe it is wise to clean the cache of the platform's instrument data: Tools->Preferences->Advanced: Delete saved cache files. After that run the strategy again. You can run it on the Historical Tester, or run it live, it should give you the correct SAR values. But keep in mind what do you compare! That is why there is a timestamp on every line that the strategy prints to the console. To make it easy to see, which bar's value is being displayed. I hope this helps.
|
|
|
|
|
zhaoju
|
Post subject: Re: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Wed 23 Oct, 2013, 07:12
|
|
User rating: 0
Joined: Thu 29 Aug, 2013, 01:01 Posts: 21 Location: ChinaChina
|
Just when the operation is very good, but a long time, especially the money to start the fluctuations increase after these values began to go wrong!Please continue to track down!
Attachments: |
sar003.JPG [458.25 KiB]
Downloaded 310 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.
|
|
|
|
|
|
tcsabina
|
Post subject: Re: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Wed 23 Oct, 2013, 20:16
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
Hi,
Sorry to say, but this is above my knowledge. I don't know why is that happening... It looks like that SAR is recalculating previous bars' values, but as far as I know, SAR is not an indicator like that.
Wait for Support (or maybe someone else from the forum?) to reply.
|
|
|
|
|
API Support
|
Post subject: Re: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Thu 24 Oct, 2013, 16:00
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
This is due to the fact that the SAR indicator is recalculate all - hence it needs more values for the calculation - for this case we are going to update the documentation and the examples soon. Consider calculating the on-chart SAR for XAU/USD in the following way: @Configurable("") public int dataCount = 10; @Configurable("") public int reacalcAllBuffer = 100;
@Override public void onStart(IContext context) throws JFException { indicators = context.getIndicators(); history = context.getHistory(); console = context.getConsole(); chart = context.getLastActiveChart(); if (chart == null) { console.getErr().println("No chart opened!"); return; } IFeedDescriptor feedDescriptor = chart.getFeedDescriptor(); if(feedDescriptor.getDataType() == DataType.TICKS){ console.getWarn().println("Tick charts need to get calculate with from-to method"); return; } for (IIndicatorAppearanceInfo info : chart.getIndicatorApperanceInfos()) { AppliedPrice[] appliedPrices = new AppliedPrice[info.getDrawingStyles().length]; Arrays.fill(appliedPrices, AppliedPrice.CLOSE); OfferSide[] offerSides = new OfferSide[info.getDrawingStyles().length]; Arrays.fill(offerSides, chart.getSelectedOfferSide()); IIndicator indicator = indicators.getIndicator(info.getName()); ITimedData feedData = history.getFeedData(feedDescriptor, 0); int candlesBefore = indicator.getIndicatorInfo().isRecalculateAll() ? reacalcAllBuffer + dataCount : dataCount; Object[] result = indicators.calculateIndicator(feedDescriptor, offerSides, info.getName(), appliedPrices, info.getOptParams(), candlesBefore, feedData .getTime(), 0); for (int i = 0; i < indicator.getIndicatorInfo().getNumberOfOutputs(); i++) { OutputParameterInfo.Type outputType = indicator.getOutputParameterInfo(i).getType(); String resultStr = outputType == OutputParameterInfo.Type.DOUBLE ? arrayToString((double[]) result[i], candlesBefore - dataCount) : outputType == OutputParameterInfo.Type.INT ? Arrays.toString((int[]) result[i]) : "object outputs need special processing"; console.getOut().format("%s %s last %s values: %s", info.getName(), indicator.getOutputParameterInfo(i).getName(), dataCount, resultStr).println(); }
} context.stop(); } private static String arrayToString(double[] arr, int from) { StringBuffer sb = new StringBuffer(); for (int r = from; r < arr.length; r++) { sb.append(String.format("[%s] %.3f; ", r, arr[r])); } return sb.toString(); }
Attachments: |
CalculateIndicatorsFromChartRecalcAll.java [4.23 KiB]
Downloaded 315 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.
|
|
|
|
|
|
tcsabina
|
Post subject: Re: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Thu 24 Oct, 2013, 16:10
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
Oh nice, so it is repainting
|
|
|
|
|
zhaoju
|
Post subject: Re: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Fri 25 Oct, 2013, 06:42
|
|
User rating: 0
Joined: Thu 29 Aug, 2013, 01:01 Posts: 21 Location: ChinaChina
|
Today testing methodology for calculating trajectory with tcsabina very high degree of coincidence, really happy, I hope to continue.
|
|
|
|
|
zhaoju
|
Post subject: Re: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Fri 25 Oct, 2013, 10:09
|
|
User rating: 0
Joined: Thu 29 Aug, 2013, 01:01 Posts: 21 Location: ChinaChina
|
|
|
|
|
zhaoju
|
Post subject: Re: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Fri 25 Oct, 2013, 15:42
|
|
User rating: 0
Joined: Thu 29 Aug, 2013, 01:01 Posts: 21 Location: ChinaChina
|
API Support, Hello, thank you very much for your guidance, run your modifications, it was on, but I would like to ask if the add in their own strategy, rather than rely on chart, for example, I want to run on the remote service, and how to write the SAR? Please trouble you
|
|
|
|
|
API Support
|
Post subject: Re: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Fri 25 Oct, 2013, 15:46
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
You calculate SAR just as any other indicator, simply calculate it over some extra 100 candles.
|
|
|
|
|
zhaoju
|
Post subject: Re: Value to the value in the graph is not stable in the calculation method of SAR |
Post rating: 0
|
Posted: Fri 25 Oct, 2013, 16:47
|
|
User rating: 0
Joined: Thu 29 Aug, 2013, 01:01 Posts: 21 Location: ChinaChina
|
double SAR[] = indicators.sar(instrument, period, OfferSide.BID, 0.0024, 0.1, indicatorFilter, 110, bidBar.getTime(), 0); console.getOut().println(sdf.format(bidBar.getTime()) + " - SAR[109]: " + SAR[109]); it's ok?
|
|
|
|
|
|
Pages: [
1
]
|
|
|
|
|