Parameter Configuration

IndicatorInfo

Class IndicatorInfo provides general indicator description. The system gets it from an indicator by calling getIndicatorInfo() method. IndicatorInfo is a simple class with fields and corresponding setters and getters. It has the following attributes:

  • name - name of the indicator. This is the global unique name that will be used to identify the indicator. SMA, MACD, CCI - all are the names of indicators.
  • title - a short description of the indicator like "Simple Moving Average" for SMA indicator.
  • groupName - group name. It is used for indicators visual grouping.
  • overChart - if the attribute is set to true, the indicator will be drawn in the same panel where candles are shown. It is desirable to have the same values range as prices of the chart for which it is calculated.
  • overVolumes - if the attribute is set to true, the indicator will be drawn in the panel with volumes. It is desirable to have the same values range as volumes.
  • unstablePeriod - some indicators (e.g. EMA) have a 'stabilizing' period. Depending on at which candle calculation was started, a few of the first values can have different calculated values. To remove this effect, the attribute has to be set to true for each indicator having such effect. It will force the system to calculate more values and to ignore some of them at the start (the first 100 and more, depending on the lookback). It makes calculation slower but the resulting values will pass 'stabilizing' period and will become 'stable'.
  • numberOfInputs - number of inputs for indicator calculations.
  • numberOfOptionalInputs - number of parameters like SMA time period.
  • numberOfOutputs - number of calculated values for every element of the input. The output represents one line generally.
  • showOnTicks - true, to draw the indicator on a tick chart. If the indicator is set to be drawn on a tick chart, it will be constructed based on 1-second candles.
  • recalculateAll - set to true, if indicator always has to be recalculated on all available array of inputs. When new candle is generated on chart, only one value will be calculated to make the calculation faster. Some of the indicators require as much values as possible for making its output more stable. For example, SAR indicator has unspecified unstable period, its first correct value depends on data and to minimize possible mistakes it is always recalculated on all available data, which is usually 3 times more than what is visible on the screen. Method isRecalculateAll may be used to check if indicator is recalculated on all chart data.
  • sparceIndicator - setting this attribute to true will force system to draw indicator on more values than is visible on screen. For example, ZIGZAG indicator has calculated values only on candles where it changes its direction. If sparceIndicator is false (a default value), the system draws indicator only on data that is visible on the screen, as well as one more candle on the sides behind it. It is enough for usual lines. While for ZIGZAG it is not possible to draw line that connects visible part with the previous value that is behind the screen. To bypass this problem, ZIGZAG has sparceIndicator attribute set to true, telling system that it has values only for some of the candles and it has to be drawn on more candles than are visible on one screen. The same goes to the indicators with LEVEL type outputs, else level line will disappear once right candle goes behind the screen.

The class holds two constructors:

  • constructor IndicatorInfo() creates an empty IndicatorInfo object;
  • constructor IndicatorInfo(String name, String title, String groupName, boolean overChart, boolean overVolumes, boolean unstablePeriod, int numberOfInputs, int numberOfOptionalInputs, int numberOfOutputs) creates an IndicatorInfo object and fills all its fields.
IndicatorInfo indicatorInfo = new IndicatorInfo(
    "EXAMPIND", "Sums previous values", "My indicators", false, false, false, 1, 1, 1);

InputParameterInfo

InputParameterInfo object describes input of the indicator. System gets it from indicator by callinggetInputParameterInfo() method. InputParameterInfo is a simple class with fields and corresponding setters and getters. It has the following attributes:

  • name - name of the input.
  • type - type of the input. Currently input can be either DOUBLE, which means array of prices of one kind, or PRICE in which case system will give several arrays of prices - double[5][n] and BAR for array of IBar objects. Prices for PRICE type will be in the following order: open, close, high, low, volume.
  • appliedPrice - can be set to specify preferred transformation of the price. This affects only prices of DOUBLE type.
  • instrument - if set, then input will contain data from another instrument.
  • period - if set, then input will contain data from specified period.
  • side - if set, then input will contain data of the specified offer side.

For inputs with instrument, period or side set there is no guarantee that it will have data covering all the time period from other inputs. Inputs can be empty in some cases, but it usually means that calculation will be called once more after a new data gets downloaded.

The class holds two constructors:

  • constructor InputParameterInfo() creates an empty input parameter descriptor;
  • constructor InputParameterInfo(String name, InputParameterInfo.Type type) creates input parameter descriptor and sets all its fields.

See JForex API documentation for more details.

inputParameterInfos = new InputParameterInfo[] {
    new InputParameterInfo("Input data", InputParameterInfo.Type.DOUBLE)};

OptInputParameterInfo

Class OptInputParameterInfo describes indicator optional input. This information is displayed when you open custom indicator in JForex platform. System gets it from indicator by calling getOptInputParameterInfo() method. OptInputParameterInfo is the simple class with fields and corresponding setters and getters. It has the following attributes:

  • name - name of the parameter
  • type - adds to the description of the parameter. Can be PERCENT, DEGREE, CURRENCY or OTHER which is also default value
  • description - object that describes this parameter. Can be instance of DoubleListDescription, IntegerListDescription, DoubleRangeDescription or IntegerRangeDescription

