diff --git a/.babelrc b/.babelrc index bb09b5ee..8051f63b 100644 --- a/.babelrc +++ b/.babelrc @@ -1 +1,10 @@ -{ "presets": ["@babel/env"] } \ No newline at end of file +{ + "presets": ["@babel/env"], + "plugins": [ + "@babel/plugin-transform-runtime", + [ + "@babel/plugin-transform-parameters", + { "loose": true } + ] + ] +} diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..70482180 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,24 @@ +module.exports = { + "env": { + "browser": true, + "es6": true + }, + "extends": [ + "eslint:recommended", + "plugin:vue/recommended" + ], + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + }, + "plugins": [ + "vue" + ], + "rules": { + "vue/html-indent": "off" + } +}; diff --git a/.github/ISSUE_TEMPLATE/full-template.md b/.github/ISSUE_TEMPLATE/full-template.md new file mode 100644 index 00000000..10c2caef --- /dev/null +++ b/.github/ISSUE_TEMPLATE/full-template.md @@ -0,0 +1,32 @@ +--- +name: Full Template +about: Perfect for almost everything. +title: '' +labels: '' +assignees: '' + +--- + +## (!important) Maybe you would prefer making an interactive demo with https://tvjs.io/play. If so, please select the PlayGround template. + +## (!important 2) Consider reading the [FAQ](https://github.com/tvjsx/trading-vue-js/tree/master/docs/faq) first, because it helps to solve 82% of issues. + +## Description + +Behaviour / expected behaviour + +## Screenshot + +## Code (MVP) + +## Data Sample + +The data sample must follow the current [data structure](https://github.com/C451/trading-vue-js/tree/master/docs/api#data-structure-new). + +## Console errors (if any) + +## Additional Info + +(if needed to reproduce the issue) + +(tvjs version, OS, browser, npm version...) diff --git a/.github/ISSUE_TEMPLATE/playground.md b/.github/ISSUE_TEMPLATE/playground.md new file mode 100644 index 00000000..e46b1f08 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/playground.md @@ -0,0 +1,16 @@ +--- +name: PlayGround +about: Online editor of tvjs-apps https://tvjs.io/play +title: '' +labels: '' +assignees: '' + +--- + +## Description + +Behaviour / expected behaviour + +## Demo + +https://tvjs.io/play?a=xxxxxxxx diff --git a/.github/ISSUE_TEMPLATE/question---feature-request.md b/.github/ISSUE_TEMPLATE/question---feature-request.md new file mode 100644 index 00000000..eab1fa2c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question---feature-request.md @@ -0,0 +1,12 @@ +--- +name: Question / Feature request +about: Freestyle issue (for bugs/problems use the templates above) +title: '' +labels: '' +assignees: '' + +--- + +## (!Important) Freestyle issue. In case you're trying to describe some problem or bug, you need to start with a full template (Full Template / PlayGround), otherwise the issue is likely to be closed. + +## (!important 2) Consider reading the [FAQ](https://github.com/tvjsx/trading-vue-js/tree/master/docs/faq) first, because it helps to solve 82% of issues. diff --git a/.gitignore b/.gitignore index 9daa8247..0ead4a87 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ .DS_Store node_modules +cdn_status.js +ww$$$.json +package-lock.json diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..b83ce0f3 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,119 @@ +# Changelog +All notable changes to this project will be documented in this file. + +## [0.10.0] - 2020-12-07 + +- The first package of mobile improvements +- Enhances skins +- Small modifications of scripts execution +- Improvements of Interfaces (aka inline overlay UI) +- Script fixes (update onchart/offchart OVs) +- New aggtype: copy (fast aggregation through copying) +- CSS tranforms support (transition) +- Overlay name templates, e.g. "RSI, $length" +- Fixed loading animation for some cases + +## [0.9.0] - 2020-11-17 + +- Scripts: advanced samplers (sym() function) +- Implemented Dataset ops (update, merge, remove) +- Countless small bug fixes as always +- Scripts: add onclose() +- Fixed auto-scroll (when new candle is added) +- Scripts: offchart/onchart updates +- DC: aggtool v2 (completely rewritten) +- Custom legend buttons (your custom icon) +- Tool groups +- Scroll wheel modes: prevent, pass, click +- WebWorker RAM limit +- LineTool: add Ray mode +- Legend buttons handlers [EXT] + +## [0.8.0] - 2020-10-15 + +- Timezones (initial support) +- Extended shader props +- Show/hide scalebars (via chart-config sizes) +- Chart section resizing [Ext] +- Linked charts [Ext] +- Shift + drag => Measure +- Various bug kills and memory leak demolitions +- Scripts: onrange exec, node.js SE exec (opt) +- Scripts: added support of 'tf', 'range' +- Updated RangeTool +- Datasets, very first try +- 30% build size decrease + +## [0.7.0] - 2020-9-15 +- Extensions (widgets, colorpacks & skins v1) +- Pins & toolbar bug fixes +- WebWorker modules (emitted from extension) +- Std lib injections (though WW modules) +- Improved fn argument parsing for scripts +- Splines overlay: skipNaN mode +- Scripts: multi-tf TA, how cool is that? +- Scripts: hl2, hlc3, ohlc4 and potentially more in the futr +- Script: SE hooks for backtester mod (if you like) +- Hooks on the internal events (now only for Chart.vue) +- Fixed legend values (when grid.id is custom) +- DC: some improvements & new settings +- lz-string compression for the WW code. Supr fast + +## [0.6.0] - 2020-8-15 +- Scripts (early state) +- DC faster update() +- DC tick aggregation +- Improved offchart overlayz performance +- Multiple bug fixes +- +30 Std overlayz (MACD, DMI, Stoch ...) +- Overlay loading state (animation) +- TradingLite-like zoom mode +- Better IB mode + Illuminati test + +## [0.5.0] - 2020-5-5 +### Changes +- Index-based rendering mode (hides weekend gaps + sup Renko) +- Log-scale mode +- Interfaces (preview) +- Performance fixes +- Zoom to the current candle mode +- Pixel-perfect candles, candle wicks +- Offchart drawing tools +- Price level +- Custom grid heights +- Sidear & Botbar inline shaders +- Added RangeTool +- Forced chart timeframe (overwrites the auto-detected one) +- Updated DataCube + +## [0.4.0] - 2019-11-2 +### Changes +- Multiple bug fixes and improvements +- Legend buttons +- New/updated overlays (Segment, Splitters, Candles) +- Data Structure v1.1 +- Mac support (Trackpad + Retina) +- New API functions: setRange(), goto(), getCursor() etc. +- Better timeline +- New interval detection algo +- DataCube +- Tool overlay extension +- Drawing tools (Line, Extended Line) + +## [0.3.0] - 2019-5-17 +### Changes +- Multiple bug fixes (legend, slicelib, cursor) +- New overlays: Trades, Channel, Splines +- Added visual testing suite +- Mouse events for overlays +- Several fixes that made charts sharper and slicker +- Hackable chart config. Heck, how can the most hackable lib be without it? + +## [0.2.0] - 2019-3-27 +### Changes +- Added y-range transform for overlays +- Performance boost with fancy slice lib +- Implemented z-index ordering +- Vertical scaling implementation v1 +- Added data masking feature, now you can include strings +- Several smaller fixes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..49decb4b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,32 @@ +*{ This file will be updated along the way }* + +## There are several things you should be aware of as a contributor: + +1. You are a great human. Seriously. You try to make the world a better place while 90% of population are just selfish consumers. +2. If you have a big idea for the project, let's discuss it first. It would be very sad, if you spent time on something that does not align with project's direction. +3. Commits are better with pull-requests and clear explanation. +4. Good people === good times. Please, be respectful to other folks. +5. If you are the one who found a security bug, mail it to codeallright@protonmail.com ASAP (despite the funny address name). + +## Ways to contribute + +1. The easiest way to contribute is to fix bad grammar in the docs or files like this. +2. The most creative way to contribute is to make built-in indicators. Although this library is positioned as an assembler, we should have a nice set of standard indicators. +3. If you are true code Jedi, you can help solve performance problems and reactivity bugs. There are already plenty of things to do, just search for **"TODO: IMPORTANT"** +4. If you are a designer and something hurts your eyes, feel free to submit a suggestion. Don't like colors? Or maybe you have an idea for an icon? Tell us! +5. Make a project using this library. This will be a huge contribution. + +## Code style guide + +1. Please, keep the lines short. 80 chars max. +2. If a .js or .vue module is significantly longer than 250 line, it might be a good idea to split it into two. +3. If a function is longer than 50 lines, then this is definitely a candidate for refactoring. +4. snake_case is everywhere except the top-level component props (TradingVue.vue). +5. The project doesn't use semicolons. Sorry, semicolon lovers. + +And finally: + +## Let's make the singularity closer (I'm sure it will be fun)! + +~ +That's all. I personally hate long and boring docs. Have a great morning/day/evening! diff --git a/DONATION.md b/DONATION.md new file mode 100644 index 00000000..c0c019cc --- /dev/null +++ b/DONATION.md @@ -0,0 +1,12 @@ + +# Donation + +If you are using the lib and think that's awesome: + +**BTC** 19vDB2pyn2ndJBH4p6We2SJNe8VZggyxfG + +**ETH** 0xFD3e4be6d3dAfCba7aFC7BE8b3D00847682158e8 + +# List of contributors + +https://github.com/stkbt diff --git a/README.md b/README.md index a0c8d140..7b12e29a 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,287 @@
+
+
+TSCreates a new time-series & records each x. +Returns an array. Id is auto-genrated
+TSCreates a new time-series & records each x. +Uses Sampler to aggregate the values +Return the an array. Id is auto-genrated
+*Replaces the variable if it's NaN
+booleanIs the variable NaN ?
+*Replaces the var with NaN if Infinite
+TSAdds values / time-series
+TSSubtracts values / time-series
+TSMultiplies values / time-series
+TSDivides values / time-series
+TSReturns a negative value / time-series
+numberAbsolute value
+numberArccosine function
+Emits an event to DataCube
+Emits an event if cond === true
+TSArnaud Legoux Moving Average
+numberArcsine function
+numberArctangent function
+TSAverage True Range
+numberAverage of arguments
+Candles since the event occured (cond === true)
+Array.<TS>Bollinger Bands
+TSBollinger Bands Width
+numberConverts the variable to Boolean
+TSCommodity Channel Index
+numberShortcut for Math.ceil()
+TSChange: x[0] - x[len]
+TSChande Momentum Oscillator
+TSCenter of Gravity
+numberCosine function
+TSWhen one time-series crosses another
+TSWhen one time-series goes over another one
+TSWhen one time-series goes under another one
+TSSum of all elements of src
+numberDay of month, literally
+numberDay of week, literally
+TSDeviation from SMA
+TSDirectional Movement Index ADX, +DI, -DI
+TSExponential Moving Average with alpha = 2 / (y + 1)
+numberShortcut for Math.exp()
+TSTest if "src" TS is falling for "len" candles
+TSFor a given series replaces NaN values with +previous nearest non-NaN value
+numberShortcut for Math.floor()
+TSHighest value for a given number of candles back
+Highest value offset for a given number of bars back
+TSHull Moving Average
+numberReturns hours of a given timestamp
+*Returns x or y depending on the condition
+Array.<TS>Keltner Channels
+TSKeltner Channels Width
+TSLinear Regression
+numberShortcut for Math.log()
+numberShortcut for Math.log10()
+TSLowest value for a given number of candles back
+Lowest value offset for a given number of bars back
+Array.<TS>Moving Average Convergence/Divergence
+numberMax of arguments
+Sends update to some overlay / main chart
+Sets the reverse buffer size for a given +time-series (default = 5, grows on demand)
+TSMoney Flow Index
+numberMin of arguments
+numberReturns minutes of a given timestamp
+TSMomentum
+numberMonth
+Display data point onchart +(create a new overlay in DataCube)
+Display data point offchart +(create a new overlay in DataCube)
+booleanReturns true when the candle(
Sends settings update +(can be called from init(), update() or post())
+TSShifts TS left or right by "num" candles
+numberThe current time
+TSReturns price of the pivot high point
+Tip: works best with offset function
TSReturns price of the pivot low point
+Tip: works best with offset function
numberShortcut for Math.pow()
+TSTest if "src" TS is rising for "len" candles
+TSExponentially MA with alpha = 1 / length +Used in RSI
+TSRate of Change
+numberShortcut for Math.round()
+TSRelative Strength Index
+TSParabolic SAR
+numberReturns seconds of a given timestamp
+numberShortcut for Math.sing()
+numberSine function
+TSSimple Moving Average
+numberShortcut for Math.sqrt()
+TSStandard deviation
+TSStochastic
+TSReturns the sliding sum of last "len" values of the source
+Array.<TS>Supertrend Indicator
+TSSymmetrically Weighted Moving Average
+SymCreates a new Symbol.
+numberTangent function
+TSTrue Range
+TSTrue strength index
+TSVolume Weighted Moving Average
+numberWeek of year, literally
+TSWeighted moving average
+TSWilliams %R
+numberYear
+TS
+Creates a new time-series & records each x.
+Returns an array. Id is auto-genrated
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | \* | A variable to sample from |
+
+
+
+## tstf(x, tf) â TS
+Creates a new time-series & records each x.
+Uses Sampler to aggregate the values
+Return the an array. Id is auto-genrated
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | \* | A variable to sample from |
+| tf | number \| string | Timeframe in ms or as a string |
+
+
+
+## nz(x, [v]) â \*
+Replaces the variable if it's NaN
+
+**Kind**: global function
+**Returns**: \* - - New value
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | \* | The variable |
+| [v] | \* | A value to replace with |
+
+
+
+## na(x) â boolean
+Is the variable NaN ?
+
+**Kind**: global function
+**Returns**: boolean - - New value
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | \* | The variable |
+
+
+
+## nf(x, [v]) â \*
+Replaces the var with NaN if Infinite
+
+**Kind**: global function
+**Returns**: \* - - New value
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | \* | The variable |
+| [v] | \* | A value to replace with |
+
+
+
+## add(x, y) â TS
+Adds values / time-series
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | TS \| \* | First input |
+| y | TS \| \* | Second input |
+
+
+
+## sub(x, y) â TS
+Subtracts values / time-series
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | TS \| \* | First input |
+| y | TS \| \* | Second input |
+
+
+
+## mult(x, y) â TS
+Multiplies values / time-series
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | TS \| \* | First input |
+| y | TS \| \* | Second input |
+
+
+
+## div(x, y) â TS
+Divides values / time-series
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | TS \| \* | First input |
+| y | TS \| \* | Second input |
+
+
+
+## neg(x) â TS
+Returns a negative value / time-series
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | TS \| \* | Input |
+
+
+
+## abs(x) â number
+Absolute value
+
+**Kind**: global function
+**Returns**: number - - Absolute value
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | Input |
+
+
+
+## acos(x) â number
+Arccosine function
+
+**Kind**: global function
+**Returns**: number - - Arccosine of x
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | Input |
+
+
+
+## signal(type, data)
+Emits an event to DataCube
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| type | string | Signal type |
+| data | \* | Signal data |
+
+
+
+## signalif(cond, type, data)
+Emits an event if cond === true
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| cond | boolean \| TS | The condition |
+| type | string | Signal type |
+| data | \* | Signal data |
+
+
+
+## alma(src, len, offset, sigma) â TS
+Arnaud Legoux Moving Average
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+| offset | number | Offset |
+| sigma | number | Sigma |
+
+
+
+## asin(x) â number
+Arcsine function
+
+**Kind**: global function
+**Returns**: number - - Arcsine of x
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | Input |
+
+
+
+## atan(x) â number
+Arctangent function
+
+**Kind**: global function
+**Returns**: number - - Arctangent of x
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | Input |
+
+
+
+## atr(len) â TS
+Average True Range
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| len | number | Length |
+
+
+
+## avg(...args) â number
+Average of arguments
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| ...args | number | Numeric values |
+
+
+
+## since(cond)
+Candles since the event occured (cond === true)
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| cond | boolean \| TS | the condition |
+
+
+
+## bb(src, len, mult) â Array.<TS>
+Bollinger Bands
+
+**Kind**: global function
+**Returns**: Array.<TS> - - Array of new time-series (3 bands)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+| mult | number | Multiplier |
+
+
+
+## bbw(src, len, mult) â TS
+Bollinger Bands Width
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+| mult | number | Multiplier |
+
+
+
+## bool(x) â number
+Converts the variable to Boolean
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | The variable |
+
+
+
+## cci(src, len) â TS
+Commodity Channel Index
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## ceil(x) â number
+Shortcut for Math.ceil()
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | The variable |
+
+
+
+## change(src, [len]) â TS
+Change: x[0] - x[len]
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| src | TS | | Input |
+| [len] | number | 1 | Length |
+
+
+
+## cmo(src, len) â TS
+Chande Momentum Oscillator
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## cog(src, len) â TS
+Center of Gravity
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## cos(x) â number
+Cosine function
+
+**Kind**: global function
+**Returns**: number - - Cosine of x
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | Input |
+
+
+
+## cross(src1, src2) â TS
+When one time-series crosses another
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src1 | TS | TS1 |
+| src2 | TS | TS2 |
+
+
+
+## crossover(src1, src2) â TS
+When one time-series goes over another one
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src1 | TS | TS1 |
+| src2 | TS | TS2 |
+
+
+
+## crossunder(src1, src2) â TS
+When one time-series goes under another one
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src1 | TS | TS1 |
+| src2 | TS | TS2 |
+
+
+
+## cum(src1) â TS
+Sum of all elements of src
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src1 | TS | Input |
+
+
+
+## dayofmonth([time]) â number
+Day of month, literally
+
+**Kind**: global function
+**Returns**: number - - Day
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [time] | number | Time in ms (current t, if not defined) |
+
+
+
+## dayofweek([time]) â number
+Day of week, literally
+
+**Kind**: global function
+**Returns**: number - - Day
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [time] | number | Time in ms (current t, if not defined) |
+
+
+
+## dev(src, len) â TS
+Deviation from SMA
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## dmi(len, smooth) â TS
+Directional Movement Index ADX, +DI, -DI
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| len | number | Length |
+| smooth | number | Smoothness |
+
+
+
+## ema(src, len) â TS
+Exponential Moving Average with alpha = 2 / (y + 1)
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## exp(x) â number
+Shortcut for Math.exp()
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | The variable |
+
+
+
+## falling(src, len) â TS
+Test if "src" TS is falling for "len" candles
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## fixnan(src) â TS
+For a given series replaces NaN values with
+previous nearest non-NaN value
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input time-series |
+
+
+
+## floor(x) â number
+Shortcut for Math.floor()
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | The variable |
+
+
+
+## highest(src, len) â TS
+Highest value for a given number of candles back
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## highestbars(src, len)
+Highest value offset for a given number of bars back
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## hma(src, len) â TS
+Hull Moving Average
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## hour([time]) â number
+Returns hours of a given timestamp
+
+**Kind**: global function
+**Returns**: number - - Hour
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [time] | number | Time in ms (current t, if not defined) |
+
+
+
+## iff(cond, x, y) â \*
+Returns x or y depending on the condition
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| cond | boolean \| TS | Condition |
+| x | \* | Frist value |
+| y | \* | Second value |
+
+
+
+## kc(src, len, mult, [use_tr]) â Array.<TS>
+Keltner Channels
+
+**Kind**: global function
+**Returns**: Array.<TS> - - Array of new time-series (3 bands)
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| src | TS | | Input |
+| len | number | | Length |
+| mult | number | | Multiplier |
+| [use_tr] | boolean | true | Use true range |
+
+
+
+## kcw(src, len, mult, [use_tr]) â TS
+Keltner Channels Width
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| src | TS | | Input |
+| len | number | | Length |
+| mult | number | | Multiplier |
+| [use_tr] | boolean | true | Use true range |
+
+
+
+## linreg(src, len, offset) â TS
+Linear Regression
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| src | TS | | Input |
+| len | number | | Length |
+| offset | number | 0 | Offset |
+
+
+
+## log(x) â number
+Shortcut for Math.log()
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | The variable |
+
+
+
+## log10(x) â number
+Shortcut for Math.log10()
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | The variable |
+
+
+
+## lowest(src, len) â TS
+Lowest value for a given number of candles back
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## lowestbars(src, len)
+Lowest value offset for a given number of bars back
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## macd(src, fast, slow, sig) â Array.<TS>
+Moving Average Convergence/Divergence
+
+**Kind**: global function
+**Returns**: Array.<TS> - - [macd, signal, hist]
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| fast | number | Fast EMA |
+| slow | number | Slow EMA |
+| sig | number | Signal |
+
+
+
+## max(...args) â number
+Max of arguments
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| ...args | number | Numeric values |
+
+
+
+## modify(id, fields)
+Sends update to some overlay / main chart
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| id | string | Overlay id |
+| fields | Object | Fields to be overwritten |
+
+
+
+## buffsize(src, len)
+Sets the reverse buffer size for a given
+time-series (default = 5, grows on demand)
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | New length |
+
+
+
+## mfi(src, len) â TS
+Money Flow Index
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## min(...args) â number
+Min of arguments
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| ...args | number | Numeric values |
+
+
+
+## minute([time]) â number
+Returns minutes of a given timestamp
+
+**Kind**: global function
+**Returns**: number - - Hour
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [time] | number | Time in ms (current t, if not defined) |
+
+
+
+## mom(src, len) â TS
+Momentum
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## month([time]) â number
+Month
+
+**Kind**: global function
+**Returns**: number - - Day
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [time] | number | Time in ms (current t, if not defined) |
+
+
+
+## onchart(x, [name], [sett])
+Display data point onchart
+(create a new overlay in DataCube)
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | TS \| Array.<TS> \| \* | Data point / TS / array of TS |
+| [name] | string | Overlay name |
+| [sett] | Object | Object with settings & OV type |
+
+
+
+## offchart(x, [name], [sett])
+Display data point offchart
+(create a new overlay in DataCube)
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | TS \| Array.<TS> \| \* | Data point / TS / array of TS |
+| [name] | string | Overlay name |
+| [sett] | Object | Object with settings & OV type |
+
+
+
+## onclose(tf) â boolean
+Returns true when the candle(number \| string | Timeframe in ms or as a string |
+
+
+
+## settings(upd)
+Sends settings update
+(can be called from init(), update() or post())
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| upd | Object | Settings update (object to merge) |
+
+
+
+## offset(num) â TS
+Shifts TS left or right by "num" candles
+
+**Kind**: global function
+**Returns**: TS - - New / existing time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| num | number | Offset measured in candles |
+
+
+
+## now() â number
+The current time
+
+**Kind**: global function
+**Returns**: number - - timestamp
+
+
+## pivothigh(src, left, right) â TS
+Returns price of the pivot high point
+Tip: works best with `offset` function
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| left | number | left threshold, candles |
+| right | number | right threshold, candles |
+
+
+
+## pivotlow(src, left, right) â TS
+Returns price of the pivot low point
+Tip: works best with `offset` function
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| left | number | left threshold, candles |
+| right | number | right threshold, candles |
+
+
+
+## pow(x) â number
+Shortcut for Math.pow()
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | The variable |
+
+
+
+## rising(src, len) â TS
+Test if "src" TS is rising for "len" candles
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## rma(src, len) â TS
+Exponentially MA with alpha = 1 / length
+Used in RSI
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## roc(src, len) â TS
+Rate of Change
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## round(x) â number
+Shortcut for Math.round()
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | The variable |
+
+
+
+## rsi(x, y) â TS
+Relative Strength Index
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | TS | First Input |
+| y | number \| TS | Second Input |
+
+
+
+## sar(start, inc, max) â TS
+Parabolic SAR
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| start | number | Start |
+| inc | number | Increment |
+| max | number | Maximum |
+
+
+
+## second([time]) â number
+Returns seconds of a given timestamp
+
+**Kind**: global function
+**Returns**: number - - Hour
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [time] | number | Time in ms (current t, if not defined) |
+
+
+
+## sign(x) â number
+Shortcut for Math.sing()
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | The variable |
+
+
+
+## sin(x) â number
+Sine function
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | The variable |
+
+
+
+## sma(src, len) â TS
+Simple Moving Average
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## sqrt(x) â number
+Shortcut for Math.sqrt()
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | The variable |
+
+
+
+## stdev(src, len) â TS
+Standard deviation
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## stoch(src, high, low, len) â TS
+Stochastic
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| high | TS | TS of high |
+| low | TS | TS of low |
+| len | number | Length |
+
+
+
+## sum(src, len) â TS
+Returns the sliding sum of last "len" values of the source
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | Length |
+
+
+
+## supertrend(factor, atrlen) â Array.<TS>
+Supertrend Indicator
+
+**Kind**: global function
+**Returns**: Array.<TS> - - Supertrend line and direction of trend
+
+| Param | Type | Description |
+| --- | --- | --- |
+| factor | number | ATR multiplier |
+| atrlen | number | Length of ATR |
+
+
+
+## swma(src) â TS
+Symmetrically Weighted Moving Average
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+
+
+
+## sym(x, y) â Sym
+Creates a new Symbol.
+
+**Kind**: global function
+**Returns**: Sym - Argument variations:
+(Array), [\* | Something, depends on arg variation |
+| y | \* | Something, depends on arg variation |
+
+
+
+## tan(x) â number
+Tangent function
+
+**Kind**: global function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| x | number | The variable |
+
+
+
+## tr(fixnan) â TS
+True Range
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| fixnan | TS | false | Fix NaN values |
+
+
+
+## tsi(src, short, long) â TS
+True strength index
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| short | number | Short length |
+| long | number | Long length |
+
+
+
+## vwma(src, len) â TS
+Volume Weighted Moving Average
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | length |
+
+
+
+## weekofyear([time]) â number
+Week of year, literally
+
+**Kind**: global function
+**Returns**: number - - Week
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [time] | number | Time in ms (current t, if not defined) |
+
+
+
+## wma(src, len) â TS
+Weighted moving average
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| src | TS | Input |
+| len | number | length |
+
+
+
+## wpr(len) â TS
+Williams %R
+
+**Kind**: global function
+**Returns**: TS - - New time-series
+
+| Param | Type | Description |
+| --- | --- | --- |
+| len | number | length |
+
+
+
+## year([time]) â number
+Year
+
+**Kind**: global function
+**Returns**: number - - Year
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [time] | number | Time in ms (current t, if not defined) |
diff --git a/docs/api/assets/IB.gif b/docs/api/assets/IB.gif
new file mode 100644
index 00000000..cb793f26
Binary files /dev/null and b/docs/api/assets/IB.gif differ
diff --git a/docs/api/assets/README-0487d08a.png b/docs/api/assets/README-0487d08a.png
new file mode 100644
index 00000000..90ec7681
Binary files /dev/null and b/docs/api/assets/README-0487d08a.png differ
diff --git a/docs/api/assets/README-6ce736c2.png b/docs/api/assets/README-6ce736c2.png
new file mode 100644
index 00000000..0155758b
Binary files /dev/null and b/docs/api/assets/README-6ce736c2.png differ
diff --git a/docs/api/assets/README-b0d2d797.png b/docs/api/assets/README-b0d2d797.png
new file mode 100644
index 00000000..1a450746
Binary files /dev/null and b/docs/api/assets/README-b0d2d797.png differ
diff --git a/docs/api/assets/README-bc4359ae.png b/docs/api/assets/README-bc4359ae.png
new file mode 100644
index 00000000..dedb0829
Binary files /dev/null and b/docs/api/assets/README-bc4359ae.png differ
diff --git a/docs/api/assets/README-cbe4028c.png b/docs/api/assets/README-cbe4028c.png
new file mode 100644
index 00000000..85599208
Binary files /dev/null and b/docs/api/assets/README-cbe4028c.png differ
diff --git a/docs/api/assets/README-ed2c9def.png b/docs/api/assets/README-ed2c9def.png
new file mode 100644
index 00000000..2c42dd06
Binary files /dev/null and b/docs/api/assets/README-ed2c9def.png differ
diff --git a/docs/datacube/README.md b/docs/datacube/README.md
new file mode 100644
index 00000000..f6723789
--- /dev/null
+++ b/docs/datacube/README.md
@@ -0,0 +1,311 @@
+# DataCube API
+
+This guide version is **0.10.0**
+
+
+
+**DataCube** [WIP] is a helper class designed for data manipulation. `Trading-vue` component provides only rendering functionality, but with the help of DC it also enables features such as real-time chart updates, indicator calculations and drawing tools (and much more).
+
+Use DC to wrap your data object:
+
+```html
+
+ +Oh and you can also connect them to the main controller via `EventBus`. Sounds like a lot of new possibilities, huh? +
+
++ + + +
++ + + +
++ + + +
++ + + +
+
+Only update() function is shown here
+Examples can be tested with test#14 (`npm run test`)
+
+```js
+
+// (high + low) / 2
+let middle = div(add(high, low), 2)
+
+// Make a new onchart overlay &
+// push middle[0]
+onchart(middle)
+
+// Create a new TS with the random noise
+let rnd = ts(Math.random())
+// Display it as offchart overlay
+// with name 'RND' & custom settings
+offchart(rnd, 'RND', {color:'red'})
+
+```
+
+Only update() function is shown here
+Examples can be tested with test#14 (`npm run test`)
+
+```js
+
+// Display the current iteration
+offchart(iter)
+
+// Calculate the middle of the time range
+// (calculated only once, see Script execution modes
+// to make a real-time version)
+let m = (range[0] + range[1]) / 2
+offchart(t > m && t <= m + tf ? 1 : 0)
+
+```
+
+Only update() function is shown here
+Examples can be tested with test#14 (`npm run test`)
+
+```js
+
+// Daily Bollinger Bands on a intraday chart
+let [m, h, l] = bb(close1D, 20, 1)
+onchart([h[1], m[1], l[1]], 'BB', {type: 'Channel'})
+
+```
+
+{{current_test.description}} [{{test_index+1}}/{{len}}] + + â ïļ + +
+ + + + + + Prev test + + + Next test + +