|
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.
| Moving Average of any indicator |
|
Guest
|
| Post subject: Moving Average of any indicator |
Post rating: 0
|
Posted: Mon 06 Oct, 2008, 14:19
|
|
User rating: -
|
|
Hello, I need to calculate the moving average of RSI indicator. Your API includes such method ? (I had a look but did not find). Thank you for your answer. R. Varone
|
|
|
|
|
 |
|
API Support
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Tue 07 Oct, 2008, 10:30
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
Hello, This could be a good example of how to write your own indicator. I will post here a code after Friday when new version will be on demo, for now our indicators API misses functionality to call another indicators, but it will be added in next version.
|
|
|
|
|
 |
|
API Support
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Mon 13 Oct, 2008, 12:23
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
As promised, example is in attachment. Indicator has one input, two optional parameters one for RSI and one for SMA, and two outputs, one is RSI output and second is SMA over RSI. Lookback (number of elements that is needed to calculate first value) is a sum of RSI and SMA lookbacks. Example has some comments, but it's easy to understand even without them. To be able to see it on chart, you have to open it in Services node in workspace tree, compile it and enable. Then you add it on chart as any other indicator. To call it from strategy you need to use one of the IIndicators.calculateIndicator methods: IIndicators indicators = context.getIndicators(); indicators.calculateIndicator(Instrument.EURUSD, Period.TEN_SECS, new OfferSide[] {OfferSide.BID}, "SMA_RSI", new IIndicators.AppliedPrice[] {IIndicators.AppliedPrice.CLOSE}, new Object[] {14, 14}, 1);
| Attachments: |
SMAOverRSIIndicator.java [4.94 KiB]
Downloaded 1035 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.
|
|
|
|
|
|
 |
|
[vish]
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Wed 14 Jan, 2009, 00:55
|
|
User rating: 0
Joined: Wed 24 Dec, 2008, 18:49 Posts: 10
|
|
I am looking for some broader documentation to understand the logic that governs the calculations.
in MT, iirc , the function the indicators may be calculated just for the new bar, (i.e. when it is first run all bars are calculated, but afterwards, you may get an indication to the number of bars that were updated, and recalculate only the 1 or two last bars ) is this the same logic behind the "calculate(int startIndex, int endIndex) " is the indicator recalculated over all data? is it calculated once for each bar at the close ?
so like i was saying, are there documents broader than the java API , i.e. design documents , program flow description, philosophy, etc.. thanks.
|
|
|
|
|
 |
|
API Support
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Wed 14 Jan, 2009, 09:49
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
Indicators are being calculated over the passed data. The same technique is used in Ta-lib. Please take a look at Ta-lib project.
|
|
|
|
|
 |
|
[vish]
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Wed 14 Jan, 2009, 17:44
|
|
User rating: 0
Joined: Wed 24 Dec, 2008, 18:49 Posts: 10
|
|
i have one service enabled, an indicator and before being passed the values of the chart, it is being passed some other values, >1000 of them
|
|
|
|
|
 |
