Skip to content

core

Classes

TradeXchartTradex_chart

Members

versionstring
namestring
shortNamestring
configobject
Chartobject
ChartPanesMap
Indicatorsobject
stateState
allDataobject

Functions

start(cfg)

Target element has been validated as a mount point, let's start building

on(topic, handler, context)boolean

Subscribe to a topic

off(topic, handler)boolean

Unsubscribe from a topic

emit(topic, data)boolean

Publish a topic

execute(topic, data, cb)

Execute a task

stopStream()

stop a chart stream will halt any updates to price or indicators

jumpToIndex(start, nearest, centre)

set Range start index

jumpToTS(ts, nearest, centre)

set Range start to time stamp

jumpToStart(centre)

set Range start to state data start

jumpToEnd(centre)

set Range start to state data end

mergeData(merge, newRange)

Merge a block of data into the chart state. Used for populating a chart with back history. Merge data must be formatted to a Chart State. Optionally set a new range upon merge.

isIndicator(i)boolean

validate indicator

setIndicators(i, flush)boolean

import Indicators

addIndicator(i, name, params)Indicator | false

add an indicator - default or registered user defined

getIndicator(i)Indicator | false

retrieve indicator by ID

removeIndicator(i)boolean

remove an indicator - default or registered user defined

indicatorSettings(i, s)Object

set or get indicator settings

hasStateIndicator(i, dataset)Indicator | false

Does current chart state have indicator

calcAllIndicators()

calculate all indicators currently in use

TradeXchart ⇐ Tradex_chart

Kind: global class
Extends: Tradex_chart

new TradeXchart()

The root class for the entire chart

TradeXchart.create(container, [txCfg], state) ⇒ instance

Create a new TradeXchart instance

Kind: static method of TradeXchart
Returns: instance - TradeXchart

ParamTypeDefaultDescription
containerDOM_elementHTML element to mount the chart on
[txCfg]Object{}chart config
stateObjectchart state

TradeXchart.destroy(chart)

Destroy a chart instance, clean up and remove data

Kind: static method of TradeXchart

ParamType
chartinstance

TradeXchart.destroy()

Stop all chart event processing and remove the chart from DOM. In other words, destroy the chart.

Kind: static method of TradeXchart

TradeXchart.setDimensions(w, h)

Set chart width and height

Kind: static method of TradeXchart

ParamTypeDescription
wnumberwidth in pixels
hnumberheight in pixels

TradeXchart.setPricePrecision(pricePrecision)

Set the price accuracy

Kind: static method of TradeXchart

ParamTypeDescription
pricePrecisionnumberPrice accuracy

TradeXchart.setVolumePrecision(volumePrecision)

Set the volume accuracy

Kind: static method of TradeXchart

ParamTypeDescription
volumePrecisionnumberVolume accuracy

TradeXchart.addTheme(theme) ⇒ instance

Add a theme to the chart, if no current theme is set, make this the current one.

Kind: static method of TradeXchart
Returns: instance - - theme instance

ParamTypeDescription
themeObjectVolume accuracy

TradeXchart.setTheme(theme) ⇒ boolean

Set the chart theme

Kind: static method of TradeXchart

ParamTypeDescription
themestringtheme identifier

TradeXchart.setStream(stream) ⇒ instance

specify a chart stream

Kind: static method of TradeXchart

ParamType
streamObject

TradeXchart.getRange(start, end)

initialize range

Kind: static method of TradeXchart

ParamTypeDefaultDescription
startnumber0index
endnumber0index

TradeXchart.setRange(start, end)

set start and end of range

Kind: static method of TradeXchart

ParamTypeDefaultDescription
startnumber0index
endnumberindex

TradeXchart.resize(width, height) ⇒ boolean

Resize the chart

Kind: static method of TradeXchart
Returns: boolean - - success or failure

ParamTypeDescription
widthnumberpixels
heightnumberpixels

TradeXchart.refresh()

refresh / redraw the chart

Kind: static method of TradeXchart

version ⇒ string

Kind: global variable
Returns: string - - return TradeX Chart version number

name ⇒ string

Kind: global variable
Returns: string - - user defined chart name

shortName ⇒ string

