Skip to content
Fintechee edited this page Mar 10, 2020 · 10 revisions

Functions

popupMessage(message)

Common Function SDK This function pops up message.

popupWarningMessage(warning)

Common Function SDK This function pops up warning message.

popupErrorMessage(error)

Common Function SDK This function pops up error message.

printMessage(message)

Common Function SDK This function prints message.

printWarningMessage(warning)

Common Function SDK This function prints warning message.

printErrorMessage(error)

Common Function SDK This function prints error message.

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

Indicator SDK This function registers indicator.

setIndiShift(context, name, shift)

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

getIndiParameter(context, paramName)number | string

Indicator SDK This function gets parameter's value of indicator.

getDataInput(context, index)array

Indicator SDK This function gets data input.

getDataOutput(context, name)array

Indicator SDK This function gets data output.

getCalculatedLength(context)number

Indicator SDK This function gets the length of data calculated.

registerEA(eaName, eaDesc, paramsTemplate, initFunction, deinitFunction, onTickFunction)

EA SDK This function registers EA.

getPendingOrdersListLength(context)number

EA SDK This function gets the length of pending orders list. Phase (this API's scope): onTick | deinit

getPendingOrder(context, selector)object

EA SDK This function gets pending order. Phase (this API's scope): onTick | deinit

getOrderId(pendingOrder)string

EA SDK This function gets the order ID of the specific pending order. Phase (this API's scope): onTick | deinit

getPrice(pendingOrder)number

EA SDK This function gets the price of the specific pending order. Phase (this API's scope): onTick | deinit

getTime(pendingOrder)number

EA SDK This function gets the time(UTC time stamp) of the specific pending order. Phase (this API's scope): onTick | deinit

getLots(pendingOrder)number

EA SDK This function gets the volume lots(100000 units per lot) of the specific pending order. Phase (this API's scope): onTick | deinit

getOpenTradesListLength(context)number

EA SDK This function gets the length of open trades list. Phase (this API's scope): onTick | deinit

getOpenTrade(context, selector)object

EA SDK This function gets open trade. Phase (this API's scope): onTick | deinit

getBrokerName(orderOrTrade)string

EA SDK This function gets the broker name of the specific pending order or open trade. Phase (this API's scope): onTick | deinit

getAccountId(orderOrTrade)string

EA SDK This function gets the account ID of the specific pending order or open trade. Phase (this API's scope): onTick | deinit

getTradeId(openTrade)string

EA SDK This function gets the trade ID of the specific open trade. Phase (this API's scope): onTick | deinit

getSymbolName(orderOrTrade)string

EA SDK This function gets the symbol name of the specific pending order or open trade. Phase (this API's scope): onTick | deinit

getOpenPrice(openTrade)number

EA SDK This function gets the open price of the specific open trade. Phase (this API's scope): onTick | deinit

getOpenTime(openTrade)number

EA SDK This function gets the open time(UTC time stamp) of the specific open trade. Phase (this API's scope): onTick | deinit

getOrderType(orderOrTrade)number

EA SDK This function gets the order type(buy or sell) of the specific pending order or open trade. Phase (this API's scope): onTick | deinit

getOpenLots(openTrade)number

EA SDK This function gets the volume lots(100000 units per lot) of the specific open trade. Phase (this API's scope): onTick | deinit

getTakeProfit(orderOrTrade)number

EA SDK This function gets the take profit of the specific pending order or open trade. Phase (this API's scope): onTick | deinit

getStopLoss(orderOrTrade)number

EA SDK This function gets the stop loss of the specific pending order or open trade. Phase (this API's scope): onTick | deinit

getUnrealizedPL(openTrade)number

EA SDK This function gets the unrealized profit or loss of the specific open trade. Phase (this API's scope): onTick | deinit

getSwapPoint(openTrade)number

EA SDK This function gets the swap point of the specific open trade. Phase (this API's scope): onTick | deinit

getCommission(openTrade)number

EA SDK This function gets the commission of the specific open trade. Phase (this API's scope): onTick | deinit

getQuotes(context, brokerName, accountId, symbolName)

EA SDK This function declares the quotes of which symbol to get. Phase (this API's scope): init

getBid(context, brokerName, accountId, symbolName)number

EA SDK This function gets the bid of the specific symbol. Phase (this API's scope): onTick | deinit

getAsk(context, brokerName, accountId, symbolName)number

EA SDK This function gets the ask of the specific symbol. Phase (this API's scope): onTick | deinit

sendOrder(brokerName, accountId, symbolName, orderType, price, slippage, volume, takeProfit, stopLoss, comment)

EA SDK This function sends order to market. Phase (this API's scope): onTick | deinit

modifyOrder(brokerName, accountId, orderId, symbolName, orderType, price, slippage, volume, takeProfit, stopLoss, comment)

EA SDK This function sends order to market. Phase (this API's scope): onTick | deinit

cancelOrder(brokerName, accountId, orderId)

EA SDK This function cancels the specific pending order. Phase (this API's scope): onTick | deinit

modifyTpSlOfTrade(brokerName, accountId, tradeId, takeProfit, stopLoss)

EA SDK This function modifies the take profit or stop loss of the specific open trade. Phase (this API's scope): onTick | deinit

closeTrade(brokerName, accountId, tradeId)

EA SDK This function closes the specific open trade. Phase (this API's scope): onTick | deinit

getEAParameter(context, paramName)number | string

EA SDK This function gets parameter's value of EA. Phase (this API's scope): init | onTick | deinit

getChartHandle(context, brokerName, accountId, symbolName, timeFrame)number

EA SDK This function gets the handle of the specific chart. Phase (this API's scope): init

getIndicatorHandle(context, brokerName, accountId, symbolName, timeFrame, indiName, params)number

EA SDK This function gets the handle of the specific indicator. Phase (this API's scope): init

getData(context, handle, name)array

EA SDK This function gets the data of the specific handle. Phase (this API's scope): onTick | deinit

getAccountsListLength(context)number

EA SDK This function gets the length of the list of the accounts that have been signed in. Phase (this API's scope): init | onTick | deinit

getAccount(context, selector)object

EA SDK This function gets account. Phase (this API's scope): init | onTick | deinit

getBrokerNameOfAccount(account)string

EA SDK This function gets the broker name of the specific account. Phase (this API's scope): init | onTick | deinit

getAccountIdOfAccount(account)string

EA SDK This function gets the account ID of the specific account. Phase (this API's scope): init | onTick | deinit

getCurrencyOfAccount(account)string

EA SDK This function gets the currency name of the specific account. Phase (this API's scope): init | onTick | deinit

getToFixedOfAccount(account)string

EA SDK This function gets the tofixed of the specific account. Phase (this API's scope): init | onTick | deinit

getBalanceOfAccount(account)string

EA SDK This function gets the balance of the specific account. Phase (this API's scope): onTick | deinit

getPLOfAccount(account)string

EA SDK This function gets the profit and loss statement of the specific account. Phase (this API's scope): onTick | deinit

getEquityOfAccount(account)string

EA SDK This function gets the equity of the specific account. Phase (this API's scope): onTick | deinit

getMarginUsedOfAccount(account)string

EA SDK This function gets the margin used of the specific account. Phase (this API's scope): onTick | deinit

getMarginAvailableOfAccount(account)string

EA SDK This function gets the margin available of the specific account. Phase (this API's scope): onTick | deinit

popupMessage(message)

Common Function SDK This function pops up message.

Kind: global function

Param Type
message string

popupWarningMessage(warning)

Common Function SDK This function pops up warning message.

Kind: global function

Param Type Description
warning string message

popupErrorMessage(error)

Common Function SDK This function pops up error message.

Kind: global function

Param Type Description
error string message

printMessage(message)

Common Function SDK This function prints message.

Kind: global function

Param Type
message string

printWarningMessage(warning)

Common Function SDK This function prints warning message.

Kind: global function

Param Type Description
warning string message

printErrorMessage(error)

Common Function SDK This function prints error message.

Kind: global function

Param Type Description
error string message

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

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

getIndiParameter(context, paramName) ⇒ number | string

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

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

getDataOutput(context, name) ⇒ array

Indicator SDK This function gets data output.

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

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

getCalculatedLength(context) ⇒ number

Indicator SDK This function gets the length of data calculated.

Kind: global function
Returns: number - the length of data calculated.

Param Type Description
context object the name should be the same with the name of parameter of indicatorFunction

registerEA(eaName, eaDesc, paramsTemplate, initFunction, deinitFunction, onTickFunction)

EA SDK This function registers EA.

Kind: global function

Param Type Description
eaName string name of EA
eaDesc string description of EA
paramsTemplate array parameters of EA (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 }]
initFunction function init function of EA (e.g. function () {})
deinitFunction function deinit function of EA (e.g. function () {})
onTickFunction function onTick function of EA (e.g. function (context) {})

getPendingOrdersListLength(context) ⇒ number

EA SDK This function gets the length of pending orders list. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - the length of pending orders list.

Param Type Description
context object the name should be the same with the name of parameter of onTickFunction

getPendingOrder(context, selector) ⇒ object

EA SDK This function gets pending order. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: object - pending order.

Param Type Description
context object the name should be the same with the name of parameter of onTickFunction
selector number index of pending order

getOrderId(pendingOrder) ⇒ string

EA SDK This function gets the order ID of the specific pending order. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: string - order ID.

Param Type Description
pendingOrder object specific pending order

getPrice(pendingOrder) ⇒ number

EA SDK This function gets the price of the specific pending order. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - price.

Param Type Description
pendingOrder object specific pending order

getTime(pendingOrder) ⇒ number

EA SDK This function gets the time(UTC time stamp) of the specific pending order. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - time(UTC time stamp).

Param Type Description
pendingOrder object specific pending order

getLots(pendingOrder) ⇒ number

EA SDK This function gets the volume lots(100000 units per lot) of the specific pending order. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - volume lots(100000 units per lot).

Param Type Description
pendingOrder object specific pending order

getOpenTradesListLength(context) ⇒ number

EA SDK This function gets the length of open trades list. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - the length of open trades list.

Param Type Description
context object the name should be the same with the name of parameter of onTickFunction

getOpenTrade(context, selector) ⇒ object

EA SDK This function gets open trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: object - open trade.

Param Type Description
context object the name should be the same with the name of parameter of onTickFunction
selector number index of open trade

getBrokerName(orderOrTrade) ⇒ string

EA SDK This function gets the broker name of the specific pending order or open trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: string - broker name.

Param Type Description
orderOrTrade object specific pending order or open trade

getAccountId(orderOrTrade) ⇒ string

EA SDK This function gets the account ID of the specific pending order or open trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: string - account ID.

Param Type Description
orderOrTrade object specific pending order or open trade

getTradeId(openTrade) ⇒ string

EA SDK This function gets the trade ID of the specific open trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: string - trade ID.

Param Type Description
openTrade object specific open trade

getSymbolName(orderOrTrade) ⇒ string

EA SDK This function gets the symbol name of the specific pending order or open trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: string - symbol name.

Param Type Description
orderOrTrade object specific pending order or open trade

getOpenPrice(openTrade) ⇒ number

EA SDK This function gets the open price of the specific open trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - open price.

Param Type Description
openTrade object specific open trade

getOpenTime(openTrade) ⇒ number

EA SDK This function gets the open time(UTC time stamp) of the specific open trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - open time(UTC time stamp).

Param Type Description
openTrade object specific open trade

getOrderType(orderOrTrade) ⇒ number

EA SDK This function gets the order type(buy or sell) of the specific pending order or open trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - order type(ORDER_TYPE.OP_BUY or ORDER_TYPE.OP_SELL).

Param Type Description
orderOrTrade object specific pending order or open trade

getOpenLots(openTrade) ⇒ number

EA SDK This function gets the volume lots(100000 units per lot) of the specific open trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - volume lots(100000 units per lot).

Param Type Description
openTrade object specific open trade

getTakeProfit(orderOrTrade) ⇒ number

EA SDK This function gets the take profit of the specific pending order or open trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - take profit.

Param Type Description
orderOrTrade object specific pending order or open trade

getStopLoss(orderOrTrade) ⇒ number

EA SDK This function gets the stop loss of the specific pending order or open trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - stop loss.

Param Type Description
orderOrTrade object specific pending order or open trade

getUnrealizedPL(openTrade) ⇒ number

EA SDK This function gets the unrealized profit or loss of the specific open trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - unrealized profit or loss.

Param Type Description
openTrade object specific open trade

getSwapPoint(openTrade) ⇒ number

EA SDK This function gets the swap point of the specific open trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - swap point.

Param Type Description
openTrade object specific open trade

getCommission(openTrade) ⇒ number

EA SDK This function gets the commission of the specific open trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - commission.

Param Type Description
openTrade object specific open trade

getQuotes(context, brokerName, accountId, symbolName)

EA SDK This function declares the quotes of which symbol to get. Phase (this API's scope): init

Kind: global function

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

getBid(context, brokerName, accountId, symbolName) ⇒ number

EA SDK This function gets the bid of the specific symbol. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - bid.

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

getAsk(context, brokerName, accountId, symbolName) ⇒ number

EA SDK This function gets the ask of the specific symbol. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - ask.

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

sendOrder(brokerName, accountId, symbolName, orderType, price, slippage, volume, takeProfit, stopLoss, comment)

EA SDK This function sends order to market. Phase (this API's scope): onTick | deinit

Kind: global function

Param Type Description
brokerName string broker name
accountId string account ID
symbolName string symbol name
orderType number order type(ORDER_TYPE.OP_BUY or OP_SELL or OP_BUYLIMIT or OP_SELLLIMIT or OP_BUYSTOP or OP_SELLSTOP)
price number price(if the order is market order, price should be set by zero)
slippage number always be 0(in this version, the trade will be opened by market price)
volume number lots(100000 units per lot)
takeProfit number take profit
stopLoss number stop loss
comment string

modifyOrder(brokerName, accountId, orderId, symbolName, orderType, price, slippage, volume, takeProfit, stopLoss, comment)

EA SDK This function sends order to market. Phase (this API's scope): onTick | deinit

Kind: global function

Param Type Description
brokerName string broker name
accountId string account ID
orderId string order ID
symbolName string symbol name
orderType number order type(ORDER_TYPE.OP_BUY or OP_SELL or OP_BUYLIMIT or OP_SELLLIMIT or OP_BUYSTOP or OP_SELLSTOP)
price number price(if the order is market order, price should be set by zero)
slippage number always be 0(in this version, the trade will be opened by market price)
volume number lots(100000 units per lot)
takeProfit number take profit
stopLoss number stop loss
comment string

cancelOrder(brokerName, accountId, orderId)

EA SDK This function cancels the specific pending order. Phase (this API's scope): onTick | deinit

Kind: global function

Param Type Description
brokerName string broker name
accountId string account ID
orderId string order ID

modifyTpSlOfTrade(brokerName, accountId, tradeId, takeProfit, stopLoss)

EA SDK This function modifies the take profit or stop loss of the specific open trade. Phase (this API's scope): onTick | deinit

Kind: global function

Param Type Description
brokerName string broker name
accountId string account ID
tradeId string trade ID
takeProfit number take profit
stopLoss number stop loss

closeTrade(brokerName, accountId, tradeId)

EA SDK This function closes the specific open trade. Phase (this API's scope): onTick | deinit

Kind: global function

Param Type Description
brokerName string broker name
accountId string account ID
tradeId string trade ID

getEAParameter(context, paramName) ⇒ number | string

EA SDK This function gets parameter's value of EA. Phase (this API's scope): init | onTick | deinit

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 onTickFunction
paramName string the name of parameter

getChartHandle(context, brokerName, accountId, symbolName, timeFrame) ⇒ number

EA SDK This function gets the handle of the specific chart. 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

getIndicatorHandle(context, brokerName, accountId, symbolName, timeFrame, indiName, params) ⇒ number

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 }]

getData(context, handle, name) ⇒ array

EA SDK This function gets the data of the specific handle. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: array - data.

Param Type Description
context object the name should be the same with the name of parameter of onTickFunction
handle number the return value of getChartHandle or getIndicatorHandle
name string name of the specific data

getAccountsListLength(context) ⇒ number

EA SDK This function gets the length of the list of the accounts that have been signed in. Phase (this API's scope): init | onTick | deinit

Kind: global function
Returns: number - the length of accounts list.

Param Type Description
context object the name should be the same with the name of parameter of initFunction or deinitFunction or onTickFunction

getAccount(context, selector) ⇒ object

EA SDK This function gets account. Phase (this API's scope): init | onTick | deinit

Kind: global function
Returns: object - account.

Param Type Description
context object the name should be the same with the name of parameter of initFunction or deinitFunction or onTickFunction
selector number index of account

getBrokerNameOfAccount(account) ⇒ string

EA SDK This function gets the broker name of the specific account. Phase (this API's scope): init | onTick | deinit

Kind: global function
Returns: string - broker name.

Param Type Description
account object specific account

getAccountIdOfAccount(account) ⇒ string

EA SDK This function gets the account ID of the specific account. Phase (this API's scope): init | onTick | deinit

Kind: global function
Returns: string - account ID.

Param Type Description
account object specific account

getCurrencyOfAccount(account) ⇒ string

EA SDK This function gets the currency name of the specific account. Phase (this API's scope): init | onTick | deinit

Kind: global function
Returns: string - currency name.

Param Type Description
account object specific account

getToFixedOfAccount(account) ⇒ string

EA SDK This function gets the tofixed of the specific account. Phase (this API's scope): init | onTick | deinit

Kind: global function
Returns: string - tofixed to round numbers.

Param Type Description
account object specific account

getBalanceOfAccount(account) ⇒ string

EA SDK This function gets the balance of the specific account. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: string - balance.

Param Type Description
account object specific account

getPLOfAccount(account) ⇒ string

EA SDK This function gets the profit and loss statement of the specific account. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: string - profit and loss statement.

Param Type Description
account object specific account

getEquityOfAccount(account) ⇒ string

EA SDK This function gets the equity of the specific account. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: string - equity.

Param Type Description
account object specific account

getMarginUsedOfAccount(account) ⇒ string

EA SDK This function gets the margin used of the specific account. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: string - margin used.

Param Type Description
account object specific account

getMarginAvailableOfAccount(account) ⇒ string

EA SDK This function gets the margin available of the specific account. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: string - margin available.

Param Type Description
account object specific account
Clone this wiki locally