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.

Newbie needs help with first indicator
 Post subject: Newbie needs help with first indicator Post rating: 0   New post Posted: Sat 13 Apr, 2013, 18:54 

User rating: 0
Joined: Sat 06 Apr, 2013, 19:12
Posts: 4
Location: UkraineUkraine
jForex documentation is huge, technically correct, but it is absolutely useless to understand some basic things from scratch. Here's a simple problem in simple indicator: the input - two sources Ask and Bid, output graph - average price of bar's High and Low. I guess that calcultae is called for each source separately, but why debug printing for the first source of startindex and endindex is correct but for the second - is not? How do I understand for which of the sources calculate is called when it calulated? What is wrong with this code?
I would be grateful for any help, especially for the links (except dukascopy wiki) where in normal words described basic objects of jForex, how do they intaeracts one with another and in what sequence.


Attachments:
SimpleIndicator.java [8.87 KiB]
Downloaded 326 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.
 
 Post subject: Re: Newbie needs help with first indicator Post rating: 0   New post Posted: Mon 15 Apr, 2013, 08:13 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
zencoder wrote:
why debug printing for the first source of startindex and endindex is correct but for the second - is not?
What do you mean by "correct"? What do you find being incorrect and what the values should be instead?
zencoder wrote:
How do I understand for which of the sources calculate is called when it calulated?
Please elaborate.


 
 Post subject: Re: Newbie needs help with first indicator Post rating: 0   New post Posted: Mon 15 Apr, 2013, 08:55 

User rating: 0
Joined: Sat 06 Apr, 2013, 19:12
Posts: 4
Location: UkraineUkraine
as I expected, I have 2 input and each of them must have some data. in method calculate I print its start and end indexes values. in first call (for the 1-st input??) i get 0 3999 and in a second call (for the second input??) - 0 0. When I print last known time for bouth inputs, I got different values, with difference in a days!!
So, in my code I have 2 inputs. I want to know for which of one of them was called method calculate and why start and end indexes is different for them.


 
 Post subject: Re: Newbie needs help with first indicator Post rating: 0   New post Posted: Mon 15 Apr, 2013, 09:18 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
zencoder wrote:
in first call (for the 1-st input??) i get 0 3999 and in a second call (for the second input??) - 0 0.
This is by design - the platform passes as many inputs as it finds necessary. This is not the "first"/"second" input, but both at the time - the calculate call which by default happens on every tick or when there is a change on chart. You can determine minimum input count that you receive by increasing the getLookback value, see:
https://www.dukascopy.com/wiki/#IIndicator_interface/Method_getLookback
zencoder wrote:
When I print last known time for bouth inputs, I got different values, with difference in a days!!
If you receive input values for the last 4000 candles on chart then depending on period it could even be months of years.
zencoder wrote:
So, in my code I have 2 inputs. I want to know for which of one of them was called method calculate and why start and end indexes is different for them.
You need to calcuate both outputs in the same calculate call. You can use as an example for multi-output indicator the AwesomeOscillator indicator and for multi-input - the ForceIndicator, see:
https://www.dukascopy.com/wiki/#Platform_indicator_source_files


 
 Post subject: Re: Newbie needs help with first indicator Post rating: 0   New post Posted: Mon 15 Apr, 2013, 10:03 

User rating: 0
Joined: Sat 06 Apr, 2013, 19:12
Posts: 4
Location: UkraineUkraine
API Support wrote:
the last 4000 candles on chart then depending on period it could even be months of years.

I see.... but in my exaple this 2 inputs is Ask and Bid IBars for the same period of the same chart. difference for a seconds I can understand... but days on ticks - unbelivable :(
There is some error in my source code or may be in my understanding of basic mechanism how platform is realy working is wrong.
Is there any document, where I can read words like "after recieving new tick, new data stored will be in AAAA array, then platform calling method BBBBB, which must return CCCCC result...."


 
 Post subject: Re: Newbie needs help with first indicator Post rating: 0   New post Posted: Mon 15 Apr, 2013, 11:49 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
zencoder wrote:
Is there any document, where I can read words like "after recieving new tick, new data stored will be in AAAA array, then platform calling method BBBBB, which must return CCCCC result...."
The documentation is javadocs and wiki. For example indicators see the platform indicator sources and the forum Code Base/Indicators. To better understand how the indicator works - input, output sizes, lookback, indices, etc. - conisder adding additional logging statements in the calculate method, for example as it is done in the HolderTestLog.java example here:
viewtopic.php?f=65&t=48828&p=69618


 
 Post subject: Re: Newbie needs help with first indicator Post rating: 0   New post Posted: Mon 15 Apr, 2013, 13:39 

User rating: 0
Joined: Sat 06 Apr, 2013, 19:12
Posts: 4
Location: UkraineUkraine
thanks a lot, but... "study by example" is works fine in many, but not in all cases :(
just imagine that you said same words to the newbie trader - look like your boss is trading and trade youself just like him! What do you think will learn newbie? How to push buttons? - yes! Stable and profitable trading? - never. Examples of other people's codes will never replace proper documentation. Unfortunately your wiki - is a reference book (some kind list) of the objects and their methods, but not a documentation how to use them together.
Ok. I will try to learn something by myself...

P.S. There was useless thread. I do not mind if you delete it.


 
 Post subject: Re: Newbie needs help with first indicator Post rating: 1   New post Posted: Tue 16 Apr, 2013, 12:06 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
ZENcoder,
The path has been shown.
It is YOU, who has to walk on it.


 
 Post subject: Re: Newbie needs help with first indicator Post rating: 0   New post Posted: Tue 16 Apr, 2013, 12:18 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please use https://www.dukascopy.com/swiss/english/forex/Visual/features/


 

Jump to:  

cron
  © 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