Hello I have problem with using my custom indicator "LS_I_DirectionalCorrelation_vs_GBPUSD" in my strategy.
Let me explain more details..
I have my custom indicator with name "LS_I_DirectionalCorrelation_vs_GBPUSD".
This indicator is calculating correlation index between by-user-chosen instrument and GBPUSD instrument.
Here is source code of the indicator if you are interested:
https://files.lorencsoftware.cz/20000007 ... BPUSD.javaThe indicator is working fine, I have no problems with the indicator.
I tried to calculete the indicator values from strategy code.
Like this:
Object[] vals = context.getIndicators().calculateIndicator(
Instrument.EURUSD,
Period.createCustomPeriod(Unit.Minute, 60),
new OfferSide[] {OfferSide.BID, OfferSide.BID},
"LS_I_DirectionalCorrelation_vs_GBPUSD",
new AppliedPrice[] {AppliedPrice.CLOSE, AppliedPrice.CLOSE},
new Object[] {14},
1);
context.getConsole().getOut().println(vals[0].toString());
This works fine, there is no problem.
Result looks like for example this: 0.706331927573264 ..is instance of Double
everythink is ok.
But after that I realized the code is taking data from weekend also.
And I want to exclude the weekend bars from calculation.
I want the correlation index is calculated from bars of week, and weekends have to be skiped.
So I have decided to use this implementation of calculateIndicator method...
Object[] calculateIndicator(Instrument instrument,
Period period,
OfferSide[] side,
String functionName,
IIndicators.AppliedPrice[] inputTypes,
Object[] optParams,
long from,
long to)
throws JFException
So in my case it looks like this:
Object[] values = context.getIndicators().calculateIndicator(
Instrument.EURUSD,
Period.createCustomPeriod(Unit.Minute, 60),
new OfferSide[] {OfferSide.BID, OfferSide.BID},
"LS_I_DirectionalCorrelation_vs_GBPUSD",
new AppliedPrice[] {AppliedPrice.CLOSE, AppliedPrice.CLOSE},
new Object[] {14},
Filter.WEEKENDS,
1,
askBar.getTime(),
0);
context.getConsole().getOut().println(values[0].toString());
The compilation of this code is OK, and it runs without exceptions.
But here is finally my problem:

I dont know what is the type of the Object instances inside Object[] result of the calculation... ?
Is array of objects? Or is array of arrays of objects? Or what??
when you will try to invoke .toString() method on the instance of Object from Object[] array - result of the calculation
You will see somthing like this: [D@db6096
As you know, in Java the toString() (if its not overwritten) method is defined like
getClass().getName() + '@' + Integer.toHexString(hashCode())see
https://www.ifs.tuwien.ac.at/ifs/lehre/e ... #toString()
So what is the class type of the result ???
I can not work with the result because I can not recognize the class.
I am waiting for your response,
thak you for assistance.
Best regards
Marek Lorenc