Dukascopy
 
 
Wiki JStore Search Login

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.

How to use S&R indicator from one timeframe on another
 Post subject: How to use S&R indicator from one timeframe on another Post rating: 0   New post Posted: Thu 14 Feb, 2013, 09:04 

User rating: 0
Joined: Thu 19 Jul, 2012, 09:21
Posts: 18
Location: Poland, Warsaw
Hello,

I need S&R indicator form H1 timeframe on m30 timeframe.
But after compiling this line:
IIndicatorsProvider indicatorsProvider = context.getIndicatorsProvider();
srIndicator = indicatorsProvider.getIndicator("S&R");


I get error. Maybe it's a wrong name or something else.
Please support, help me.


 
 Post subject: Re: How to use S&R indicator from one timeframe on another Post rating: 0   New post Posted: Thu 14 Feb, 2013, 09:14 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
andymen wrote:
But after compiling this line:
Please provide full source code of an example indicator which replicates the issue.
andymen wrote:
Please support, help me.
Please specify the error.


 
 Post subject: Re: How to use S&R indicator from one timeframe on another Post rating: 0   New post Posted: Thu 14 Feb, 2013, 09:35 

User rating: 0
Joined: Thu 19 Jul, 2012, 09:21
Posts: 18
Location: Poland, Warsaw
This is error after compiling source code:
08:19:46 ----------
08:19:46 srIndicator cannot be resolved
08:19:46 ^^^^^^^^^^^
08:19:46 srIndicator = indicatorsProvider.getIndicator("S&R");
08:19:46 1. ERROR in C:\Users\andymen\AppData\Local\Temp\jfxide\tmp\compile\SRm30.java (at line 17)
08:19:46 ----------
08:19:45 Compiling SRm30.java


I've just started writting this indicator and that's why this code is so short.
Base code is form tutorial on wiki website and I added only few lines.

I hope this is helpfull


Attachments:
SRm30.java [2.97 KiB]
Downloaded 295 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.
 
The Best Answer  Post subject: Re: How to use S&R indicator from one timeframe on another Post rating: 0   New post Posted: Thu 14 Feb, 2013, 09:52 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You have not defined the variable type. Consider using some IDE like Eclipse or Netbeans for writing your code, such that you can receive immediate fix suggestions, see:
https://www.dukascopy.com/wiki/#Use_in_Eclipse


 
 Post subject: Re: How to use S&R indicator from one timeframe on another Post rating: 0   New post Posted: Thu 14 Feb, 2013, 11:03 

User rating: 0
Joined: Thu 19 Jul, 2012, 09:21
Posts: 18
Location: Poland, Warsaw
Thank you for help. I've fixed this, but it's another problem.
This exception is thrown continously:
Quote:
09:47:24 Error in indicator: java.lang.ArrayIndexOutOfBoundsException: 1 @ jforex.SRm30.calculate(SRm30.java:40)
09:47:24 Error in indicator: java.lang.ArrayIndexOutOfBoundsException: 1 @ jforex.SRm30.calculate(SRm30.java:40)
09:47:24 Error in indicator: java.lang.ArrayIndexOutOfBoundsException: 1 @ jforex.SRm30.calculate(SRm30.java:40)
09:47:23 Error in indicator: java.lang.ArrayIndexOutOfBoundsException: 1 @ jforex.SRm30.calculate(SRm30.java:40)
09:47:22 Error in indicator: java.lang.ArrayIndexOutOfBoundsException: 1 @ jforex.SRm30.calculate(SRm30.java:40)
09:47:21 Error in indicator: java.lang.ArrayIndexOutOfBoundsException: 1 @ jforex.SRm30.calculate(SRm30.java:40)

I think it's caused by
timePeriod
variable, but I don't know how is computed S&R indicator.
Could you send me some descritpion of this indicator?
I know that function compute() takes 2 int arguments but what are they?


 
 Post subject: Re: How to use S&R indicator from one timeframe on another Post rating: 0   New post Posted: Thu 14 Feb, 2013, 12:53 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please provide the source code of your example indicator.


 
 Post subject: Re: How to use S&R indicator from one timeframe on another Post rating: 0   New post Posted: Fri 15 Feb, 2013, 12:27 

User rating: 0
Joined: Thu 19 Jul, 2012, 09:21
Posts: 18
Location: Poland, Warsaw
API Support wrote:
Please provide the source code of your example indicator.

I need to use S&R indicator from JForex but I want to draw dots from H1 timeframe on m30.
Please feed me back information about an used algorithm to calculate this dots or what are function parameters in
IndicatorResult calculate(int arg0, int arg 1)

All I know is a fact that S&R indicator is not using any timeframe parameter but I need do overload function calculate() or write my own version based on algorithm used in S&R indicator.
Maybe my thinking is wrong and there is a better solution of my problem.
Please help.


 
 Post subject: Re: How to use S&R indicator from one timeframe on another Post rating: 0   New post Posted: Fri 15 Feb, 2013, 12:38 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See:
https://www.dukascopy.com/wiki/#Indicator_calls_other_indicator
https://www.dukascopy.com/wiki/#Indicator_that_uses_the_output_of_another_indicator


 
 Post subject: Re: How to use S&R indicator from one timeframe on another Post rating: 0   New post Posted: Fri 15 Feb, 2013, 13:00 

User rating: 0
Joined: Thu 19 Jul, 2012, 09:21
Posts: 18
Location: Poland, Warsaw
API Support wrote:


I have read it but the problem in my indicator is timeframe. S&R indicator calculates dots on an active chart window on current timeframe. I don't know any way to change that because if I change timeframe on chart so the indicator changes placement of dots. There's no a parameter like timeframe in a calculate() function.
I repeat that again: I need an algorithm used in S&R or some way of overloading it with a timeframe parameter.
Could you please give me algorithm for S&R or an oveloaded calculate() function with timeframe parameter?


 
 Post subject: Re: How to use S&R indicator from one timeframe on another Post rating: 0   New post Posted: Fri 15 Feb, 2013, 13:06 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
andymen wrote:
Could you please give me algorithm for S&R or an oveloaded calculate() function with timeframe parameter?
You don't need to change the calculate rather, the inputs, such that they work with a certain timeframe, see:
https://www.dukascopy.com/wiki/#Indicator_with_inputs_of_different_periods


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com