getDataInput (SDK Trading)

getDataInput is a Fintechee API to get the inputted data of the custom indicator.

getDataInput(context, index) ⇒ array

Indicator SDK This function gets data input.

Kind: global function
Returns: array - data input of indicator.

Param Type Description
context object the name should be the same with the name of parameter of indicatorFunction
index number specifies the index of the data input of indicator

getDataInput (SDK Trading)

registerIndicator("name", "desciption", function (context) {
    var dataInput = getDataInput(context, 0)
    var dataOutput = getDataOutput(context, "output")
    var shift = getIndiParameter(context, "shift")

    var calculatedLength = getCalculatedLength(context)
    var i = calculatedLength

    if (i == 0) {
        dataOutput[0] = 0
        i++
    } else {
        i--
    }

    while (i < dataInput.length) {
        dataOutput[i] = Math.random()
        i++
    }

    if (shift != null && calculatedLength == 0) {
        setIndiShift(context, "output", shift)
    }
},[{
    name: "shift",
    value: 5,
    required: true,
    type: "Integer",
    range: [-10,10]
}],
[{
    name: DATA_NAME.CLOSE,
    index: 0
}],
[{
    name: "output",
    visible: true,
    renderType: RENDER_TYPE.HISTOGRAM,
    color: "steelblue"
}],
WHERE_TO_RENDER.SEPARATE_WINDOW)