com.dukascopy.api.indicators
Interface IIndicator


public interface IIndicator

Interface that should be implemented by custom(user) indicators. Interface is more like ta-lib library abstract call interface

Author:
Dmitry Shohov

Method Summary
 IndicatorResult calculate(int startIndex, int endIndex)
          Calculates values of the indicator from startIndex to endIndex of input parameter and places them in output parameters
 IndicatorInfo getIndicatorInfo()
          Returns object that describes indicator, how many inputs, outputs it has, where it should be shown etc
 InputParameterInfo getInputParameterInfo(int index)
          Returns object that describes one of the inputs
 int getLookback()
          Returns number of elements needed to calculate value of the first element.
 OptInputParameterInfo getOptInputParameterInfo(int index)
          Returns object that describes optional input
 OutputParameterInfo getOutputParameterInfo(int index)
          Returns object that describes output
 void onStart(IIndicatorContext context)
          Called on indicator initialization
 void setInputParameter(int index, Object array)
          Sets input parameter.
 void setOptInputParameter(int index, Object value)
          Sets optional input parameter.
 void setOutputParameter(int index, Object array)
          Sets output parameter.
 

Method Detail

onStart

void onStart(IIndicatorContext context)
Called on indicator initialization

Parameters:
context - allows access to system functionality

getIndicatorInfo

IndicatorInfo getIndicatorInfo()
Returns object that describes indicator, how many inputs, outputs it has, where it should be shown etc

Returns:
object that describes indicator

getInputParameterInfo

InputParameterInfo getInputParameterInfo(int index)
Returns object that describes one of the inputs

Parameters:
index - index of the input
Returns:
object that describes input

getOptInputParameterInfo

OptInputParameterInfo getOptInputParameterInfo(int index)
Returns object that describes optional input

Parameters:
index - index of the optional input
Returns:
object that describes optional input

getOutputParameterInfo

OutputParameterInfo getOutputParameterInfo(int index)
Returns object that describes output

Parameters:
index - index of the output
Returns:
object that describes output

setInputParameter

void setInputParameter(int index,
                       Object array)
Sets input parameter. Array parameter is an array of the doubles, ints or prices represented as double[][]. Prices is in following order: open, close, high, low, volume

Parameters:
index - index of the parameter
array - array of the doubles, ints or prices represented as double[][]

setOptInputParameter

void setOptInputParameter(int index,
                          Object value)
Sets optional input parameter. If one of the parameters not set, then default value should be used

Parameters:
index - index of the parameter
value - int or double value

setOutputParameter

void setOutputParameter(int index,
                        Object array)
Sets output parameter. Size of the array should be enough to hold calculated values requested with calculate(int, int) call

Parameters:
index - index of the parameter
array - array of doubles or ints enough to hold values from startIndex to endIndex

getLookback

int getLookback()
Returns number of elements needed to calculate value of the first element. Usually depends on optional parameters

Returns:
number of elements needed to calculate value of the first element

calculate

IndicatorResult calculate(int startIndex,
                          int endIndex)
Calculates values of the indicator from startIndex to endIndex of input parameter and places them in output parameters

Parameters:
startIndex - index of the first element in input parameters that needs corresponding indicator value. That doesn't mean that values before startIndex will not be read, they will be if lookback is more than 0. That also doesn't mean that value for startIndex will be calculated, it will be not if startIndex < lookback. IndicatorResult.getFirstValueIndex() returns index of the first element that has corresponding calculated value in output array(s)
endIndex - index of the last element in input parameters that needs corresponding indicator value
Returns:
object with first index in input that has calculated value and number of values calculated


Copyright © 2009. All Rights Reserved.