setIndiShift (SDK Trading)

setIndiShift is a Fintechee API to shift the output line of the custom indicator.

setIndiShift(context, name, shift)

Indicator SDK This function sets the shift value of the data output of indicator.

Kind: global function

Param Type Description
context object the name should be the same with the name of parameter of indicatorFunction
name string specifies the name of the data output of indicator
shift string specifies the shift value of the data output of indicator

setIndiShift (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)