Kind: global variable
Returns: string - - user defined short chart name

config ⇒ object

Kind: global variable
Returns: object - - current chart configuration including defaults

Chart ⇒ object

Kind: global variable
Returns: object - - primary chart pane - displays price history (candles)

ChartPanes ⇒ Map

Kind: global variable
Returns: Map - - all chart panes, primary and secondary

Indicators ⇒ object

Kind: global variable
Returns: object - - all chart indicators in use, grouped by chart panes

state ⇒ State

Kind: global variable
Returns: State - - current state instance

allData ⇒ object

Kind: global variable
Returns: object - - all state datasets

start(cfg)

Target element has been validated as a mount point, let’s start building

Kind: global function

ParamTypeDescription
cfgObjectchart configuration

on(topic, handler, context) ⇒ boolean

Subscribe to a topic

Kind: global function

ParamTypeDescription
topicstringThe topic name
handlerfunctionThe function or method that is called
contextObjectThe context the function(s) belongs to

off(topic, handler) ⇒ boolean

Unsubscribe from a topic

Kind: global function

ParamTypeDescription
topicstringThe topic name
handlerfunctionfunction to remove

emit(topic, data) ⇒ boolean

Publish a topic

Kind: global function

ParamTypeDescription
topicstringThe topic name
dataObjectThe data to publish

execute(topic, data, cb)

Execute a task

Kind: global function

ParamTypeDescription
topicstringThe topic name
dataObjectThe data that gets published
cbfunctioncallback method

stopStream()

stop a chart stream will halt any updates to price or indicators

Kind: global function

jumpToIndex(start, nearest, centre)

set Range start index

Kind: global function

ParamTypeDefaultDescription
startnumberstarting index of state data
nearestbooleantruelimit range start - no out of range values
centrebooleantruecenter the range on the start value

jumpToTS(ts, nearest, centre)

set Range start to time stamp

Kind: global function

ParamTypeDefaultDescription
tsnumbertimestamp
nearestbooleantruelimit range start - no out of range values
centrebooleantruecenter the range on the start value

jumpToStart(centre)

set Range start to state data start

Kind: global function

ParamTypeDefaultDescription
centrebooleantruecenter the range on the start value

jumpToEnd(centre)

set Range start to state data end

Kind: global function

ParamTypeDefaultDescription
centrebooleantruecenter the range on the end value

mergeData(merge, newRange)

Merge a block of data into the chart state. Used for populating a chart with back history. Merge data must be formatted to a Chart State. Optionally set a new range upon merge.

Kind: global function

ParamTypeDefaultDescription
mergeObjectmerge data must be formatted to a Chart State
newRangeboolean | objectfalsefalse

isIndicator(i) ⇒ boolean

validate indicator

Kind: global function

ParamTypeDescription
iclassindicator class

setIndicators(i, flush) ⇒ boolean

import Indicators

Kind: global function

ParamTypeDefaultDescription
iObjectindicators {id, name, event, ind}
flushbooleanfalseexpunge default indicators

addIndicator(i, name, params) ⇒ Indicator | false

add an indicator - default or registered user defined

Kind: global function
Returns: Indicator | false - - indicator instance or false

ParamTypeDescription
istringindicator
namestringidentifier
paramsObject{settings, data}

getIndicator(i) ⇒ Indicator | false

retrieve indicator by ID

Kind: global function
Returns: Indicator | false - - indicator instance or false

ParamTypeDescription
istringindicator ID

removeIndicator(i) ⇒ boolean

remove an indicator - default or registered user defined

Kind: global function
Returns: boolean - - success / failure

ParamTypeDescription
istring | Indicatorindicator id or Indicator instance

indicatorSettings(i, s) ⇒ Object

set or get indicator settings

Kind: global function
Returns: Object - - settings

ParamTypeDescription
istring | Indicatorindicator id or Indicator instance
sObjectsettings

hasStateIndicator(i, dataset) ⇒ Indicator | false

Does current chart state have indicator

Kind: global function

ParamTypeDefaultDescription
istringindicator id or name
datasetstring“searchAll”

calcAllIndicators()

calculate all indicators currently in use

Kind: global function