Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

Error in indicator: java.lang.NullPointerException
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=200&t=56952
Page 1 of 1

Author:  ltklos [ Wed 06 Mar, 2019, 23:28 ]
Post subject:  Error in indicator: java.lang.NullPointerException

Can someone tell me where is the error in code on the bottom? I supose it's connected with startIndex and endIndex but I'm not sure and I don't know how to fix it.

All the time the same message: "Error in indicator: java.lang.NullPointerException"

I wanted to useichimoku indicator as a input of my own indicator, but first i wanted to check if it works, unfortunatelly it's not working :(

public IndicatorResult calculate(int startIndex, int endIndex) {
        //calculating startIndex taking into account lookback value
        if (startIndex - getLookback() < 0) {
            startIndex = getLookback();
        }
        if (endIndex + getLookforward() >= inputs[0][0].length) {
            endIndex = inputs[0][0].length - 1 - getLookforward();
        }
        if (startIndex > endIndex) {
            return new IndicatorResult(0, 0);
        }
                 
        ichi.setInputParameter(0, inputs[0]); 
       
        ichi.setOptInputParameter(0, timePeriod1);   
        ichi.setOptInputParameter(1, timePeriod2);
        ichi.setOptInputParameter(2, timePeriod3);
       
        ichi.setOutputParameter(0, outputs[0]);   
        ichi.setOutputParameter(1, outputs[1]);   
        ichi.setOutputParameter(2, outputs[2]);     
        ichi.setOutputParameter(3, outputs[3]);     
        ichi.setOutputParameter(4, outputs[4]);         
       
        ichi.calculate(startIndex, endIndex);       
               
        IndicatorResult ir = ichi.calculate(startIndex, endIndex);
       
        return ir;
    }


Attachments:
own_ichi.java [5.5 KiB]
Downloaded 148 times

Author:  mtnfx [ Fri 08 Mar, 2019, 23:01 ]
Post subject:  Re: Error in indicator: java.lang.NullPointerException

Try looking for details of NullPointerException in the 'logs' folder

Author:  ltklos [ Tue 12 Mar, 2019, 18:01 ]
Post subject:  Re: Error in indicator: java.lang.NullPointerException

where can I find 'logs' folder?

Author:  mtnfx [ Thu 14 Mar, 2019, 13:12 ]
Post subject:  Re: Error in indicator: java.lang.NullPointerException

On windows: right click Jforex icon -> Properties ... check where it is installed. There should be subfolder named "logs"

  Page 1 of 1