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

Functions

popupMessage(message)

Common Function SDK | This function pops up a message.

popupWarningMessage(message)

Common Function SDK | This function pops up a warning message.

popupErrorMessage(message)

Common Function SDK | This function pops up an error message.

printMessage(message)

Common Function SDK | This function prints a message.

printWarningMessage(message)

Common Function SDK | This function prints a warning message.

printErrorMessage(message)

Common Function SDK | This function prints an error message.

registerIndicator(indiName, indiDesc, indicatorFunction, paramsTemplate, extParamDataInputTmpl, extParamDataOutputTmpl, whereToRenderTmpl, initFunction, deinitFunction, renderFunction)

Indicator SDK | This function registers an indicator.

unregisterIndicator(indiName)

Indicator SDK | This function unregisters an indicator.

getIndiName(context)string

Indicator SDK | This function gets the name of this indicator.

setIndiShift(context, name, shift)

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

getIndiParameter(context, paramName)number | string

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

getDataInput(context, index)array

Indicator SDK | This function gets the data input.

getDataOutput(context, name)array

Indicator SDK | This function gets the data output.

getCalculatedLength(context)number

Indicator SDK | This function gets the length of the data to be calculated.

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

EA SDK | This function registers an EA.

unregisterEA(eaName)

EA SDK | This function unregisters an EA.

getEAName(context)string

EA SDK | This function gets the name of this EA.

getPendingOrdersListLength(context)number

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

getCancelledOrdersListLength(context)number

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

getPendingOrder(context, selector)object

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

getOrderId(order)string

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

getPrice(order)number

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

getTime(order)number

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

getLots(order)number

