getIndicatorHandle (SDK Trading)
getIndicatorHandle is a Fintechee API to add an indicator to a chart and get the handle(a kind of selector) of the specific indicator.
The handle would be used to get the data in the onTick callback function. So you need to transfer it to the onTick function by setting it as a property of window object.
number
getIndicatorHandle(context, brokerName, accountId, symbolName, timeFrame, indiName, params) ⇒ EA SDK This function gets the handle of the specific indicator. Phase (this API's scope): init
Kind: global function
Returns: number
- handle.
Param | Type | Description |
---|---|---|
context | object | the name should be the same with the name of parameter of onTickFunction |
brokerName | string | broker name |
accountId | string | account ID |
symbolName | string | symbol name |
timeFrame | string | time frame |
indiName | string | name of indicator |
params | array | parameters of indicator e.g. [{ name: "factor", value: 1 }] |
getIndicatorHandle (SDK Trading)
registerEA(
"test_api",
"An EA to test APIs",
[],
function (context) { // Init()
var account = getAccount(context, 0)
var brokerName = getBrokerNameOfAccount(account)
var accountId = getAccountIdOfAccount(account)
var symbolName = "EUR/USD"
window.indiHandle = getIndicatorHandle(context, brokerName, accountId, symbolName, TIME_FRAME.M1, "sma", [{
name: "period",
value: 10
}])
},
function (context) { // Deinit()
},
function (context) { // OnTick()
})