DoubleListDescription and IntegerListDescription

DoubleListDescription and IntegerListDescription differs only with type of parameter, in first case it's double in second it's int. Both describe parameter of indicator as a list of predefined values. For example it can be list on types of moving average. List descriptions have three attributes:

  • values - array of double values, where every value goes to corresponding value name in valueNames array
  • valueNames - array of value names, where every names goes to corresponding value in values array
  • defaultValue - default value, must be one of the values from values array

DoubleRangeDescription and IntegerRangeDescription

Same as with list, this two descriptions differs only with type of parameter. They describe some range of possible parameter values. Range descriptions have five attributes:

  • defaultValue - default value, must be in range between min and max
  • min - minimum allowed value
  • max - maximum allowed value
  • precision - how much numbers should be left after decimal dot
  • suggestedIncrement - increment to use in spinners. Defines value for how much currently showing value will be increased when user pushes up or down arrow

The class holds two constructors:

  • OptInputParameterInfo() creates an empty descriptor object
  • OptInputParameterInfo(String name, OptInputParameterInfo.Type type, OptInputDescription description) creates descriptor object and sets all its fields

See JForex API documentation for more details.

OptInputParameterInfo optInfo =  new OptInputParameterInfo(
    "Time period", OptInputParameterInfo.Type.OTHER, new IntegerRangeDescription(2, 2, 100, 1));

OutputParameterInfo

Class OutputParameterInfo describes indicator output. System gets it from indicator by calling getOutputParameterInfo() method. OutputParameterInfo is the simple class with fields and corresponding setters and getters. It has the following attributes:

  • name - name of the output
  • type - type of the output, can be DOUBLE, INT, OBJECT
  • drawingStyle - defines how the system will draw that output, includes different ways like line or histogram as well as looks like dots, dashes, dot-dashes etc for line
  • color - defines default value for color of this output
  • arrowSymbol - if drawingStyle is ARROW_SYMBOL_UP or ARROW_SYMBOL_DOWN, then this attribute defines the UTF symbol that should be drawn as arrow. Default value is arrow up or arrow down symbols depending on drawingStyle
  • histogramTwoColor - if set to true and drawingStyle is HISTOGRAM, then bars of histogram will be drawn with green color if they go above zero, and red if they go below
  • shift - number of candles by which this output should be shifted. Positive value shifts output to the right, negative to the left. For example if value is 2, then chart will be shifted by two candles to the right and will go by two candles further than latest candle. Same if value is -2, then two latest candles will miss values, because output will be shifted to the left
  • drawnByIndicator - if set to true, then indicator should define drawOutput method, which will be called every time when this output needs to be shown on chart
  • gapAtNaN - if output value equals to Double.NaN for double type output or Integer.MIN_VALUE for int type output, then on chart there will be gap at the corresponding candle. Default behavior is connecting previous not NaN value with next not NaN value.

DrawingStyle

Indicators currently support the following drawing styles

  • NONE - don't draw anything for this output. Can be used when value is only used when called from strategies
  • LINE - simple line that connects all values
  • DOT_LINE - line made of dots
  • DASH_LINE - line made of dashes
  • DASHDOT_LINE - line made of dashes and dots
  • DASHDOTDOT_LINE - line made of repeating dash and two dots
  • LEVEL_LINE - level line. Level lines are horizontal lines that are always drawn if latest candle are in "screen buffer" and by the value of latest not NaN or not Integer.MIN_VALUE value
  • LEVEL_DOT_LINE - level line made of dots
  • LEVEL_DASH_LINE - level line made of dashes
  • LEVEL_DASHDOT_LINE - level line made of dashes and dots
  • LEVEL_DASHDOTDOT_LINE - level line made of repeating dash and two dots
  • DOTS - draws a dot at every value
  • HISTOGRAM - draws histogram, every value is represented by this bar of the histogram
  • ARROW_SYMBOL_UP - draws arrow pointing up. Symbol of the arrow can be customized
  • ARROW_SYMBOL_DOWN - draws arrow pointing down. Symbol of the arrows can be customized
  • PATTERN_BOOL - draws brackets around the candles if value is not 0
  • PATTERN_BULL_BEAR - draws green brackets around the candle if value is positive (bullish) and red brackets if value is negative (bearish)
  • PATTERN_STRENGTH - draws light green brackets around the candle if value is positive, but is less or equals 100 (getting bullish). Green brackets if value is greater than 100 (bullish). Light red if value is negative, but is greater or equals -100 (getting bearish) and red if value is less than -100 (bearish)

Nested classes OutputParameterInfo.Type and OutputParameterInfo.DrawingStyle describe type and drawing style of custom indicator output.

See JForex API documentation for more details.

OutputParameterInfo outputInfo = new OutputParameterInfo(
    "out", OutputParameterInfo.Type.DOUBLE, OutputParameterInfo.DrawingStyle.LINE);
The information on this web site is provided only as general information, which may be incomplete or outdated. Click here for full disclaimer.