EA SDK | This function gets the volume lots(or the bet per pip when it comes to Spread Betting) of the specific pending order or cancelled order or rejected order. Phase (this API's scope): onTick | deinit

getExpiration(order)number

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

getOpenTradesListLength(context)number

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

getHistoryTradesListLength(context)number

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

getOpenTrade(context, selector)object

EA SDK | This function gets the 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 cancelled order or rejected order or open trade or historical 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 cancelled order or rejected order or open trade or historical trade. Phase (this API's scope): onTick | deinit

getTradeId(trade)string

EA SDK | This function gets the trade ID of the specific open trade or historical 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 cancelled order or rejected order or open trade or historical trade. Phase (this API's scope): onTick | deinit

getOpenPrice(trade)number

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

getOpenTime(trade)number

EA SDK | This function gets the open time(UTC time stamp) of the specific open trade or historical 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 cancelled order or rejected order or open trade or historical trade. Phase (this API's scope): onTick | deinit

getOpenLots(trade)number

EA SDK | This function gets the volume lots(or the bet per pip when it comes to Spread Betting) of the specific open trade or historical 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 cancelled order or rejected order or open trade or historical 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 cancelled order or rejected order or open trade or historical 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(trade)number

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

getCommission(trade)number

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

getPL(trade)number

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

getMagicNumber(orderOrTrade)number

EA SDK | This function gets the magic number of the specific pending order or cancelled order or rejected order or open trade or historical trade. Phase (this API's scope): onTick | deinit

getComment(orderOrTrade)number

EA SDK | This function gets the comment of the specific pending order or cancelled order or rejected order or open trade or historical 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

getAsk(context, brokerName, accountId, symbolName)number

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

getCurrentTick(context)object

EA SDK | This function gets the current tick data that triggered the onTick event. Phase (this API's scope): onTick

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

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

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

EA SDK | This function sends an order to the market to replace the specific order that the order ID refers to. 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, price, slippage)

EA SDK | This function closes the specific open trade by sending a market order. 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 the 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 number to fixed-point 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

getUnrealizedPLOfAccount(account)string

EA SDK | This function gets the unrealized 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

setOptimizationResult(context, result)

EA SDK | This function sets the result for the optimization. Phase (this API's scope): deinit

getLatestTransId(context)string

EA SDK | This function gets the ID of the latest transaction that triggered the onTransaction event. Phase (this API's scope): onTick | onTransaction | deinit

getLatestTransType(context)string

EA SDK | This function gets the type of the latest transaction that triggered the onTransaction event. Phase (this API's scope): onTick | onTransaction | deinit

popupMessage(message)

Common Function SDK | This function pops up a message.

Kind: global function

Param Type
message string

popupWarningMessage(message)

Common Function SDK | This function pops up a warning message.

Kind: global function

Param Type
message string

popupErrorMessage(message)

Common Function SDK | This function pops up an error message.

Kind: global function

Param Type
message string

printMessage(message)

Common Function SDK | This function prints a message.

Kind: global function

Param Type
message string

printWarningMessage(message)

Common Function SDK | This function prints a warning message.

Kind: global function

Param Type
message string

printErrorMessage(message)

Common Function SDK | This function prints an error message.

Kind: global function

Param Type
message string

registerIndicator(indiName, indiDesc, indicatorFunction, paramsTemplate, extParamDataInputTmpl, extParamDataOutputTmpl, whereToRenderTmpl, initFunction, deinitFunction, renderFunction)

Indicator SDK | This function registers an indicator.

Kind: global function

Param Type Description
indiName string - the name of this indicator
indiDesc string - the description of this indicator
indicatorFunction function - the function of this indicator (e.g. function (context) {})
paramsTemplate array - the parameters of this indicator (the range MUST be filled with null if the type is PARAMETER.STRING) 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 - the maps of the data input of this indicator and the index e.g. [{ name: DATA_NAME.CLOSE, index: 1 }]
extParamDataOutputTmpl array - the setting for the output of this 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
initFunction function - the init function of this indicator (e.g. function (context) {})
deinitFunction function - the deinit function of this indicator (e.g. function (context) {})
renderFunction function - the render function of this indicator (e.g. function (context) {})

unregisterIndicator(indiName)

Indicator SDK | This function unregisters an indicator.

Kind: global function

Param Type Description
indiName string - the name of an indicator

getIndiName(context) ⇒ string

Indicator SDK | This function gets the name of this indicator.

Kind: global function
Returns: string - the name of this indicator.

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

setIndiShift(context, name, shift)

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

Kind: global function

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

getIndiParameter(context, paramName) ⇒ number | string

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

Kind: global function
Returns: number | string - the value of the specified parameter.

Param Type Description
context object - the name should be the same as the name of the parameter of the indicatorFunction
paramName string - the name of the specified parameter

getDataInput(context, index) ⇒ array

Indicator SDK | This function gets the data input.

Kind: global function
Returns: array - the data input of this indicator.

Param Type Description
context object - the name should be the same as the name of the parameter of the indicatorFunction
index number - specifies the index of the data input of this indicator

getDataOutput(context, name) ⇒ array

Indicator SDK | This function gets the data output.

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

Param Type Description
context object - the name should be the same as the name of the parameter of the indicatorFunction
name string - specifies the name of the data output of this indicator

getCalculatedLength(context) ⇒ number

Indicator SDK | This function gets the length of the data to be calculated.

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

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

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

EA SDK | This function registers an EA.

Kind: global function

Param Type Description
eaName string - the name of this EA
eaDesc string - the description of this EA
paramsTemplate array - the parameters of this EA (the range MUST be filled with null if the type is PARAMETER.STRING) 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 - the init function of this EA (e.g. function (context) {})
deinitFunction function - the deinit function of this EA (e.g. function (context) {})
onTickFunction function - the onTick function of this EA (e.g. function (context) {})
onTransactionFunction function - the onTransaction function of this EA (e.g. function (context) {})

unregisterEA(eaName)

EA SDK | This function unregisters an EA.

Kind: global function

Param Type Description
eaName string - the name of this EA

getEAName(context) ⇒ string

EA SDK | This function gets the name of this EA.

Kind: global function
Returns: string - the name of this EA.

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

getPendingOrdersListLength(context) ⇒ number

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

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

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

getCancelledOrdersListLength(context) ⇒ number

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

Kind: global function
Returns: number - the length of the cancelled orders(including the rejected orders) list.

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

getPendingOrder(context, selector) ⇒ object

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

Kind: global function
Returns: object - the pending order.

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

getOrderId(order) ⇒ string

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

Kind: global function
Returns: string - the order ID.

Param Type Description
order object - the specific pending order or cancelled order or rejected order

getPrice(order) ⇒ number

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

Kind: global function
Returns: number - the price.

Param Type Description
order object - the specific pending order or cancelled order or rejected order

getTime(order) ⇒ number

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

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

Param Type Description
order object - the specific pending order or cancelled order or rejected order

getLots(order) ⇒ number

EA SDK | This function gets the volume lots(or the bet per pip when it comes to Spread Betting) of the specific pending order or cancelled order or rejected order. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - the volume lots(or the bet per pip when it comes to Spread Betting).

Param Type Description
order object - the specific pending order or cancelled order or rejected order

getExpiration(order) ⇒ number

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

Kind: global function
Returns: number - the expiration.

Param Type Description
order object - the specific pending order or cancelled order or rejected order

getOpenTradesListLength(context) ⇒ number

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

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

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

getHistoryTradesListLength(context) ⇒ number

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

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

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

getOpenTrade(context, selector) ⇒ object

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

Kind: global function
Returns: object - the open trade.

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

getBrokerName(orderOrTrade) ⇒ string

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

Kind: global function
Returns: string - the broker name.

Param Type Description
orderOrTrade object - the specific pending order or cancelled order or rejected order or open trade or historical trade

getAccountId(orderOrTrade) ⇒ string

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

Kind: global function
Returns: string - the account ID.

Param Type Description
orderOrTrade object - the specific pending order or cancelled order or rejected order or open trade or historical trade

getTradeId(trade) ⇒ string

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

Kind: global function
Returns: string - the trade ID.

Param Type Description
trade object - the specific open trade or historical trade

getSymbolName(orderOrTrade) ⇒ string

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

Kind: global function
Returns: string - the symbol name.

Param Type Description
orderOrTrade object - the specific pending order or cancelled order or rejected order or open trade or historical trade

getOpenPrice(trade) ⇒ number

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

Kind: global function
Returns: number - the open price.

Param Type Description
trade object - the specific open trade or historical trade

getOpenTime(trade) ⇒ number

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

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

Param Type Description
trade object - the specific open trade or historical trade

getOrderType(orderOrTrade) ⇒ number

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

Kind: global function
Returns: number - the order type(ORDER_TYPE.OP_BUY or ORDER_TYPE.OP_SELL or ORDER_TYPE.OP_BUYLIMIT or ORDER_TYPE.OP_SELLLIMIT or ORDER_TYPE.OP_BUYSTOP or ORDER_TYPE.OP_SELLSTOP).

Param Type Description
orderOrTrade object - the specific pending order or cancelled order or rejected order or open trade or historical trade

getOpenLots(trade) ⇒ number

EA SDK | This function gets the volume lots(or the bet per pip when it comes to Spread Betting) of the specific open trade or historical trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - the volume lots(or the bet per pip when it comes to Spread Betting).

Param Type Description
trade object - the specific open trade or historical trade

getTakeProfit(orderOrTrade) ⇒ number

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

Kind: global function
Returns: number - the take profit.

Param Type Description
orderOrTrade object - the specific pending order or cancelled order or rejected order or open trade or historical trade

getStopLoss(orderOrTrade) ⇒ number

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

Kind: global function
Returns: number - the stop loss.

Param Type Description
orderOrTrade object - the specific pending order or cancelled order or rejected order or open trade or historical 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 - the unrealized profit or loss.

Param Type Description
openTrade object - the specific open trade

getSwapPoint(trade) ⇒ number

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

Kind: global function
Returns: number - the swap point.

Param Type Description
trade object - the specific open trade or historical trade

getCommission(trade) ⇒ number

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

Kind: global function
Returns: number - the commission.

Param Type Description
trade object - the specific open trade or historical trade

getPL(trade) ⇒ number

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

Kind: global function
Returns: number - the PL(profit or loss).

Param Type Description
trade object - the specific historical trade

getMagicNumber(orderOrTrade) ⇒ number

EA SDK | This function gets the magic number of the specific pending order or cancelled order or rejected order or open trade or historical trade. Phase (this API's scope): onTick | deinit

Kind: global function
Returns: number - the magic number.

Param Type Description
orderOrTrade object - the specific pending order or cancelled order or rejected order or open trade or historical trade

getComment(orderOrTrade) ⇒ number

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

Kind: global function
Returns: number - the comment.

Param Type Description
orderOrTrade object - the specific pending order or cancelled order or rejected order or open trade or historical 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 as the name of the parameter of the initFunction
brokerName string - the broker name
accountId string - the account ID
symbolName string - the 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

Kind: global function
Returns: number - -- the bid.

Param Type Description
context object - the name should be the same as the name of the parameter of the onTickFunction
brokerName string - the broker name
accountId string - the account ID
symbolName string - the 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

Kind: global function
Returns: number - the ask.

Param Type Description
context object the name should be the same as the name of the parameter of the onTickFunction
brokerName string - the broker name
accountId string - the account ID
symbolName string - the symbol name

getCurrentTick(context) ⇒ object

EA SDK | This function gets the current tick data that triggered the onTick event. Phase (this API's scope): onTick

Kind: global function
Returns: object - the current tick data.

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

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

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

Kind: global function

Param Type Description
brokerName string - the broker name
accountId string - the account ID
symbolName string - the symbol name
orderType number - the order type(ORDER_TYPE.OP_BUY or OP_SELL or OP_BUYLIMIT or OP_SELLLIMIT or OP_BUYSTOP or OP_SELLSTOP)
price number - the price(if the order is a market order, the price should be set by zero or the current bid or the current ask)
slippage number - the slippage
volume number - the lots(or the bet per pip when it comes to Spread Betting)
takeProfit number - the take profit
stopLoss number - the stop loss
comment string - the comment
magicNumber number - the magic number
expiration number - the expiration

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

EA SDK | This function sends an order to the market to replace the specific order that the order ID refers to. Phase (this API's scope): onTick | deinit

Kind: global function

Param Type Description
brokerName string - the broker name
accountId string - the account ID
orderId string - the order ID
symbolName string - the symbol name
orderType number - the order type(ORDER_TYPE.OP_BUY or OP_SELL or OP_BUYLIMIT or OP_SELLLIMIT or OP_BUYSTOP or OP_SELLSTOP)
price number - the price(if the order is a market order, the price should be set by zero or the current bid or the current ask)
slippage number - the slippage
volume number - the lots(or the bet per pip when it comes to Spread Betting)
takeProfit number - the take profit
stopLoss number - the stop loss
comment string - the comment
magicNumber number - the magic number
expiration number - the expiration

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 - the broker name
accountId string - the account ID
orderId string - the 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 - the broker name
accountId string - the account ID
tradeId string - the trade ID
takeProfit number - the take profit
stopLoss number - the stop loss

closeTrade(brokerName, accountId, tradeId, price, slippage)

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

Kind: global function

Param Type Description
brokerName string - the broker name
accountId string - the account ID
tradeId string - the trade ID
price number - the price(the price should be set by zero or the current bid or the current ask)
slippage number - the slippage

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 the parameter.

Param Type Description
context object - the name should be the same as the name of the parameter of the onTickFunction
paramName string - the name of the 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 - the handle.

Param Type Description
context object - the name should be the same as the name of the parameter of the initFunction
brokerName string - the broker name
accountId string - the account ID
symbolName string - the symbol name
timeFrame string - the 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 - the handle.

Param Type Description
context object the name should be the same as the name of the parameter of the initFunction
brokerName string - the broker name
accountId string - the account ID
symbolName string - the symbol name
timeFrame string - the time frame
indiName string - the name of indicator
params array - the 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 - the data.

Param Type Description
context object - the name should be the same as the name of the parameter of the onTickFunction
handle number - the return value of the getChartHandle or the getIndicatorHandle
name string - the 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 the accounts list.

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

getAccount(context, selector) ⇒ object

EA SDK | This function gets the 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 as the name of the parameter of the initFunction or the deinitFunction or the onTickFunction
selector number - the index of the 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 - the broker name.

Param Type Description
account object - the 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 - the account ID.

Param Type Description
account object - the 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 - the currency name.

Param Type Description
account object - the specific account

getToFixedOfAccount(account) ⇒ string

EA SDK | This function gets the number to fixed-point of the specific account. Phase (this API's scope): init | onTick | deinit

Kind: global function
Returns: string - the number to fixed-point.

Param Type Description
account object - the 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 - the balance.

Param Type Description
account object - the 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 - the profit and loss statement.

Param Type Description
account object - the specific account

getUnrealizedPLOfAccount(account) ⇒ string

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

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

Param Type Description
account object - the 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 - the equity.

Param Type Description
account object - the 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 - the margin used.

Param Type Description
account object - the 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 - the margin available.

Param Type Description
account object - the specific account

setOptimizationResult(context, result)

EA SDK | This function sets the result for the optimization. Phase (this API's scope): deinit

Kind: global function

Param Type Description
context object the name should be the same as the name of parameter of deinitFunction
result number the result for the optimization

getLatestTransId(context) ⇒ string

EA SDK | This function gets the ID of the latest transaction that triggered the onTransaction event. Phase (this API's scope): onTick | onTransaction | deinit

Kind: global function
Returns: string - the ID of the latest transaction.

Param Type Description
context object the name should be the same as the name of the parameter of the onTransactionFunction

getLatestTransType(context) ⇒ string

EA SDK | This function gets the type of the latest transaction that triggered the onTransaction event. Phase (this API's scope): onTick | onTransaction | deinit

Kind: global function
Returns: string - the type of the latest transaction.

Param Type Description
context object the name should be the same as the name of the parameter of the onTransactionFunction
Clone this wiki locally