registerIndicator (SDK Trading)

registerIndicator is a Fintechee API to register your custom indicator.

registerIndicator(indiName, indiDesc, indicatorFunction, paramsTemplate, extParamDataInputTmpl, extParamDataOutputTmpl, whereToRenderTmpl)

Indicator SDK This function registers indicator.

Kind: global function

Param Type Description
indiName string name of indicator
indiDesc string description of indicator
indicatorFunction function function of indicator (e.g. function (context) {})
paramsTemplate array parameters of indicator (the range MUST be filled with null if the type is NOT PARAMETER.NUMBER) e.g. [{ name: "factor", value: 1, required: true, type: PARAMETER.NUMBER, range: [0, 1] }, { name: "checked", value: true, required: false, type: PARAMETER.BOOLEAN, range: null }]
extParamDataInputTmpl array maps of the data input of indicator and index e.g. [{ name: DATA_NAME.CLOSE, index: 1 }]
extParamDataOutputTmpl array setting for the output of indicator e.g. [{ name: "x", visible: true, renderType: RENDER_TYPE.LINE, color: "steelblue" }]
whereToRenderTmpl number WHERE_TO_RENDER.CHART_WINDOW or WHERE_TO_RENDER.SEPARATE_WINDOW

registerIndicator (SDK Trading)

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

    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++
    }
},[{
    name: "period",
    value: 10,
    required: false,
    type: "Integer",
    range: [1,100]
}],
[{
    name: DATA_NAME.CLOSE,
    index: 0
}],
[{
    name: "output",
    visible: true,
    renderType: RENDER_TYPE.HISTOGRAM,
    color: "steelblue"
}],
WHERE_TO_RENDER.SEPARATE_WINDOW)