|
API Support
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Wed 14 Jan, 2009, 18:03
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
Indicator in JForex (at least in it's current implementation) is just a function that calculates result values from passed in input values. JForex decides what data to pass as input, based on indicator description and on it's internal logic (charts that needs to be up to date, even if they are not visible at the moment, strategies that call indicators etc).
|
|
|
|
|
 |
|
API Support
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Wed 14 Jan, 2009, 18:05
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
|
 |
|
[vish]
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Wed 14 Jan, 2009, 22:06
|
|
User rating: 0
Joined: Wed 24 Dec, 2008, 18:49 Posts: 10
|
|
thanks for the link. -- I still haven't figured out who is calling calculate with ~0.98 values, once i do , I'll update this thread.
|
|
|
|
|
 |
|
[vish]
|
| Post subject: WELL, it is the weeks |
Post rating: 0
|
Posted: Thu 15 Jan, 2009, 14:02
|
|
User rating: 0
Joined: Wed 24 Dec, 2008, 18:49 Posts: 10
|
|
the superfluous data being passed is the weekly bars for the EURUSD i don't know why since i only have the 5 minute bar chart open. it is no great hassle but it would be nice to figure out why
|
|
|
|
|
 |
|
API Support
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Thu 15 Jan, 2009, 14:43
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
The platform recalculates indicators in real time for all previously selected periods. It speeds up displaying and processing of any repeated selecting.
|
|
|
|
|
 |
|
[vish]
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Tue 20 Jan, 2009, 18:13
|
|
User rating: 0
Joined: Wed 24 Dec, 2008, 18:49 Posts: 10
|
|
thanks, one more questions .
one, i am having trouble "enabling" one of the indicators I've written it compiles OK, but when i click "enable" i don't get any error messages or the green V icon. (and it isn't added to the my indicators branch when adding and indicator to a chart. )
thanks again
|
|
|
|
|
 |
|
API Support
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Wed 21 Jan, 2009, 08:58
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
After enabling a custom indicator, add this indicator through "Add Indicator" menu. The custom indicator will appear in indicators list under your custom group name.
|
|
|
|
|
 |
|
[vish]
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Wed 21 Jan, 2009, 10:19
|
|
User rating: 0
Joined: Wed 24 Dec, 2008, 18:49 Posts: 10
|
|
ok, solved
after adding the indicator and compiling, i was not able to enable it and saw no error messages,
to view the console, either right click the java icon in the tray, or in the java control panel , enable viewing java console, then you can see the errors
(in case you were curious it was a runtime error in the onstart method)
---- also enabling and disabling indicators that use other user defined indicators should be done in a nested manner. so if indicator A uses indicator B, indicator B must be both enables AND *disabled* before A
---- and while i am at it, another question,
is there an easy way to refresh , other than "close indicator" ,disable, compile, enable, add indicator ? when the file is changed ?
|
|
|
|
|
 |
|
API Support
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Thu 22 Jan, 2009, 12:55
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
We will change this manner.
|
|
|
|
|
 |
|
burton
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Sat 16 Mar, 2013, 18:11
|
|
User rating: 0
Joined: Wed 07 Mar, 2012, 06:02 Posts: 58 Location: SwitzerlandSwitzerland
|
Quote: To be able to see it on chart, you have to open it in Services node in workspace tree, compile it and enable. Then you add it on chart as any other indicator. I compiled this and another .java-indicator but they dont get applied to the chart, should the java-file not be converted into a jfx-file first for the indicator to be recognized as an indicator? I followed it the same way as described in the wiki: https://www.dukascopy.com/wiki/#Convert_an_indicatorI'll be glad for anybody's help on adding the java file to my chart.
|
|
|
|
|
 |
|
API Support
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Mon 18 Mar, 2013, 08:31
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
|
 |
|
burton
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Wed 17 Apr, 2013, 22:36
|
|
User rating: 0
Joined: Wed 07 Mar, 2012, 06:02 Posts: 58 Location: SwitzerlandSwitzerland
|
|
No, that still doesnt do the Job.
Looks like the code code is incomplete or corrupt (e.g. method missing) !?
|
|
|
|
|
 |
|
API Support
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Thu 18 Apr, 2013, 07:22
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
Which example you refer to? Please provide the strategy you run and the error messages you receive.
|
|
|
|
|
 |
|
burton
|
| Post subject: Re: Moving Average of any indicator |
Post rating: 0
|
Posted: Sat 04 May, 2013, 11:59
|
|
User rating: 0
Joined: Wed 07 Mar, 2012, 06:02 Posts: 58 Location: SwitzerlandSwitzerland
|
|
The Java file 'SMAOverRSIIndicator.java' [4.94 KiB] is attached in this thread above. Please test it and you will see there are Errors with methods missing.
|
|
|
|
|
 |
|
Pages: [
1, 2
»
]
|
|
|
|
|