Dukascopy
 
 
Wiki JStore Search Login

JFOREX-3714 Usage of CalculateIndicator with pivot
 Post subject: JFOREX-3714 Usage of CalculateIndicator with pivot Post rating: 1   New post Posted: Sun 15 Apr, 2012, 14:06 

User rating: 1
Joined: Sun 29 May, 2011, 00:00
Posts: 2
Location: Switzerland, Flüelen
Hi
I have spent the better part of last week figuring out the calculateIndicator method with all possible parameters. This is the only method that should return the correct values based on your flat filters and bid/ask settings for ANY indicator.

Object[] com.dukascopy.api.IIndicators.calculateIndicator(Instrument instrument, Period period, OfferSide[] side, String functionName, AppliedPrice[] inputTypes, Object[] optParams, Filter filter, int numberOfCandlesBefore, long time, int numberOfCandlesAfter) throws JFException

Let us start with the ICHIMOKU. I called the calculateIndicator method and extracted the last seven bars and then displayed them in raw format.

[0] 1.307490; [1] 1.307490; [2] 1.307490; [3] 1.307510; [4] 1.307620; [5] 1.307640; [6] 1.307645;
[0] 1.307765; [1] 1.307765; [2] 1.307795; [3] 1.307795; [4] 1.307795; [5] 1.307795; [6] 1.307795;
[0] 1.307560; [1] 1.307600; [2] 1.307610; [3] 1.307620; [4] 1.307580; [5] 1.307760; [6] 1.307770;
[0] 1.307628; [1] 1.307628; [2] 1.307642; [3] 1.307652; [4] 1.307708; [5] 1.307718; [6] 1.307720;
[0] 1.307765; [1] 1.307765; [2] 1.307795; [3] 1.307795; [4] 1.307795; [5] 1.307795; [6] 1.307795;

Here are the things that I learnt:
1) the later down the column is, the more current the value
2) each column holds the t,k,c,sa, sb values

I wrote a little method to extract the data as needed and it looks very scary:
return (((double[]) objectArray[ichiName])[nBar]);

the ichiName is a value from 0 to 4 and the nBar is the offset (actually the index of the array)

The best is to run the strategy once and look at the outputs

I also included the pivot indicator and for some reason it only gives me the last values for the support and resistance areas
[0] 1.316763; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
[0] 1.323327; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
[0] 1.312277; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
[0] 1.327813; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
[0] 1.305713; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
[0] 1.334377; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
[0] 1.301227; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
[0] .000000; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
This seems to be an error and should be reported......but as I am not a super coder, I am a bit hesitant to say things are wrong if I am not totally sure.


Attachments:
TestIchimokuCalc.java [11.34 KiB]
Downloaded 327 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: JFOREX-3714 Usage of CalculateIndicator with pivot Post rating: 0   New post Posted: Mon 16 Apr, 2012, 14:38 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
tgdrela1 wrote:
The best is to run the strategy once and look at the outputs

I also included the pivot indicator and for some reason it only gives me the last values for the support and resistance areas
[0] 1.316763; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
[0] 1.323327; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
[0] 1.312277; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
[0] 1.327813; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
[0] 1.305713; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
[0] 1.334377; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
[0] 1.301227; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
[0] .000000; [1] ?; [2] ?; [3] ?; [4] ?; [5] ?; [6] ?;
This seems to be an error and should be reported......but as I am not a super coder, I am a bit hesitant to say things are wrong if I am not totally sure.
This is a bug, which has been registered. For now please consider pivot indicator calculation by shift.


 

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