public interface IIndicator
It is possible to define some of the outputs as drawnByIndicator by calling setDrawnByIndicator method in OutputParameterInfo. In this case indicator should implement IDrawingIndicator interface and method
public void drawOutput(Graphics g, int outputIdx, Object values, Color color, IIndicatorDrawingSupport indicatorDrawingSupport, List<Shape> shapes, Map<Color, List<Point>> handles)
This method will be called every time chart surface should be redrawn
Also it's possible to implement IMinMax interface and define method that will define scale of the indicator if it's drawn on separate windown under chart.
public double[] getMinMax(int outputIdx, Object values, int firstVisibleValueIndex, int lastVisibleValueIndex)
Modifier and Type | Method and Description |
---|---|
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.
|
int |
getLookforward()
Returns number of elements after last element needed to calculate value of the last 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,
java.lang.Object array)
Sets input parameter.
|
void |
setOptInputParameter(int index,
java.lang.Object value)
Sets optional input parameter.
|
void |
setOutputParameter(int index,
java.lang.Object array)
Sets output parameter.
|
void onStart(IIndicatorContext context)
context
- allows access to system functionalityIndicatorInfo getIndicatorInfo()
InputParameterInfo getInputParameterInfo(int index)
index
- index of the inputOptInputParameterInfo getOptInputParameterInfo(int index)
index
- index of the optional inputOutputParameterInfo getOutputParameterInfo(int index)
index
- index of the outputvoid setInputParameter(int index, java.lang.Object array)
index
- index of the parameterarray
- array of the doubles, ints or prices represented as double[][]void setOptInputParameter(int index, java.lang.Object value)
index
- index of the parametervalue
- int or double valuevoid setOutputParameter(int index, java.lang.Object array)
calculate(int, int)
callindex
- index of the parameterarray
- array of doubles or ints enough to hold values from startIndex to endIndexint getLookback()
int getLookforward()
IndicatorResult calculate(int startIndex, int endIndex)
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 valueCopyright © 2024. All rights reserved.