getIndiParameter (SDK Trading)
getIndiParameter is a Fintechee API to get the value of the specific parameter of the custom indicator.
The type of a parameter can be Integer, Number, Boolean, String. The String type has no range, so please set the String type's range always by null.
number
| string
getIndiParameter(context, paramName) ⇒ Indicator SDK This function gets parameter's value of indicator.
Kind: global function
Returns: number
| string
- the value of parameter.
Param | Type | Description |
---|---|---|
context | object | the name should be the same with the name of parameter of indicatorFunction |
paramName | string | the name of parameter |
getIndiParameter (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)