ohlcv-indicators 1.1.7 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ohlcv-indicators.min.js +1 -1
- package/index.js +2 -2
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see ohlcv-indicators.min.js.LICENSE.txt */
|
|
2
|
-
var OHLCV_INDICATORS;(()=>{var t={978:function(t,e){!function(t){"use strict";var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,i)},i=function(){return(i=Object.assign||function(t){for(var e,i=arguments,n=1,s=arguments.length;n<s;n++)for(var r in e=i[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function n(){for(var t=arguments,e=0,i=0,n=arguments.length;i<n;i++)e+=t[i].length;var s=Array(e),r=0;for(i=0;i<n;i++)for(var o=arguments[i],h=0,l=o.length;h<l;h++,r++)s[r]=o[h];return s}var s=function(){function t(t,e,i,n,s,r){void 0===r&&(r=null),this.forked=!1,this.forkedAt=0,this.lastForkY=null,this.step=n,this.index=s,this.length=0,this.startPoint=r?{y:t?r.h:r.l,x:r.x}:{y:t||e,x:i},this.init(t,e,i),this.thisPoint=this.startPoint}return t.prototype.init=function(t,e,i){this.type||(this.type=t?"h":"l"),this.candlePoint={y:"h"==this.type?t:e,x:i},this.thisPoint&&(this.prevPoint=this.thisPoint,this.nextPoint&&(this.thisPoint=this.nextPoint),this.nextPoint={y:this.k*(this.candlePoint.x+this.step)+this.b,x:this.candlePoint.x+this.step})},t.prototype.update=function(t,e,i){var n=null;if(this.length++,this.init(t,e,i),this.k&&!isNaN(this.k)||(this.k=(this.candlePoint.y-this.startPoint.y)/(this.candlePoint.x-this.startPoint.x),this.b=this.candlePoint.y-this.k*this.candlePoint.x,this.prevPoint=this.startPoint,this.thisPoint=this.candlePoint,this.nextPoint={y:this.k*(this.candlePoint.x+this.step)+this.b,x:this.candlePoint.x+this.step},n={condition:"h"==this.type?"lt":"gt",value:this.nextPoint.y,action:"fork",lineIndex:this.index}),"h"==this.type&&this.thisPoint.y<=this.candlePoint.y||"l"==this.type&&this.thisPoint.y>=this.candlePoint.y){this.k=(this.candlePoint.y-this.startPoint.y)/(this.candlePoint.x-this.startPoint.x),this.b=this.candlePoint.y-this.k*this.candlePoint.x,this.thisPoint=this.candlePoint,this.length=0,this.nextPoint={y:this.k*(this.candlePoint.x+this.step)+this.b,x:this.candlePoint.x+this.step};var s=this.rollback?this.rollback.length:0,r=this.candlePoint.y-this.prevPoint.y;("h"==this.type?r>0:r<0)?(this.rollback={k:r,b:this.candlePoint.y-r*this.candlePoint.x,length:s+1,lastForkTime:this.forkedAt||(this.rollback?this.rollback.lastForkTime:0),lastForkValue:this.forkedValue||(this.rollback?this.rollback.lastForkValue:0)},this.forked=!1,this.forkedAt=null,this.forkedValue=null):(this.forkedAt=this.candlePoint.x,this.forkedValue=this.candlePoint.y,this.forked=!0,this.rollback=null),n={condition:"h"==this.type?"lt":"gt",value:this.nextPoint.y,action:"fork",lineIndex:this.index}}else this.rollback=null;return n},t.prototype.updateStep=function(t){this.step=t},t}(),r=function(){function t(t){this.lineIndex=0,this.forkDiffH=null,this.forkDiffL=null,this.step=t,this.list=[[],[]],this.id={}}return t.prototype.add=function(t,e,i,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var o,h,l,u=null;if(null==r?(o=this.lineIndex,this.lineIndex++,null!=t?this.list[0].push(o):this.list[1].push(o)):(o=r,u=this.id[o].lastForkY||(null!=t?n.h:n.l)),this.id[o]=new s(t,e,i,this.step,o,n),u&&(this.id[o].lastForkY=u),o>1||null!=r&&null!=this.id[r]){h=null!=r?r:this.list["h"==this.id[o].type?0:1][this.list["h"==this.id[o].type?0:1].indexOf(o)-1],l=null!=r?r:this.list["h"==this.id[o].type?0:1][this.list["h"==this.id[o].type?0:1].indexOf(o)-2];var a=this.id[h].lastForkY;l&&!a&&(a=this.id[l].lastForkY);var p=null!=t?n.h:n.l;a&&(t?this.forkDiffH=a>=p?-h-1:h+1:this.forkDiffL=a>=p?-h-1:h+1),this.id[h].lastForkY=p}return o},t.prototype.update=function(t,e,i,n){return this.id[t].update(e,i,n)},t.prototype.delete=function(t){this.id[t]&&("h"==this.id[t].type?this.list[0].splice(this.list[0].indexOf(t),1):this.list[1].splice(this.list[1].indexOf(t),1),delete this.id[t])},t}(),o=function(){function t(t,e){this.kdiff=[],this.env=e,this.lines=t,this.in={state:null,lineIndex:null,line:null},this.is={state:null,lineIndex:null,line:null,start:null,size:0},this.was={state:null,lineIndex:null,line:null,size:null},this.width=0,this.speed=0,this.at=0}return t.prototype.update=function(t,e){var n=this;if(t.length>1?this.hlMaxDuration=t.map((function(t){return n.lines.id[t]})).filter((function(t){return!n.is.line||(t.forkedAt?t.forkedAt>n.is.line.startPoint.x:!!t.rollback&&t.rollback.lastForkTime>n.is.line.startPoint.x)})).reduce((function(t,e){return t.length>e.length?t:e}),this.lines.id[t[0]]):this.hlMaxDuration=this.lines.id[t[0]],e.length>1?this.llMaxDuration=e.map((function(t){return n.lines.id[t]})).filter((function(t){return!n.is.line||(t.forkedAt?t.forkedAt>n.is.line.startPoint.x:!!t.rollback&&t.rollback.lastForkTime>n.is.line.startPoint.x)})).reduce((function(t,e){return t.length>e.length?t:e}),this.lines.id[e[0]]):this.llMaxDuration=this.lines.id[e[0]],null==this.is.state&&null==this.was.state&&(this.is.line=this.llMaxDuration&&this.llMaxDuration.length>this.env.minLength&&this.hlMaxDuration.length<this.env.minLength?this.llMaxDuration:this.hlMaxDuration&&this.hlMaxDuration.length>this.env.minLength&&this.llMaxDuration.length<this.env.minLength?this.hlMaxDuration:null,this.is.line&&(this.is.lineIndex=this.is.line.index,this.is.state="h"==this.is.line.type?"fall":"rise",this.is.start=this.is.line.candlePoint)),this.is.state){this.is.size=Math.max(this.is.size,Math.abs(this.is.start.y-this.is.line.candlePoint.y));var s,r=this.lines.id[this.is.lineIndex]||this.lines.id["h"==this.is.line.type?0:1],o=null,h=null,l=this.lines.list["h"==r.type?1:0].filter((function(t){return n.lines.id[t].forked&&n.lines.id[t].thisPoint.x-n.lines.id[t].forkedAt>12}));l.length>1?l[1]:l.length>0&&l[0];var u=l.filter((function(t){return n.lines.id[t].forkedAt>n.is.start.x}));if(r&&this.lines.list["h"==r.type?0:1].forEach((function(t,e){var i=n.lines.id[t];if(t>=r.index&&null!=i.rollback){s=n.lines.list["h"==r.type?0:1][e-1];var l=1==n.env.deltaModel&&e>1&&s&&n.lines.id[s]?e>1&&s&&n.lines.id[s].lastForkY:n.lines.id[t>0?t-1:0];h=l?n.lines.id[t>1?s:"h"==r.type?0:1].lastForkY-i.candlePoint.y:i.rollback?i.rollback.lastForkValue-i.candlePoint.y:0,i.rollback.lastForkValue>0&&i.thisPoint.x-i.rollback.lastForkTime>n.env.minRightLeg&&("fall"==n.is.state?n.llMaxDuration.length>1:n.hlMaxDuration.length>1)&&(("h"==r.type?h<0:h>0)||i.rollback.length>n.env.rollbackLength||2*n.is.size/3>Math.abs(n.is.start.y-n.is.line.candlePoint.y)&&n.is.size>n.is.line.candlePoint.y*n.env.minIsSizeOnRollback&&u.length>1||("h"==r.type?i.candlePoint.y>n.is.start.y&&1==n.lines.list[0].length:i.candlePoint.y<n.is.start.y&&1==n.lines.list[1].length))&&(i.candlePoint.x-i.rollback.lastForkTime>n.env.forkDurationMin&&i.candlePoint.x-i.rollback.lastForkTime<n.env.forkDurationMax||("h"==r.type?i.candlePoint.y>i.startPoint.y:i.candlePoint.y<i.startPoint.y)||("h"==r.type?i.candlePoint.y>n.is.start.y&&1==n.lines.list[0].length:i.candlePoint.y<n.is.start.y&&1==n.lines.list[1].length))&&(o=t+1)}})),o){this.in.size=(this.was.size||0)+this.is.size;var a=this.lines.id[0].candlePoint.y-this.is.start.y,p="rise"==this.is.state?a>=0:a<0;this.was.size&&(this.in.state=this.was.size>this.is.size?this.was.state:this.is.state),this.was=i({},this.is),this.was.success=p,this.is.line="fall"==this.is.state?this.llMaxDuration:this.hlMaxDuration,this.is.state="h"==this.is.line.type?"fall":"rise",this.is.lineIndex=this.is.line.index,this.is.start=this.lines.id[0].candlePoint,this.is.size=0}}},t}(),h=function(){function t(t){this.hLineDirectives=[],this.lLineDirectives=[],this.step=1,this.i=0,this.localCounter=0,this.prevPoint=null,this.env=Object.assign({step:1,minLength:5,minRightLeg:3,maxForks:500,minLog:0,maxLog:0,rollbackLength:3,deltaModel:1,minIsSizeOnRollback:.05},t),this.env.minLength=Math.round(this.env.minLength/this.env.step)||1,this.env.minRightLeg=Math.round(this.env.minRightLeg/this.env.step)||1,this.env.rollbackLength=Math.round(this.env.rollbackLength/this.env.step)||1,this.env.forkDurationMin=Math.round(this.env.forkDurationMin/this.env.step)||1,this.env.forkDurationMax=Math.round(this.env.forkDurationMax/this.env.step)||1,this.lines=new r(this.step),this.trend=new o(this.lines,this.env)}return t.prototype.log=function(t){for(var e=arguments,i=[],s=1;s<arguments.length;s++)i[s-1]=e[s];this.consoleWindow=this.env.minLog<this.localCounter&&this.localCounter<this.env.maxLog,this.consoleWindow&&console.log.apply(console,n([t],i))},t.prototype.nextValue=function(t,e,i,n){var s,r=this;this.localCounter++,this.lLineDirectives.length>0&&this.lLineDirectives.forEach((function(t,e){var i=r.lines.id[t.lineIndex];"gt"==t.condition&&n>t.value&&"fork"==t.action&&i&&(null!=t.lineIndex&&null!=i&&i.k<0?r.lines.add(null,n,r.i-1,r.prevPoint,t.lineIndex):(i.forked=!0,i.forkedAt=i.thisPoint.x,i.forkedValue=i.thisPoint.y,r.lines.add(null,n,r.i-1,r.prevPoint)))})),this.hLineDirectives.length>0&&this.hLineDirectives.forEach((function(t,e){var n=r.lines.id[t.lineIndex];"lt"==t.condition&&i<t.value&&"fork"==t.action&&n&&(n.k>0?r.lines.add(i,null,r.i-1,r.prevPoint,t.lineIndex):(n.forked=!0,n.forkedAt=n.thisPoint.x,n.forkedValue=n.thisPoint.y,r.lines.add(i,null,r.i-1,r.prevPoint)))})),this.hLineDirectives.length=0,this.lLineDirectives.length=0,this.lines.list[0].length<1?(this.lines.add(i,null,this.i),this.lines.add(null,n,this.i)):this.lines.list.forEach((function(t){return t.forEach((function(t){var e=r.lines.id[t];if(e&&e.type){s=null,e&&e.startPoint.x<r.i&&(s=r.lines.update(t,i,n,r.i));var o=e.type;s&&("h"==o?r.hLineDirectives.push(s):r.lLineDirectives.push(s))}}))}));var o=[];return this.lines.list.forEach((function(t){t&&(o=[],t.forEach((function(e,i){var n=r.lines.id[t[i]],s=r.lines.id[t[i-1]];(i>0&&n&&s&&"h"==n.type&&n.thisPoint&&s.thisPoint.y<=n.thisPoint.y||i>r.env.maxForks||i>0&&n&&s&&"l"==n.type&&n.thisPoint&&s.thisPoint.y>=n.thisPoint.y||i>r.env.maxForks)&&o.push(e)})),o.forEach((function(t){return r.lines.delete(t)})))})),this.prevPoint={x:this.i,h:i,l:n},this.trend.update(this.lines.list[0],this.lines.list[1]),this.i++,this.lines},t}(),l=Object.freeze({__proto__:null,Indicator:h}),u=function(){function t(t){this.length=t,this.filled=!1,this.pointer=0,this.buffer=new Array(t),this.maxIndex=t-1}return t.prototype.push=function(t){var e=this.buffer[this.pointer];return this.buffer[this.pointer]=t,this.iteratorNext(),e},t.prototype.pushback=function(t){this.iteratorPrev();var e=this.buffer[this.pointer];return this.buffer[this.pointer]=t,e},t.prototype.peek=function(){return this.buffer[this.pointer]},t.prototype.forEach=function(t){for(var e=this.pointer,i=0;i!==this.length;)t(this.buffer[e],i),e=(this.length+e+1)%this.length,i++},t.prototype.forEachRight=function(t){for(var e=(this.length+this.pointer-1)%this.length,i=this.length-1;i!==this.length;)t(this.buffer[e],i),e=(this.length+e-1)%this.length,i--},t.prototype.fill=function(t){this.buffer.fill(t),this.filled=!0},t.prototype.toArray=function(){return this.buffer},t.prototype.iteratorNext=function(){this.pointer++,this.pointer>this.maxIndex&&(this.pointer=0,this.filled=!0)},t.prototype.iteratorPrev=function(){this.pointer--,this.pointer<0&&(this.pointer=this.maxIndex)},t}(),a=function(t){function i(e,i){void 0===e&&(e=100);var n=t.call(this,e)||this;return n.period=e,n.mode=i,n.comparator="max"===i?n.maxComporator:n.mminComporator,n}return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}(i,t),i.prototype.nextValue=function(t){return this.push(t),this.getExtremum()},i.prototype.momentValue=function(t){var e=this.push(t),i=this.getExtremum();return this.pushback(e),i},i.prototype.maxComporator=function(t,e){return t>e},i.prototype.mminComporator=function(t,e){return t<e},i.prototype.getExtremum=function(t){var e=(this.length+this.pointer-2)%this.length,i="max"===this.mode?-1/0:1/0;if(!this.filled)return 0;for(;e!==this.pointer;){var n=this.buffer[(this.length+e-1)%this.length],s=this.buffer[(this.length+e+1)%this.length],r=this.buffer[e];if(this.comparator(r,i)&&this.comparator(r,n)&&this.comparator(r,s)){if(i=r,this.prevIx===e)return null;if(this.prevIx=e,t)return i}e=(this.length+e-1)%this.length}return isFinite(i)?i:(this.prevIx=null,null)},i}(u),p=function(){function t(t){this.period=t,this.sum=0,this.circular=new u(t)}return t.prototype.nextValue=function(t){var e=this;if(this.circular.push(t),this.sum+=t,this.circular.filled)return this.nextValue=function(t){return e.sum=e.sum-e.circular.push(t)+t,e.sum/e.period},this.momentValue=function(t){return(e.sum-e.circular.peek()+t)/e.period},this.sum/this.period},t.prototype.momentValue=function(t){},t}(),c=function(){function t(t){this.period=t,this.smooth=1/this.period,this.sma=new p(this.period)}return t.prototype.nextValue=function(t){return this.wema?this.wema=(t-this.wema)*this.smooth+this.wema:this.wema=this.sma.nextValue(t)},t.prototype.momentValue=function(t){return this.wema?(t-this.wema)*this.smooth+this.wema:this.sma.momentValue(t)},t}(),f=function(){function t(t){this.period=t,this.smooth=2/(this.period+1),this.sma=new p(this.period)}return t.prototype.nextValue=function(t){var e=this,i=this.sma.nextValue(t);return i&&(this.ema=i,this.nextValue=function(t){return e.ema=(t-e.ema)*e.smooth+e.ema},this.momentValue=function(t){return(t-e.ema)*e.smooth+e.ema}),i},t.prototype.momentValue=function(t){},t}(),d=function(){function t(t,e){this.indicator=t,this.samples=e,this._indicators=[]}return t.prototype.create=function(){for(var t,e=arguments,i=[],s=0;s<arguments.length;s++)i[s]=e[s];for(var r=0;r<this.samples;r++)this._indicators.push(new((t=this.indicator).bind.apply(t,n([void 0],i))))},t.prototype.nextValue=function(t){for(var e=0;e<this.samples;e++)if(void 0===(t=this._indicators[e].nextValue(t)))return t;return t},t.prototype.momentValue=function(t){for(var e=0;e<this.samples;e++)if(null==(t=this._indicators[e].momentValue(t)))return t;return t},t}(),m=function(){function t(t,e,i,n,s){void 0===t&&(t=.85),void 0===n&&(n=1),void 0===s&&(s=1),this.redunant=t,this.multiplier=n,this.offset=s,this.prevValue=0,this.lastUpperValue=0,this.lastLowerValue=0,this.samplerUp=new d(e,i),this.samplerLow=new d(e,i)}return t.prototype.create=function(){for(var t,e,i=arguments,n=[],s=0;s<arguments.length;s++)n[s]=i[s];(t=this.samplerUp).create.apply(t,n),(e=this.samplerLow).create.apply(e,n)},t.prototype.nextValue=function(t){this.lastUpperValue=t>0?Math.max(t,this.prevValue):Math.max(0,this.lastUpperValue)*this.redunant,this.lastLowerValue=t<=0?Math.min(t,this.prevValue):Math.min(0,this.lastLowerValue)*this.redunant;var e=(t<=0?t:this.lastLowerValue)*this.multiplier,i=(t>=0?t:this.lastUpperValue)*this.multiplier;return[this.samplerUp.nextValue(i)+this.offset,this.samplerLow.nextValue(e)-this.offset]},t}(),v=function(){function t(t,e,i,n){void 0===i&&(i=.85),void 0===n&&(n="WEMA"),this.period=t,this.samples=e,this.redunant=i,this.type=n,this.upper=0,this.lower=0,this.lastUpperValue=0,this.lastLowerValue=0,this.sample1Up=this.createSample(),this.sample2Up=this.createSample(),this.sample3Up=this.createSample(),this.sample1Low=this.createSample(),this.sample2Low=this.createSample(),this.sample3Low=this.createSample()}return t.prototype.nextValue=function(t){return t>0?(this.upper=this.getUp(t),this.lastLowerValue*=this.redunant,this.lower=this.getDown(this.lastLowerValue),this.lastUpperValue=t):t<0&&(this.lower=this.getDown(t),this.lastUpperValue*=this.redunant,this.upper=this.getUp(this.lastUpperValue),this.lastLowerValue=t),{upper:this.upper,lower:this.lower}},t.prototype.getUp=function(t){var e=this.sample1Up.nextValue(t),i=null;return 1===this.samples?e:(e&&(i=this.sample2Up.nextValue(e)),2===this.samples?i:i?this.sample3Up.nextValue(i):null)},t.prototype.getDown=function(t){var e=this.sample1Low.nextValue(t),i=null;return 1===this.samples?e:(e&&(i=this.sample2Low.nextValue(e)),2===this.samples?i:i?this.sample3Low.nextValue(i):null)},t.prototype.createSample=function(){switch(this.type){case"EMA":return new f(this.period);case"WEMA":return new c(this.period);case"SMA":return new p(this.period)}},t}(),g=function(){function t(t){this.period=t,this.SMAx=new p(this.period),this.SMAy=new p(this.period),this.pricesX=new u(this.period),this.pricesY=new u(this.period)}return t.prototype.nextValue=function(t,e){this.pricesX.push(t),this.pricesY.push(e),this.SMAxValue=this.SMAx.nextValue(t),this.SMAyValue=this.SMAy.nextValue(e);for(var i=0,n=0,s=0,r=0;r<this.period;r++){var o=this.pricesX.toArray()[r],h=this.pricesY.toArray()[r];i+=(o-this.SMAxValue)*(h-this.SMAyValue),n+=Math.pow(o-this.SMAxValue,2),s+=Math.pow(h-this.SMAyValue,2)}return i/Math.sqrt(n*s)},t}(),w=function(){function t(t){this.period=t,this.denominator=t*(t+1)/2,this.buffer=new u(t),this.values=[]}return t.prototype.nextValue=function(t){var e=this;if(this.buffer.push(t),this.buffer.filled){var i=0;return this.buffer.forEach((function(t,n){i+=t*(n+1)/e.denominator})),i}},t.prototype.momentValue=function(t){var e=this,i=this.buffer.push(t);if(this.buffer.filled){var n=0;return this.buffer.forEach((function(t,i){n+=t*(i+1)/e.denominator})),this.buffer.pushback(i),n}this.buffer.pushback(i)},t}(),y=function(){function t(t){void 0===t&&(t=.2),this.alpha=t,this.filled=!1}return t.prototype.nextValue=function(t){var e=this.alpha*t+(1-this.alpha)*(this.prevValue||1);if(this.filled=this.filled||void 0!==this.prevValue,this.prevValue=e,this.filled)return e},t.prototype.momentValue=function(t){if(this.filled)return this.alpha*t+(1-this.alpha)*(this.prevValue||1)},t}(),V=function(){function t(t){this.period=t,this.sum=0,this.avg=0,this.filled=!1,this.fill=0}return t.prototype.nextValue=function(t){var e=this;return this.filled?(this.nextValue=function(t){return e.avg=(e.avg*(e.period-1)+t)/e.period},this.nextValue(t)):(this.sum+=t,this.fill++,this.fill===this.period?(this.filled=!0,this.avg=this.sum/this.period,this.avg):void 0)},t.prototype.momentValue=function(t){if(this.filled)return(this.avg*(this.period-1)+t)/this.period},t}(),x=function(){function t(t){void 0===t&&(t=14),this.period=t,this.alpha=1/t,this.sma=new p(this.period)}return t.prototype.nextValue=function(t){var e=this;return this.prevValue?(this.prevValue=this.alpha*t+(1-this.alpha)*this.prevValue,this.nextValue=function(t){return e.prevValue=e.alpha*t+(1-e.alpha)*e.prevValue,e.prevValue}):this.prevValue=this.sma.nextValue(t),this.prevValue},t.prototype.momentValue=function(t){if(this.prevValue)return this.alpha*t+(1-this.alpha)*this.prevValue},t}(),P=function(){function t(t,e){void 0===t&&(t=5),void 0===e&&(e=34),this.smaSlow=new p(e),this.smaFast=new p(t)}return t.prototype.nextValue=function(t,e){var i=this;if(this.smaSlowValue=this.smaSlow.nextValue((t+e)/2),this.smaFastValue=this.smaFast.nextValue((t+e)/2),void 0!==this.smaSlowValue&&void 0!==this.smaFastValue)return this.nextValue=function(t,e){return i.smaSlowValue=i.smaSlow.nextValue((t+e)/2),i.smaFastValue=i.smaFast.nextValue((t+e)/2),i.smaFastValue-i.smaSlowValue},this.momentValue=function(t,e){return i.smaFast.momentValue((t+e)/2)-i.smaSlow.momentValue((t+e)/2)},this.smaFastValue-this.smaSlowValue},t.prototype.momentValue=function(t,e){},t}(),b=function(){function t(){this.sma=new p(5),this.ao=new P}return t.prototype.nextValue=function(t,e){var i=this;if(this.aoValue=this.ao.nextValue(t,e),void 0!==this.aoValue&&(this.smaValue=this.sma.nextValue(this.aoValue),void 0!==this.smaValue))return this.nextValue=function(t,e){return i.aoValue=i.ao.nextValue(t,e),i.smaValue=i.sma.nextValue(i.aoValue),i.aoValue-i.smaValue},this.momentValue=function(t,e){return i.ao.momentValue(t,e)-i.sma.momentValue(i.aoValue)},this.aoValue-this.smaValue},t.prototype.momentValue=function(t,e){},t}(),k=function(t,e){return(t-e)/e*100},A=function(){function t(t){this.period=t,this.value=0,this.changes=new u(t)}return t.prototype.nextValue=function(t){if(this.prevPrice){var e=k(t,this.prevPrice);return this.calculate(e),this.prevPrice=t,this.value}this.prevPrice=t},t.prototype.calculate=function(t){return this.value+=t,this.value-=this.changes.push(t),this.value},t}();function M(t){return t.consolidate=0,t.power=0,t.streak=0,t.diff=0,t.startPrice=0,t.prevPeak=0,t}var L=function(){function t(){this.up={consolidate:0,power:0,streak:0,startPrice:0,diff:0,prevPeak:0},this.down={consolidate:0,power:0,streak:0,startPrice:0,diff:0,prevPeak:0}}return t.prototype.nextValue=function(t,e,n,s){if(t<e||this.up.streak&&this.up.prevPeak<s){this.up.startPrice||(this.up.startPrice=t),this.down.streak&&M(this.down);var r=e-t;this.up.streak++,this.up.prevPeak=s,this.up.diff>r?this.up.consolidate++:this.up.consolidate=0,this.up.diff=r,this.up.power=k(e,this.up.startPrice)}return(t>e||this.down.streak&&this.down.prevPeak>n)&&(this.down.startPrice||(this.down.startPrice=t),this.up.streak&&M(this.up),r=t-e,this.down.streak++,this.down.prevPeak=n,this.down.diff>r?this.down.consolidate++:this.down.consolidate=0,this.down.diff=r,this.down.power=k(e,this.down.startPrice)),t===e&&(this.up.streak++,this.down.streak++,this.up.diff=this.down.diff=0),this.up.streak>this.down.streak?i({},this.up):i({},this.down)},t}(),S=function(){function t(t){this.max=-1/0,this.highest=new u(t)}return t.prototype.filled=function(){return this.highest.filled},t.prototype.nextValue=function(t){return this.max<t&&(this.max=t),this.highest.push(t)===this.max&&t!==this.max&&(this.max=function(t){for(var e=-1/0,i=t.length-1;i>=0;i--){var n=t[i];e<n&&(e=n)}return e}(this.highest.toArray())),this.max},t.prototype.momentValue=function(t){return this.max>t?this.max:t},t}(),O=function(){function t(t){this.min=1/0,this.lowest=new u(t)}return t.prototype.filled=function(){return this.lowest.filled},t.prototype.nextValue=function(t){return this.min>t&&(this.min=t),this.lowest.push(t)===this.min&&t!==this.min&&(this.min=function(t){for(var e=1/0,i=t.length-1;i>=0;i--){var n=t[i];e>n&&(e=n)}return e}(this.lowest.toArray())),this.min},t.prototype.momentValue=function(t){return this.min<t?this.min:t},t}(),E=function(){function t(t,e){void 0===t&&(t=14),void 0===e&&(e=3),this.period=t,this.smaPeriod=e,this.sma=new p(this.smaPeriod),this.max=new S(t),this.min=new O(t)}return t.prototype.nextValue=function(t,e,i){var n=this.max.nextValue(t),s=this.min.nextValue(e);if(this.max.filled()){var r=(i-s)/(n-s)*100;return{k:r,d:this.sma.nextValue(r)}}},t.prototype.momentValue=function(t,e,i){if(this.max.filled()){var n=this.max.momentValue(t),s=this.min.momentValue(e),r=(i-s)/(n-s)*100;return{k:r,d:this.sma.momentValue(r)}}},t}(),C=function(){function t(t){this.avgGain=new V(t),this.avgLoss=new V(t)}return t.prototype.nextValue=function(t){var e=t-this.prev;if(this.prev){var i=e>0?e:0,n=e<0?e:0,s=this.avgGain.nextValue(i),r=this.avgLoss.nextValue(n);return this.prev=t,{upAvg:s,downAvg:r}}this.prev=t},t.prototype.momentValue=function(t){var e=t-this.prev,i=e>0?e:0,n=e<0?e:0;return{upAvg:this.avgGain.momentValue(i),downAvg:this.avgLoss.momentValue(n)}},t}(),N=function(){function t(t){void 0===t&&(t=14),this.period=t,this.change=new C(this.period)}return t.prototype.nextValue=function(t){var e=this.change.nextValue(t)||{},i=e.downAvg,n=e.upAvg;if(void 0!==n&&void 0!==i)return 100-100/(1+n/-i)},t.prototype.momentValue=function(t){var e=this.change.momentValue(t)||{},i=e.downAvg,n=e.upAvg;if(void 0!==n&&void 0!==i)return 100-100/(1+n/-i)},t}(),D=function(){function t(t,e,i,n){void 0===t&&(t=14),void 0===e&&(e=3),void 0===i&&(i=3),void 0===n&&(n=14),this.rsi=new N(t),this.sma1=new p(e),this.sma2=new p(i),this.max=new S(n),this.min=new O(n)}return t.prototype.nextValue=function(t){var e=this.rsi.nextValue(t);if(void 0!==e){var i=this.max.nextValue(e),n=this.min.nextValue(e);if(this.max.filled()){var s=(e-n)/(i-n)*100,r=this.sma1.nextValue(s);if(void 0!==r)return{k:r,d:this.sma2.nextValue(r),stochRsi:s}}}},t.prototype.momentValue=function(t){if(this.max.filled()){var e=this.rsi.momentValue(t),i=this.max.momentValue(e),n=this.min.momentValue(e),s=(e-n)/(i-n)*100,r=this.sma1.momentValue(s);return{k:r,d:this.sma2.momentValue(r),stochRsi:s}}},t}(),_=function(){function t(t){this.period=t,this.values=new u(t)}return t.prototype.nextValue=function(t,e){if(e)return this.nextValue=this.pureNextValue,this.momentValue=this.pureMomentValue,this.pureNextValue(t,e);this.values.push(t)},t.prototype.momentValue=function(t,e){},t.prototype.pureNextValue=function(t,e){var i=this;return this.values.push(t),this.values.toArray().reduce((function(t,n){return t+i.positiveDelta(e,n)}),0)/this.period},t.prototype.pureMomentValue=function(t,e){var i=this,n=this.values.push(t),s=this.values.toArray().reduce((function(t,n){return t+i.positiveDelta(e,n)}),0);return this.values.pushback(n),s/this.period},t.prototype.positiveDelta=function(t,e){return t>e?t-e:e-t},t}(),I=function(){function t(t){void 0===t&&(t=20),this.md=new _(t),this.sma=new p(t)}return t.prototype.nextValue=function(t,e,i){var n=(t+e+i)/3,s=this.sma.nextValue(n),r=this.md.nextValue(n,s);return r&&(n-s)/(.015*r)},t.prototype.momentValue=function(t,e,i){var n=(t+e+i)/3,s=this.sma.momentValue(n),r=this.md.momentValue(n,s);return r&&(n-s)/(.015*r)},t}(),B=function(){function t(t){this.period=t,this.arr=[],this.filled=!1,this.devider=0,this.lastSum=0,this.devider=function(t){for(var e=0,i=t.length;i>0;)e+=t[--i];return e}(Array.from(Array(this.period).keys()).map((function(t){return t+1})))}return t.prototype.nextValue=function(t){if(this.filled=this.filled||this.arr.length===this.period,this.arr.push(t),this.filled)return this.arr.shift(),this.arr.reduce((function(t,e,i){return t+e*(i+1)}),0)/this.devider},t.prototype.momentValue=function(t){if(this.filled){var e=this.arr.slice(1);return e.push(t),e.reduce((function(t,e,i){return t+e*(i+1)}),0)/this.devider}},t}();function F(t,e,i){if(i){var n=t-e,s=t>i?t-i:i-t,r=e>i?e-i:i-e;return n>=s&&n>=r?n:s>=n&&s>=r?s:r}}var T=function(){function t(t,e){switch(void 0===t&&(t=14),void 0===e&&(e="WEMA"),e){case"SMA":this.avg=new p(t);break;case"EMA":this.avg=new f(t);break;case"SMMA":this.avg=new V(t);break;case"WEMA":this.avg=new c(t);break;case"LWMA":this.avg=new B(t);break;case"EWMA":this.avg=new y(.2);break;case"RMA":this.avg=new x(t)}this.prevClose=0}return t.prototype.nextValue=function(t,e,i){var n=F(t,e,this.prevClose);if(this.prevClose=i,void 0!==n)return this.avg.nextValue(n)},t.prototype.momentValue=function(t,e){var i=F(t,e,this.prevClose);if(void 0!==i)return this.avg.momentValue(i)},t}(),R=function(){function t(t){void 0===t&&(t=5),this.values=new u(t)}return t.prototype.nextValue=function(t){var e=this.values.push(t);if(e)return(t-e)/e*100},t.prototype.momentValue=function(t){var e=this.values.peek();if(e)return(t-e)/e*100},t}(),U=function(){function t(t){void 0===t&&(t=20),this.maxProvider=new S(t),this.minProvider=new O(t)}return t.prototype.nextValue=function(t,e){var i=this.maxProvider.nextValue(t),n=this.minProvider.nextValue(e);return{upper:i,middle:(i+n)/2,lower:n}},t.prototype.momentValue=function(t,e){var i=this.maxProvider.momentValue(t),n=this.minProvider.momentValue(e);return{upper:i,middle:(i+n)/2,lower:n}},t}(),$=function(){function t(t){this.period=t,this.fill=0,this.values=new u(t)}return t.prototype.nextValue=function(t){var e=this;if(this.values.push(t),this.fill++,this.fill===this.period)return this.nextValue=function(t){var i=e.calc(t);return e.values.push(t),i},this.momentValue=this.calc,this.calc(t)},t.prototype.momentValue=function(t){},t.prototype.calc=function(t){var e=0;return this.values.toArray().forEach((function(i){i<=t&&e++})),e/this.period*100},t}(),j=function(){function t(t,e,i){void 0===t&&(t=3),void 0===e&&(e=2),void 0===i&&(i=100),this.period=t,this.rsi=new N(this.period),this.updownRsi=new N(e),this.roc=new R(1),this.percentRank=new $(i),this.updownPeriod=0,this.prevClose=0}return t.prototype.nextValue=function(t){var e=this.rsi.nextValue(t),i=this.percentRank.nextValue(this.roc.nextValue(t));if(this.updownPeriod=this.getUpdownPeriod(t),this.prevClose=t,this.updownValue=this.updownRsi.nextValue(this.updownPeriod),this.updownValue)return(e+this.updownValue+i)/3},t.prototype.momentValue=function(t){var e=this.rsi.momentValue(t),i=this.percentRank.momentValue(this.roc.momentValue(t)),n=this.getUpdownPeriod(t),s=this.updownRsi.momentValue(n);if(void 0!==s)return(e+s+i)/3},t.prototype.getUpdownPeriod=function(t){var e=this.updownPeriod;return t>this.prevClose?(this.updownPeriod<0&&(e=0),e++):t<this.prevClose?(this.updownPeriod>0&&(e=0),e--):e=0,e},t}(),z=function(){function t(t){this.period=t,this.values=new u(t)}return t.prototype.nextValue=function(t,e){return this.values.push(t),Math.sqrt(this.values.toArray().reduce((function(t,i){return t+Math.pow(i-e,2)}),0)/this.period)},t.prototype.momentValue=function(t,e){var i=this.values.push(t),n=Math.sqrt(this.values.toArray().reduce((function(t,i){return t+Math.pow(i-e,2)}),0)/this.period);return this.values.pushback(i),n},t}(),G=function(){function t(t,e){void 0===t&&(t=20),void 0===e&&(e=2),this.period=t,this.stdDev=e,this.fill=0,this.sma=new p(t),this.sd=new z(t)}return t.prototype.nextValue=function(t){var e=this,i=this.sma.nextValue(t),n=this.sd.nextValue(t,i);if(this.fill++,this.fill===this.period){var s=i-this.stdDev*n,r=i+this.stdDev*n;return this.nextValue=function(t){var i=e.sma.nextValue(t),n=e.sd.nextValue(t,i);return{lower:i-e.stdDev*n,middle:i,upper:i+e.stdDev*n}},{lower:s,middle:i,upper:r}}},t.prototype.momentValue=function(t){var e=this.sma.momentValue(t),i=this.sd.momentValue(t,e);return{lower:e-this.stdDev*i,middle:e,upper:e+this.stdDev*i}},t}(),W=function(){function t(t,e,i){void 0===t&&(t=12),void 0===e&&(e=26),void 0===i&&(i=9),this.periodEmaFast=t,this.periodEmaSlow=e,this.periodSignal=i,this.emaFastIndicator=new f(t),this.emaSlowIndicator=new f(e),this.emaSignalIndicator=new f(i)}return t.prototype.nextValue=function(t){var e=this.emaFastIndicator.nextValue(t),i=this.emaSlowIndicator.nextValue(t),n=e-i,s=n&&this.emaSignalIndicator.nextValue(n)||void 0,r=n-s||void 0;if(!isNaN(n))return{macd:n,emaFast:e,emaSlow:i,signal:s,histogram:r}},t.prototype.momentValue=function(t){var e=this.emaFastIndicator.momentValue(t),i=this.emaSlowIndicator.momentValue(t),n=e-i,s=n&&this.emaSignalIndicator.momentValue(n);return{macd:n,emaFast:e,emaSlow:i,signal:s,histogram:n-s}},t}(),H=function(){function t(){this.prevOpen=0,this.prevClose=0}return t.prototype.nextValue=function(t,e,i,n){var s=this.calculate(t,e,i,n);return this.prevClose=s.c,this.prevOpen=s.o,s},t.prototype.momentValue=function(t,e,i,n){return this.calculate(t,e,i,n)},t.prototype.calculate=function(t,e,i,n){return n=(t+e+i+n)/4,this.prevOpen&&(t=(this.prevOpen+this.prevClose)/2),{o:t,h:e=Math.max(e,t,n),l:i=Math.min(i,t,n),c:n}},t}(),q=function(){function t(t){switch(void 0===t&&(t="classic"),this.mode=t,this.mode){case"classic":this.calculator=this.classic;break;case"camarilla":this.calculator=this.camarilla;break;case"woodie":this.calculator=this.woodie;break;case"fibonacci":this.calculator=this.fibonacci}}return t.prototype.nextValue=function(t,e,i){return this.calculator(t,e,i)},t.prototype.classic=function(t,e,i){var n=(t+e+i)/3;return{r3:t+2*(n-e),r2:n+(t-e),r1:2*n-e,pp:n,s1:2*n-t,s2:n-(t-e),s3:e-2*(t-n)}},t.prototype.woodie=function(t,e,i){var n=(t+e+2*i)/4;return{r2:n+t-e,r1:2*n-e,pp:n,s1:2*n-t,s2:n-t+e}},t.prototype.camarilla=function(t,e,i){var n=1.1*(t-e),s=t/e*i,r=i+n/2,o=s+1.168*(s-r);return{r6:o,r5:s,r4:r,r3:i+n/4,r2:i+n/6,r1:i+n/12,pp:(t+e+i)/3,s1:i-n/12,s2:i-n/6,s3:i-n/4,s4:i-n/2,s5:i-(s-i),s6:i-(o-i)}},t.prototype.fibonacci=function(t,e,i){var n=t-e,s=(t+e+i)/3;return{r3:s+n,r2:s+.618*n,r1:s+.382*n,pp:s,s1:s-.382*n,s2:s-.618*n,s3:s-n}},t}(),Y=function(){function t(t,e,i){void 0===t&&(t=.02),void 0===e&&(e=.02),void 0===i&&(i=.2),this.start=t,this.acceleration=e,this.max=i,this.result=0,this.isBullTrend=!0}return t.prototype.nextValue=function(t,e,i){if(!this.result)return this.result=i,this.low1=e,this.high1=t,this.low2=e,this.high2=t,this.highest=t,this.lowest=e,this.accelerationFactor=this.start,e;if(this.isBullTrend?this.psar=this.result+this.accelerationFactor*(this.highest-this.result):this.psar=this.result+this.accelerationFactor*(this.lowest-this.result),this.isBullTrend)if(e<this.psar)this.isBullTrend=!1,this.psar=this.highest,this.lowest=e,this.accelerationFactor=this.start;else{if(t>this.highest){this.highest=t;var n=this.accelerationFactor+this.acceleration;this.accelerationFactor=n>this.max?this.max:n}this.low1<this.psar&&(this.psar=this.low1),this.low2<this.psar&&(this.psar=this.low2)}else t>this.psar?(this.isBullTrend=!0,this.psar=this.lowest,this.highest=t,this.accelerationFactor=this.start):(e<this.lowest&&(this.lowest=e,n=this.accelerationFactor+this.acceleration,this.accelerationFactor=n>this.max?this.max:n),this.high1>this.psar&&(this.psar=this.high1),this.high2>this.psar&&(this.psar=this.high2));return this.low2=this.low1,this.low1=e,this.high2=this.high1,this.high1=t,this.result=this.psar,this.result},t.prototype.momentValue=function(t,e){if(!this.result)return e;var i,n=this.isBullTrend,s=this.result,r=this.low1,o=this.high1,h=this.low2,l=this.high2,u=this.highest,a=this.lowest,p=this.accelerationFactor;return i=n?s+p*(u-s):s+p*(a-s),n?e<i?i=u:(r<i&&(i=r),h<i&&(i=h)):t>i?i=a:(o>i&&(i=o),l>i&&(i=l)),i},t}(),X=function(){function t(t){this.period=t,this.prevValue=0,this.sumCount=1}return t.prototype.nextValue=function(t){var e=this;return this.sumCount<this.period?(this.prevValue+=t,void this.sumCount++):this.sumCount===this.period?(this.prevValue+=t,this.sumCount++,this.nextValue=function(t){return e.prevValue=e.prevValue-e.prevValue/e.period+t},this.prevValue):void 0},t.prototype.momentValue=function(t){if(!(this.sumCount<this.period))return this.prevValue-this.prevValue/this.period+t},t}(),Z=function(){function t(t){void 0===t&&(t=14),this.period=t,this.wma1=new X(t),this.wma2=new X(t),this.wma3=new X(t),this.wema=new c(t)}return t.prototype.nextValue=function(t,e,i){if(!this.prevClose)return this.prevHigh=t,this.prevLow=e,void(this.prevClose=i);var n=0,s=0,r=t-this.prevHigh,o=this.prevLow-e;r>o&&r>0&&(n=r),o>r&&o>0&&(s=o),(n>s||s<0)&&(s=0);var h=this.wma1.nextValue(F(t,e,this.prevClose)),l=this.wma2.nextValue(n),u=this.wma3.nextValue(s);if(this.prevHigh=t,this.prevLow=e,this.prevClose=i,void 0!==l&&void 0!==u){var a=100*l/h,p=100*u/h,c=a>p?a-p:p-a;return{adx:this.wema.nextValue(c/(a+p)*100),pdi:a,mdi:p}}},t.prototype.momentValue=function(t,e,i){if(this.prevClose){var n=0,s=0,r=t-this.prevHigh,o=this.prevLow-e;r>o&&r>0&&(n=r),o>r&&o>0&&(s=o),(n>s||s<0)&&(s=0);var h=this.wma1.momentValue(F(t,e,this.prevClose)),l=this.wma2.momentValue(n),u=this.wma3.momentValue(s);if(void 0!==l&&void 0!==u){var a=100*l/h,p=100*u/h,c=a>p?a-p:p-a;return{adx:this.wema.momentValue(c/(a+p)*100),pdi:a,mdi:p}}}},t}(),J=function(){function t(t,e,i){void 0===t&&(t=10),void 0===e&&(e=3),void 0===i&&(i="WEMA"),this.multiplier=e,this.atr=new T(t,i)}return t.prototype.nextValue=function(t,e,i){var n=this.atr.nextValue(t,e,i);if(n){var s=(t+e)/2,r=s+this.multiplier*n,o=s-this.multiplier*n;this.prevLower&&(o=o>this.prevLower||this.prevClose<this.prevLower?o:this.prevLower,r=r<this.prevUpper||this.prevClose>this.prevUpper?r:this.prevUpper);var h,l=(h=this.prevSuper===this.prevUpper?i>r?o:r:i<o?r:o)===r?1:-1;return this.prevUpper=r,this.prevLower=o,this.prevSuper=h,this.prevClose=i,{upper:r,lower:o,superTrend:h,direction:l}}},t.prototype.momentValue=function(t,e,i){var n=this.atr.momentValue(t,e),s=(t+e)/2,r=s+this.multiplier*n,o=s-this.multiplier*n;this.prevLower&&(o=o>this.prevLower||this.prevClose<this.prevLower?o:this.prevLower,r=r<this.prevSuper||this.prevClose>this.prevUpper?r:this.prevUpper);var h;return{upper:r,lower:o,superTrend:h=this.prevSuper===this.prevUpper?i>r?o:r:i<o?r:o,direction:h===r?1:-1}},t}(),K=function(t){return(t.o+t.h+t.l+t.c)/4},Q=function(){function t(t,e){void 0===t&&(t=4),void 0===e&&(e=K),this.sum=0,this.sessionPricesLookup=new Set,this.sessionVolumes={},this.prevCandle=null,this.source=e,this.precision=t,this.valueToRoundWith=Math.pow(10,this.precision)}return t.prototype.getSession=function(t,e){var i=this;void 0===e&&(e=15);var n=this.source(t),s=1/0,r=n;this.sessionPricesLookup.forEach((function(t){var o=i.diffPercent(t,n);o>e?(i.sessionPricesLookup.delete(t),delete i.sessionVolumes[t]):o<s&&(s=o,r=t)}));var o=Array.from(this.sessionPricesLookup).sort(),h=o.indexOf(r),l=new Map;if(-1===h)return l;for(var u=Math.round(o.length/4),a=0,p=0;p<4;p++){for(var c=p*u,f=c+u,d=0,m=0,v=c;v<f;v++){var g=o[c],w=this.sessionVolumes[g];d<w&&(d=w,m=g)}this.diffPercent(a,m)<1&&(d=l.get(a)+d,m=this.roundPrice((m+a)/2),l.delete(a)),l.set(m,d),a=m}return l},t.prototype.getSessionAvg=function(){return this.sum/this.sessionPricesLookup.size},t.prototype.getRawSession=function(){return this.sessionVolumes},t.prototype.nextValue=function(t){var e,i=this.roundPrice(this.source(t)),n=(null===(e=this.prevCandle)||void 0===e?void 0:e.time)===t.time?t.v-this.prevCandle.v:t.v;this.addToSession(i,n),this.sum+=n,this.lastPrice=i,this.prevCandle=t},t.prototype.roundPrice=function(t){return Math.round((t+Number.EPSILON)*this.valueToRoundWith)/this.valueToRoundWith},t.prototype.addToSession=function(t,e){this.sessionPricesLookup.has(t)?this.sessionVolumes[t]+=e:(this.sessionPricesLookup.add(t),this.sessionVolumes[t]=e)},t.prototype.diffPercent=function(t,e){return t<e?100*(e-t)/t:100*(t-e)/e},t}(),tt=function(){function t(t,e){void 0===t&&(t=3),void 0===e&&(e=10),this.accDistribution=0,this.emaFast=new f(t),this.emaSlow=new f(e)}return t.prototype.nextValue=function(t,e,i,n){return this.accDistribution+=i===t&&i===e||t===e?0:(2*i-e-t)/(t-e)*n,this.emaFast.nextValue(this.accDistribution)-this.emaSlow.nextValue(this.accDistribution)},t.prototype.momentValue=function(t,e,i,n){var s=this.accDistribution+(i===t&&i===e||t===e?0:(2*i-e-t)/(t-e)*n);return this.emaFast.momentValue(s)-this.emaSlow.momentValue(s)},t}();t.AC=b,t.ADX=Z,t.AO=P,t.ATR=T,t.BollingerBands=G,t.CCI=I,t.ChaikinOscillator=tt,t.CircularBuffer=u,t.Correlation=g,t.DC=U,t.EMA=f,t.EWMA=y,t.Extremums=a,t.HeikenAshi=H,t.LWMA=B,t.Level=v,t.MACD=W,t.Move=A,t.PSAR=Y,t.Pivot=q,t.RMA=x,t.ROC=R,t.RSI=N,t.SMA=p,t.SMMA=V,t.Sampler=d,t.StandardDeviation=z,t.Stochastic=E,t.StochasticRSI=D,t.SuperTrend=J,t.TrendLines=l,t.UniLevel=m,t.VolumeProfile=Q,t.WEMA=c,t.WMA=w,t.WWS=X,t.Wave=L,t.cRSI=j,Object.defineProperty(t,"__esModule",{value:!0})}(e)}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={exports:{}};return t[n].call(r.exports,r,r.exports,i),r.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";i.r(n),i.d(n,{default:()=>D});var t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,e=Math.ceil,s=Math.floor,r="[BigNumber Error] ",o=r+"Number primitive has more than 15 significant digits: ",h=1e14,l=14,u=9007199254740991,a=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],p=1e7,c=1e9;function f(t){var e=0|t;return t>0||t===e?e:e-1}function d(t){for(var e,i,n=1,s=t.length,r=t[0]+"";n<s;){for(e=t[n++]+"",i=l-e.length;i--;e="0"+e);r+=e}for(s=r.length;48===r.charCodeAt(--s););return r.slice(0,s+1||1)}function m(t,e){var i,n,s=t.c,r=e.c,o=t.s,h=e.s,l=t.e,u=e.e;if(!o||!h)return null;if(i=s&&!s[0],n=r&&!r[0],i||n)return i?n?0:-h:o;if(o!=h)return o;if(i=o<0,n=l==u,!s||!r)return n?0:!s^i?1:-1;if(!n)return l>u^i?1:-1;for(h=(l=s.length)<(u=r.length)?l:u,o=0;o<h;o++)if(s[o]!=r[o])return s[o]>r[o]^i?1:-1;return l==u?0:l>u^i?1:-1}function v(t,e,i,n){if(t<e||t>i||t!==s(t))throw Error(r+(n||"Argument")+("number"==typeof t?t<e||t>i?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function g(t){var e=t.c.length-1;return f(t.e/l)==e&&t.c[e]%2!=0}function w(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function y(t,e,i){var n,s;if(e<0){for(s=i+".";++e;s+=i);t=s+t}else if(++e>(n=t.length)){for(s=i,e-=n;--e;s+=i);t+=s}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}const V=function i(n){var V,x,P,b,k,A,M,L,S,O,E=G.prototype={constructor:G,toString:null,valueOf:null},C=new G(1),N=20,D=4,_=-7,I=21,B=-1e7,F=1e7,T=!1,R=1,U=0,$={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},j="0123456789abcdefghijklmnopqrstuvwxyz",z=!0;function G(e,i){var n,r,h,a,p,c,f,d,m=this;if(!(m instanceof G))return new G(e,i);if(null==i){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>F?m.c=m.e=null:e.e<B?m.c=[m.e=0]:(m.e=e.e,m.c=e.c.slice()));if((c="number"==typeof e)&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(a=0,p=e;p>=10;p/=10,a++);return void(a>F?m.c=m.e=null:(m.e=a,m.c=[e]))}d=String(e)}else{if(!t.test(d=String(e)))return P(m,d,c);m.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(a=d.indexOf("."))>-1&&(d=d.replace(".","")),(p=d.search(/e/i))>0?(a<0&&(a=p),a+=+d.slice(p+1),d=d.substring(0,p)):a<0&&(a=d.length)}else{if(v(i,2,j.length,"Base"),10==i&&z)return Y(m=new G(e),N+m.e+1,D);if(d=String(e),c="number"==typeof e){if(0*e!=0)return P(m,d,c,i);if(m.s=1/e<0?(d=d.slice(1),-1):1,G.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(o+e)}else m.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(n=j.slice(0,i),a=p=0,f=d.length;p<f;p++)if(n.indexOf(r=d.charAt(p))<0){if("."==r){if(p>a){a=f;continue}}else if(!h&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){h=!0,p=-1,a=0;continue}return P(m,String(e),c,i)}c=!1,(a=(d=x(d,i,10,m.s)).indexOf("."))>-1?d=d.replace(".",""):a=d.length}for(p=0;48===d.charCodeAt(p);p++);for(f=d.length;48===d.charCodeAt(--f););if(d=d.slice(p,++f)){if(f-=p,c&&G.DEBUG&&f>15&&(e>u||e!==s(e)))throw Error(o+m.s*e);if((a=a-p-1)>F)m.c=m.e=null;else if(a<B)m.c=[m.e=0];else{if(m.e=a,m.c=[],p=(a+1)%l,a<0&&(p+=l),p<f){for(p&&m.c.push(+d.slice(0,p)),f-=l;p<f;)m.c.push(+d.slice(p,p+=l));p=l-(d=d.slice(p)).length}else p-=f;for(;p--;d+="0");m.c.push(+d)}}else m.c=[m.e=0]}function W(t,e,i,n){var s,r,o,h,l;if(null==i?i=D:v(i,0,8),!t.c)return t.toString();if(s=t.c[0],o=t.e,null==e)l=d(t.c),l=1==n||2==n&&(o<=_||o>=I)?w(l,o):y(l,o,"0");else if(r=(t=Y(new G(t),e,i)).e,h=(l=d(t.c)).length,1==n||2==n&&(e<=r||r<=_)){for(;h<e;l+="0",h++);l=w(l,r)}else if(e-=o,l=y(l,r,"0"),r+1>h){if(--e>0)for(l+=".";e--;l+="0");}else if((e+=r-h)>0)for(r+1==h&&(l+=".");e--;l+="0");return t.s<0&&s?"-"+l:l}function H(t,e){for(var i,n,s=1,r=new G(t[0]);s<t.length;s++)(!(n=new G(t[s])).s||(i=m(r,n))===e||0===i&&r.s===e)&&(r=n);return r}function q(t,e,i){for(var n=1,s=e.length;!e[--s];e.pop());for(s=e[0];s>=10;s/=10,n++);return(i=n+i*l-1)>F?t.c=t.e=null:i<B?t.c=[t.e=0]:(t.e=i,t.c=e),t}function Y(t,i,n,r){var o,u,p,c,f,d,m,v=t.c,g=a;if(v){t:{for(o=1,c=v[0];c>=10;c/=10,o++);if((u=i-o)<0)u+=l,p=i,f=v[d=0],m=s(f/g[o-p-1]%10);else if((d=e((u+1)/l))>=v.length){if(!r)break t;for(;v.length<=d;v.push(0));f=m=0,o=1,p=(u%=l)-l+1}else{for(f=c=v[d],o=1;c>=10;c/=10,o++);m=(p=(u%=l)-l+o)<0?0:s(f/g[o-p-1]%10)}if(r=r||i<0||null!=v[d+1]||(p<0?f:f%g[o-p-1]),r=n<4?(m||r)&&(0==n||n==(t.s<0?3:2)):m>5||5==m&&(4==n||r||6==n&&(u>0?p>0?f/g[o-p]:0:v[d-1])%10&1||n==(t.s<0?8:7)),i<1||!v[0])return v.length=0,r?(i-=t.e+1,v[0]=g[(l-i%l)%l],t.e=-i||0):v[0]=t.e=0,t;if(0==u?(v.length=d,c=1,d--):(v.length=d+1,c=g[l-u],v[d]=p>0?s(f/g[o-p]%g[p])*c:0),r)for(;;){if(0==d){for(u=1,p=v[0];p>=10;p/=10,u++);for(p=v[0]+=c,c=1;p>=10;p/=10,c++);u!=c&&(t.e++,v[0]==h&&(v[0]=1));break}if(v[d]+=c,v[d]!=h)break;v[d--]=0,c=1}for(u=v.length;0===v[--u];v.pop());}t.e>F?t.c=t.e=null:t.e<B&&(t.c=[t.e=0])}return t}function X(t){var e,i=t.e;return null===i?t.toString():(e=d(t.c),e=i<=_||i>=I?w(e,i):y(e,i,"0"),t.s<0?"-"+e:e)}return G.clone=i,G.ROUND_UP=0,G.ROUND_DOWN=1,G.ROUND_CEIL=2,G.ROUND_FLOOR=3,G.ROUND_HALF_UP=4,G.ROUND_HALF_DOWN=5,G.ROUND_HALF_EVEN=6,G.ROUND_HALF_CEIL=7,G.ROUND_HALF_FLOOR=8,G.EUCLID=9,G.config=G.set=function(t){var e,i;if(null!=t){if("object"!=typeof t)throw Error(r+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(v(i=t[e],0,c,e),N=i),t.hasOwnProperty(e="ROUNDING_MODE")&&(v(i=t[e],0,8,e),D=i),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((i=t[e])&&i.pop?(v(i[0],-c,0,e),v(i[1],0,c,e),_=i[0],I=i[1]):(v(i,-c,c,e),_=-(I=i<0?-i:i))),t.hasOwnProperty(e="RANGE"))if((i=t[e])&&i.pop)v(i[0],-c,-1,e),v(i[1],1,c,e),B=i[0],F=i[1];else{if(v(i,-c,c,e),!i)throw Error(r+e+" cannot be zero: "+i);B=-(F=i<0?-i:i)}if(t.hasOwnProperty(e="CRYPTO")){if((i=t[e])!==!!i)throw Error(r+e+" not true or false: "+i);if(i){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw T=!i,Error(r+"crypto unavailable");T=i}else T=i}if(t.hasOwnProperty(e="MODULO_MODE")&&(v(i=t[e],0,9,e),R=i),t.hasOwnProperty(e="POW_PRECISION")&&(v(i=t[e],0,c,e),U=i),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(i=t[e]))throw Error(r+e+" not an object: "+i);$=i}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(i=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(i))throw Error(r+e+" invalid: "+i);z="0123456789"==i.slice(0,10),j=i}}return{DECIMAL_PLACES:N,ROUNDING_MODE:D,EXPONENTIAL_AT:[_,I],RANGE:[B,F],CRYPTO:T,MODULO_MODE:R,POW_PRECISION:U,FORMAT:$,ALPHABET:j}},G.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!G.DEBUG)return!0;var e,i,n=t.c,o=t.e,u=t.s;t:if("[object Array]"=={}.toString.call(n)){if((1===u||-1===u)&&o>=-c&&o<=c&&o===s(o)){if(0===n[0]){if(0===o&&1===n.length)return!0;break t}if((e=(o+1)%l)<1&&(e+=l),String(n[0]).length==e){for(e=0;e<n.length;e++)if((i=n[e])<0||i>=h||i!==s(i))break t;if(0!==i)return!0}}}else if(null===n&&null===o&&(null===u||1===u||-1===u))return!0;throw Error(r+"Invalid BigNumber: "+t)},G.maximum=G.max=function(){return H(arguments,-1)},G.minimum=G.min=function(){return H(arguments,1)},G.random=(b=9007199254740992,k=Math.random()*b&2097151?function(){return s(Math.random()*b)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var i,n,o,h,u,p=0,f=[],d=new G(C);if(null==t?t=N:v(t,0,c),h=e(t/l),T)if(crypto.getRandomValues){for(i=crypto.getRandomValues(new Uint32Array(h*=2));p<h;)(u=131072*i[p]+(i[p+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),i[p]=n[0],i[p+1]=n[1]):(f.push(u%1e14),p+=2);p=h/2}else{if(!crypto.randomBytes)throw T=!1,Error(r+"crypto unavailable");for(i=crypto.randomBytes(h*=7);p<h;)(u=281474976710656*(31&i[p])+1099511627776*i[p+1]+4294967296*i[p+2]+16777216*i[p+3]+(i[p+4]<<16)+(i[p+5]<<8)+i[p+6])>=9e15?crypto.randomBytes(7).copy(i,p):(f.push(u%1e14),p+=7);p=h/7}if(!T)for(;p<h;)(u=k())<9e15&&(f[p++]=u%1e14);for(h=f[--p],t%=l,h&&t&&(u=a[l-t],f[p]=s(h/u)*u);0===f[p];f.pop(),p--);if(p<0)f=[o=0];else{for(o=-1;0===f[0];f.splice(0,1),o-=l);for(p=1,u=f[0];u>=10;u/=10,p++);p<l&&(o-=l-p)}return d.e=o,d.c=f,d}),G.sum=function(){for(var t=1,e=arguments,i=new G(e[0]);t<e.length;)i=i.plus(e[t++]);return i},x=function(){var t="0123456789";function e(t,e,i,n){for(var s,r,o=[0],h=0,l=t.length;h<l;){for(r=o.length;r--;o[r]*=e);for(o[0]+=n.indexOf(t.charAt(h++)),s=0;s<o.length;s++)o[s]>i-1&&(null==o[s+1]&&(o[s+1]=0),o[s+1]+=o[s]/i|0,o[s]%=i)}return o.reverse()}return function(i,n,s,r,o){var h,l,u,a,p,c,f,m,v=i.indexOf("."),g=N,w=D;for(v>=0&&(a=U,U=0,i=i.replace(".",""),c=(m=new G(n)).pow(i.length-v),U=a,m.c=e(y(d(c.c),c.e,"0"),10,s,t),m.e=m.c.length),u=a=(f=e(i,n,s,o?(h=j,t):(h=t,j))).length;0==f[--a];f.pop());if(!f[0])return h.charAt(0);if(v<0?--u:(c.c=f,c.e=u,c.s=r,f=(c=V(c,m,g,w,s)).c,p=c.r,u=c.e),v=f[l=u+g+1],a=s/2,p=p||l<0||null!=f[l+1],p=w<4?(null!=v||p)&&(0==w||w==(c.s<0?3:2)):v>a||v==a&&(4==w||p||6==w&&1&f[l-1]||w==(c.s<0?8:7)),l<1||!f[0])i=p?y(h.charAt(1),-g,h.charAt(0)):h.charAt(0);else{if(f.length=l,p)for(--s;++f[--l]>s;)f[l]=0,l||(++u,f=[1].concat(f));for(a=f.length;!f[--a];);for(v=0,i="";v<=a;i+=h.charAt(f[v++]));i=y(i,u,h.charAt(0))}return i}}(),V=function(){function t(t,e,i){var n,s,r,o,h=0,l=t.length,u=e%p,a=e/p|0;for(t=t.slice();l--;)h=((s=u*(r=t[l]%p)+(n=a*r+(o=t[l]/p|0)*u)%p*p+h)/i|0)+(n/p|0)+a*o,t[l]=s%i;return h&&(t=[h].concat(t)),t}function e(t,e,i,n){var s,r;if(i!=n)r=i>n?1:-1;else for(s=r=0;s<i;s++)if(t[s]!=e[s]){r=t[s]>e[s]?1:-1;break}return r}function i(t,e,i,n){for(var s=0;i--;)t[i]-=s,s=t[i]<e[i]?1:0,t[i]=s*n+t[i]-e[i];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,r,o,u,a){var p,c,d,m,v,g,w,y,V,x,P,b,k,A,M,L,S,O=n.s==r.s?1:-1,E=n.c,C=r.c;if(!(E&&E[0]&&C&&C[0]))return new G(n.s&&r.s&&(E?!C||E[0]!=C[0]:C)?E&&0==E[0]||!C?0*O:O/0:NaN);for(V=(y=new G(O)).c=[],O=o+(c=n.e-r.e)+1,a||(a=h,c=f(n.e/l)-f(r.e/l),O=O/l|0),d=0;C[d]==(E[d]||0);d++);if(C[d]>(E[d]||0)&&c--,O<0)V.push(1),m=!0;else{for(A=E.length,L=C.length,d=0,O+=2,(v=s(a/(C[0]+1)))>1&&(C=t(C,v,a),E=t(E,v,a),L=C.length,A=E.length),k=L,P=(x=E.slice(0,L)).length;P<L;x[P++]=0);S=C.slice(),S=[0].concat(S),M=C[0],C[1]>=a/2&&M++;do{if(v=0,(p=e(C,x,L,P))<0){if(b=x[0],L!=P&&(b=b*a+(x[1]||0)),(v=s(b/M))>1)for(v>=a&&(v=a-1),w=(g=t(C,v,a)).length,P=x.length;1==e(g,x,w,P);)v--,i(g,L<w?S:C,w,a),w=g.length,p=1;else 0==v&&(p=v=1),w=(g=C.slice()).length;if(w<P&&(g=[0].concat(g)),i(x,g,P,a),P=x.length,-1==p)for(;e(C,x,L,P)<1;)v++,i(x,L<P?S:C,P,a),P=x.length}else 0===p&&(v++,x=[0]);V[d++]=v,x[0]?x[P++]=E[k]||0:(x=[E[k]],P=1)}while((k++<A||null!=x[0])&&O--);m=null!=x[0],V[0]||V.splice(0,1)}if(a==h){for(d=1,O=V[0];O>=10;O/=10,d++);Y(y,o+(y.e=d+c*l-1)+1,u,m)}else y.e=c,y.r=+m;return y}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,M=/^([^.]+)\.$/,L=/^\.([^.]+)$/,S=/^-?(Infinity|NaN)$/,O=/^\s*\+(?=[\w.])|^\s+|\s+$/g,P=function(t,e,i,n){var s,o=i?e:e.replace(O,"");if(S.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!i&&(o=o.replace(A,(function(t,e,i){return s="x"==(i=i.toLowerCase())?16:"b"==i?2:8,n&&n!=s?t:e})),n&&(s=n,o=o.replace(M,"$1").replace(L,"0.$1")),e!=o))return new G(o,s);if(G.DEBUG)throw Error(r+"Not a"+(n?" base "+n:"")+" number: "+e);t.s=null}t.c=t.e=null},E.absoluteValue=E.abs=function(){var t=new G(this);return t.s<0&&(t.s=1),t},E.comparedTo=function(t,e){return m(this,new G(t,e))},E.decimalPlaces=E.dp=function(t,e){var i,n,s,r=this;if(null!=t)return v(t,0,c),null==e?e=D:v(e,0,8),Y(new G(r),t+r.e+1,e);if(!(i=r.c))return null;if(n=((s=i.length-1)-f(this.e/l))*l,s=i[s])for(;s%10==0;s/=10,n--);return n<0&&(n=0),n},E.dividedBy=E.div=function(t,e){return V(this,new G(t,e),N,D)},E.dividedToIntegerBy=E.idiv=function(t,e){return V(this,new G(t,e),0,1)},E.exponentiatedBy=E.pow=function(t,i){var n,o,h,u,a,p,c,f,d=this;if((t=new G(t)).c&&!t.isInteger())throw Error(r+"Exponent not an integer: "+X(t));if(null!=i&&(i=new G(i)),a=t.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!t.c||!t.c[0])return f=new G(Math.pow(+X(d),a?t.s*(2-g(t)):+X(t))),i?f.mod(i):f;if(p=t.s<0,i){if(i.c?!i.c[0]:!i.s)return new G(NaN);(o=!p&&d.isInteger()&&i.isInteger())&&(d=d.mod(i))}else{if(t.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||a&&d.c[1]>=24e7:d.c[0]<8e13||a&&d.c[0]<=9999975e7)))return u=d.s<0&&g(t)?-0:0,d.e>-1&&(u=1/u),new G(p?1/u:u);U&&(u=e(U/l+2))}for(a?(n=new G(.5),p&&(t.s=1),c=g(t)):c=(h=Math.abs(+X(t)))%2,f=new G(C);;){if(c){if(!(f=f.times(d)).c)break;u?f.c.length>u&&(f.c.length=u):o&&(f=f.mod(i))}if(h){if(0===(h=s(h/2)))break;c=h%2}else if(Y(t=t.times(n),t.e+1,1),t.e>14)c=g(t);else{if(0==(h=+X(t)))break;c=h%2}d=d.times(d),u?d.c&&d.c.length>u&&(d.c.length=u):o&&(d=d.mod(i))}return o?f:(p&&(f=C.div(f)),i?f.mod(i):u?Y(f,U,D,void 0):f)},E.integerValue=function(t){var e=new G(this);return null==t?t=D:v(t,0,8),Y(e,e.e+1,t)},E.isEqualTo=E.eq=function(t,e){return 0===m(this,new G(t,e))},E.isFinite=function(){return!!this.c},E.isGreaterThan=E.gt=function(t,e){return m(this,new G(t,e))>0},E.isGreaterThanOrEqualTo=E.gte=function(t,e){return 1===(e=m(this,new G(t,e)))||0===e},E.isInteger=function(){return!!this.c&&f(this.e/l)>this.c.length-2},E.isLessThan=E.lt=function(t,e){return m(this,new G(t,e))<0},E.isLessThanOrEqualTo=E.lte=function(t,e){return-1===(e=m(this,new G(t,e)))||0===e},E.isNaN=function(){return!this.s},E.isNegative=function(){return this.s<0},E.isPositive=function(){return this.s>0},E.isZero=function(){return!!this.c&&0==this.c[0]},E.minus=function(t,e){var i,n,s,r,o=this,u=o.s;if(e=(t=new G(t,e)).s,!u||!e)return new G(NaN);if(u!=e)return t.s=-e,o.plus(t);var a=o.e/l,p=t.e/l,c=o.c,d=t.c;if(!a||!p){if(!c||!d)return c?(t.s=-e,t):new G(d?o:NaN);if(!c[0]||!d[0])return d[0]?(t.s=-e,t):new G(c[0]?o:3==D?-0:0)}if(a=f(a),p=f(p),c=c.slice(),u=a-p){for((r=u<0)?(u=-u,s=c):(p=a,s=d),s.reverse(),e=u;e--;s.push(0));s.reverse()}else for(n=(r=(u=c.length)<(e=d.length))?u:e,u=e=0;e<n;e++)if(c[e]!=d[e]){r=c[e]<d[e];break}if(r&&(s=c,c=d,d=s,t.s=-t.s),(e=(n=d.length)-(i=c.length))>0)for(;e--;c[i++]=0);for(e=h-1;n>u;){if(c[--n]<d[n]){for(i=n;i&&!c[--i];c[i]=e);--c[i],c[n]+=h}c[n]-=d[n]}for(;0==c[0];c.splice(0,1),--p);return c[0]?q(t,c,p):(t.s=3==D?-1:1,t.c=[t.e=0],t)},E.modulo=E.mod=function(t,e){var i,n,s=this;return t=new G(t,e),!s.c||!t.s||t.c&&!t.c[0]?new G(NaN):!t.c||s.c&&!s.c[0]?new G(s):(9==R?(n=t.s,t.s=1,i=V(s,t,0,3),t.s=n,i.s*=n):i=V(s,t,0,R),(t=s.minus(i.times(t))).c[0]||1!=R||(t.s=s.s),t)},E.multipliedBy=E.times=function(t,e){var i,n,s,r,o,u,a,c,d,m,v,g,w,y,V,x=this,P=x.c,b=(t=new G(t,e)).c;if(!(P&&b&&P[0]&&b[0]))return!x.s||!t.s||P&&!P[0]&&!b||b&&!b[0]&&!P?t.c=t.e=t.s=null:(t.s*=x.s,P&&b?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=f(x.e/l)+f(t.e/l),t.s*=x.s,(a=P.length)<(m=b.length)&&(w=P,P=b,b=w,s=a,a=m,m=s),s=a+m,w=[];s--;w.push(0));for(y=h,V=p,s=m;--s>=0;){for(i=0,v=b[s]%V,g=b[s]/V|0,r=s+(o=a);r>s;)i=((c=v*(c=P[--o]%V)+(u=g*c+(d=P[o]/V|0)*v)%V*V+w[r]+i)/y|0)+(u/V|0)+g*d,w[r--]=c%y;w[r]=i}return i?++n:w.splice(0,1),q(t,w,n)},E.negated=function(){var t=new G(this);return t.s=-t.s||null,t},E.plus=function(t,e){var i,n=this,s=n.s;if(e=(t=new G(t,e)).s,!s||!e)return new G(NaN);if(s!=e)return t.s=-e,n.minus(t);var r=n.e/l,o=t.e/l,u=n.c,a=t.c;if(!r||!o){if(!u||!a)return new G(s/0);if(!u[0]||!a[0])return a[0]?t:new G(u[0]?n:0*s)}if(r=f(r),o=f(o),u=u.slice(),s=r-o){for(s>0?(o=r,i=a):(s=-s,i=u),i.reverse();s--;i.push(0));i.reverse()}for((s=u.length)-(e=a.length)<0&&(i=a,a=u,u=i,e=s),s=0;e;)s=(u[--e]=u[e]+a[e]+s)/h|0,u[e]=h===u[e]?0:u[e]%h;return s&&(u=[s].concat(u),++o),q(t,u,o)},E.precision=E.sd=function(t,e){var i,n,s,r=this;if(null!=t&&t!==!!t)return v(t,1,c),null==e?e=D:v(e,0,8),Y(new G(r),t,e);if(!(i=r.c))return null;if(n=(s=i.length-1)*l+1,s=i[s]){for(;s%10==0;s/=10,n--);for(s=i[0];s>=10;s/=10,n++);}return t&&r.e+1>n&&(n=r.e+1),n},E.shiftedBy=function(t){return v(t,-9007199254740991,u),this.times("1e"+t)},E.squareRoot=E.sqrt=function(){var t,e,i,n,s,r=this,o=r.c,h=r.s,l=r.e,u=N+4,a=new G("0.5");if(1!==h||!o||!o[0])return new G(!h||h<0&&(!o||o[0])?NaN:o?r:1/0);if(0==(h=Math.sqrt(+X(r)))||h==1/0?(((e=d(o)).length+l)%2==0&&(e+="0"),h=Math.sqrt(+e),l=f((l+1)/2)-(l<0||l%2),i=new G(e=h==1/0?"5e"+l:(e=h.toExponential()).slice(0,e.indexOf("e")+1)+l)):i=new G(h+""),i.c[0])for((h=(l=i.e)+u)<3&&(h=0);;)if(s=i,i=a.times(s.plus(V(r,s,u,1))),d(s.c).slice(0,h)===(e=d(i.c)).slice(0,h)){if(i.e<l&&--h,"9999"!=(e=e.slice(h-3,h+1))&&(n||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(Y(i,i.e+N+2,1),t=!i.times(i).eq(r));break}if(!n&&(Y(s,s.e+N+2,0),s.times(s).eq(r))){i=s;break}u+=4,h+=4,n=1}return Y(i,i.e+N+1,D,t)},E.toExponential=function(t,e){return null!=t&&(v(t,0,c),t++),W(this,t,e,1)},E.toFixed=function(t,e){return null!=t&&(v(t,0,c),t=t+this.e+1),W(this,t,e)},E.toFormat=function(t,e,i){var n,s=this;if(null==i)null!=t&&e&&"object"==typeof e?(i=e,e=null):t&&"object"==typeof t?(i=t,t=e=null):i=$;else if("object"!=typeof i)throw Error(r+"Argument not an object: "+i);if(n=s.toFixed(t,e),s.c){var o,h=n.split("."),l=+i.groupSize,u=+i.secondaryGroupSize,a=i.groupSeparator||"",p=h[0],c=h[1],f=s.s<0,d=f?p.slice(1):p,m=d.length;if(u&&(o=l,l=u,u=o,m-=o),l>0&&m>0){for(o=m%l||l,p=d.substr(0,o);o<m;o+=l)p+=a+d.substr(o,l);u>0&&(p+=a+d.slice(o)),f&&(p="-"+p)}n=c?p+(i.decimalSeparator||"")+((u=+i.fractionGroupSize)?c.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(i.fractionGroupSeparator||"")):c):p}return(i.prefix||"")+n+(i.suffix||"")},E.toFraction=function(t){var e,i,n,s,o,h,u,p,c,f,m,v,g=this,w=g.c;if(null!=t&&(!(u=new G(t)).isInteger()&&(u.c||1!==u.s)||u.lt(C)))throw Error(r+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+X(u));if(!w)return new G(g);for(e=new G(C),c=i=new G(C),n=p=new G(C),v=d(w),o=e.e=v.length-g.e-1,e.c[0]=a[(h=o%l)<0?l+h:h],t=!t||u.comparedTo(e)>0?o>0?e:c:u,h=F,F=1/0,u=new G(v),p.c[0]=0;f=V(u,e,0,1),1!=(s=i.plus(f.times(n))).comparedTo(t);)i=n,n=s,c=p.plus(f.times(s=c)),p=s,e=u.minus(f.times(s=e)),u=s;return s=V(t.minus(i),n,0,1),p=p.plus(s.times(c)),i=i.plus(s.times(n)),p.s=c.s=g.s,m=V(c,n,o*=2,D).minus(g).abs().comparedTo(V(p,i,o,D).minus(g).abs())<1?[c,n]:[p,i],F=h,m},E.toNumber=function(){return+X(this)},E.toPrecision=function(t,e){return null!=t&&v(t,1,c),W(this,t,e,2)},E.toString=function(t){var e,i=this,n=i.s,s=i.e;return null===s?n?(e="Infinity",n<0&&(e="-"+e)):e="NaN":(null==t?e=s<=_||s>=I?w(d(i.c),s):y(d(i.c),s,"0"):10===t&&z?e=y(d((i=Y(new G(i),N+s+1,D)).c),i.e,"0"):(v(t,2,j.length,"Base"),e=x(y(d(i.c),s,"0"),10,t,n,!0)),n<0&&i.c[0]&&(e="-"+e)),e},E.valueOf=E.toJSON=function(){return X(this)},E._isBigNumber=!0,E[Symbol.toStringTag]="BigNumber",E[Symbol.for("nodejs.util.inspect.custom")]=E.valueOf,null!=n&&G.set(n),G}();var x=i(978);const P=(t,e)=>{const i=[],n=new x.EMA(e);return t.forEach((t=>{i.push(n.nextValue(t))})),i},b=(t,e)=>{const i=[],n=new x.SMA(e);return t.forEach((t=>{i.push(n.nextValue(t))})),i},k=(t,e)=>{var i;return(0===(i=t.map(((t,i)=>t>e[i]?"up":t<e[i]?"down":"neutral")).reverse()).length?[]:i.reduce(((t,e,i,n)=>{if(0===i)t.push([e]);else{const s=n[i-1],r=t[t.length-1];e!==s?t.push([e]):r.push(e)}return t}),[])).map((t=>{const e=t.length;return t.map(((t,i)=>{let n=e-i;return"down"===t?-n:"up"===t?n:0}))})).flat().reverse()},A=(t,e)=>{let{upper:i,lower:n}=e;const s=i.map(((t,e)=>t-n[e]));return t.map(((t,e)=>(t-n[e])/s[e]*100))},M=(t,e,i)=>{const n=[],s=t.length;for(let r=0;r<=s-i;r++){let s=t[r],o=e[r];for(let n=1;n<i;n++)t[r+n].isGreaterThan(s)&&(s=t[r+n]),e[r+n].isLessThan(o)&&(o=e[r+n]);n.push(s.plus(o).dividedBy(2))}return n},L=(t,e,i,n)=>{const s=[],r=t.length;for(let n=i;n<r;n++)n-i<e.length&&s.push(t[n].plus(e[n-i]).dividedBy(2));return s.slice(0,s.length-n+1)},S=(t,e,i,n,s)=>{let r=[];for(let s=0;s<=e.length-n;s++){let o=e.slice(s,s+n),h=i.slice(s,s+n),l=t.maximum(...o),u=t.minimum(...h),a=l.plus(u).dividedBy(2);r.push(a)}return r.slice(0,r.length-s+1)},O=(t,e)=>t.slice(0,t.length-e+1),E={getSMA:b,getEMA:P},C=(t,e,i=10,n)=>{const{open:s,high:r,low:o,close:h,volume:l}=e,u=t.min(...o),a=t.max(...r).minus(u).dividedBy(i),p=t(0),c={upVolume:p,downVolume:p,grossVolume:p},f=Array.from({length:i},((t,e)=>({price:u.plus(a.multipliedBy(e)),upVolume:p,downVolume:p,grossVolume:p}))),d=t(1).dividedBy(a);for(let e=0;e<h.length;e++){const n=h[e],a=s[e],c=r[e],m=o[e],v=l[e],g=n.isGreaterThanOrEqualTo(a)?v:p,w=n.isLessThan(a)?v:p,y=Math.max(0,m.minus(u).multipliedBy(d).integerValue(t.ROUND_FLOOR).toNumber()),V=Math.min(i,c.minus(u).multipliedBy(d).integerValue(t.ROUND_CEIL).toNumber());for(let t=y;t<V;t++)f[t].upVolume=f[t].upVolume.plus(g),f[t].downVolume=f[t].downVolume.plus(w),f[t].grossVolume=f[t].grossVolume.plus(g.plus(w))}for(const{upVolume:t,downVolume:e,grossVolume:i}of f)c.upVolume=c.upVolume.plus(t),c.downVolume=c.downVolume.plus(e),c.grossVolume=c.grossVolume.plus(i);return{bins:f,nodes:N(f)}},N=t=>{if(!t||0===t.length)throw new Error("Bins array is empty or not provided");let e=t[0],i=t[0];return t.forEach((t=>{t.grossVolume.isGreaterThan(e.grossVolume)&&(e=t),t.grossVolume.isLessThan(i.grossVolume)&&(i=t)})),{highestVolumeNode:e,lowestVolumeNode:i}};class D{constructor(){this.BigNumber=V,this.VolumeProfile=C}init(t){return this.ohlcv=t.reduce(((t,{open:e,high:i,low:n,close:s,volume:r,...o})=>{t.open.push(e),t.high.push(i),t.low.push(n),t.close.push(s),t.volume.push(r);for(const e of Object.keys(o))t[e]||(t[e]=[]),t[e].push(o[e]);return t}),{open:[],high:[],low:[],close:[],volume:[]}),this}getHeaders(){return Object.keys(this.ohlcv)}getData(){const{BigNumber:t,ohlcv:e}=this,i={};for(const[n,s]of Object.entries(e))i[n]=s.map((e=>t.isBigNumber(e)?e.toNumber():e));return i}getLastValues(){const t={};for(const[e,i]of Object.entries(this.ohlcv)){let n=i[i.length-1];t[e]=V.isBigNumber(n)?n.toNumber():n}return t}addColumn(t,e){const i=this.ohlcv.open.length;if(e.length>i)throw new Error("Invalid column data: The length of the new column exceeds the length of the OHLCV data");e=[...new Array(i-e.length).fill(null),...e],this.ohlcv[t]=e}crossPairs(t){const e=this.ohlcv,i={},n=t=>{if(!e.hasOwnProperty(t)&&"string"==typeof t){const[e,...i]=t.split("_");this[e.toUpperCase()]&&i.length>0&&this[e.toUpperCase()](...i)}};for(const{fast:s,slow:r}of t)if(s&&r)if(n(s),n(r),"number"!=typeof r||i[r]||(i[r]=e.close.map((()=>r))),e[s]&&e[r]){const t=k(e[s],e[r]);this.addColumn(`${s}_x_${r}`,t)}else if(e[s]&&i[r]){const t=k(e[s],i[r]);this.addColumn(`${s}_x_${r}`,t)}else console.error(`Missing ohlcv properties for ${s} or ${r}`)}ema(t){return((t,e)=>{const{ohlcv:i,compute:n}=t,s=i.close,r=P(s,e);t.addColumn(`ema_${e}`,r)})(this,t),this}sma(t){return((t,e)=>{const{ohlcv:i,compute:n}=t,s=i.close,r=b(s,e);t.addColumn(`sma_${e}`,r)})(this,t),this}MACD(t,e,i){return((t,e=12,i=26,n=9)=>{const{ohlcv:s,compute:r}=t,o=s.close,h=((t,e,i=12,n=26,s=9,r)=>{const o=P(t,e),h=P(t,e),l=o.map(((t,e)=>t.minus(h[e]))),u=P(t,l),a=l.map(((t,e)=>t.minus(u[e]))),p=k(t,l);return{macd_diff:l,macd_dea:u,macd_histogram:a,macd_diff_x_macd_dea:p}})(t.BigNumber,o,e,i,n);for(let e in h)t.addColumn(e,h[e])})(this,t,e,i),this}bollingerBands(t,e,i){return((t,e,i)=>{const{ohlcv:n,compute:s}=t,r=((t,e=20,i=2,n)=>{const s={lower:[],middle:[],upper:[]},r=new x.BollingerBands(e,i);t.forEach((t=>{const e=r.nextValue(t);if("object"==typeof e){const{lower:t,middle:i,upper:n}=e;s.lower.push(t),s.middle.push(i),s.upper.push(n)}else s.lower.push(null),s.middle.push(null),s.upper.push(null)}));const o=A(t,{upper:s.upper,lower:s.lower});return{...s,range:o}})(n.close,e,i);for(let e in r)t.addColumn(`bollinger_bands_${e}`,r[e])})(this,t,e),this}IchimokuCloud(t,e,i){return((t,e,i,n)=>{const{ohlcv:s}=t,r=((t,e,i=9,n=26,s=52)=>{const r=i,o=n,h=o-r,l=s,{high:u,low:a,close:p}=e,c=M(u,a,r),f=M(u,a,o);return{conversion_line:c,base_line:f,leading_span_a:L(c,f,h,o),leading_span_b:S(t,u,a,l,o),lagging_span:O(p,o)}})(t.BigNumber,s,e,i,n);for(let e in r)t.addColumn(`ichimoku_${e}`,r[e])})(this,t,e,i),this}RSI(t,e,i){return((t,e,i,n)=>{const{ohlcv:s,compute:r}=t,o=s.close,h=((t,e,i=14,n="SMA",s=14,r)=>{if(e.length<i)return[];i=parseInt(i),s=parseInt(s);const o=new t(0),h=new t(100),l=new t(1);let u=[],a=o,p=o;for(let n=1;n<=i;n++){const i=new t(e[n]),s=new t(e[n-1]),r=i.minus(s);r.isLessThan(o)?p=p.plus(r.abs()):a=a.plus(r)}let c=a.dividedBy(i),f=p.dividedBy(i),d=f.isEqualTo(o)?o:c.dividedBy(f);u.push(h.minus(h.dividedBy(l.plus(d))));for(let n=i+1;n<e.length;n++){const s=new t(e[n]),r=new t(e[n-1]),m=s.minus(r);m.isLessThan(o)?(p=m.abs(),a=o):(a=m,p=o),c=c.times(i-1).plus(a).dividedBy(i),f=f.times(i-1).plus(p).dividedBy(i),d=f.isEqualTo(o)?o:c.dividedBy(f),u.push(h.minus(h.dividedBy(l.plus(d))))}let m={[`rsi_${i}`]:u};if("string"==typeof n&&"number"==typeof s&&E.hasOwnProperty(`get${n}`)){const e=E[`get${n}`](t,u,s,r);m[`rsi_${n}_${s}`]=e,m[`rsi_${i}_x_rsi_${n}_${s}`]=k(t,u)}return m})(t.BigNumber,o,e,i,n,r);for(let e in h)t.addColumn(`${e}`.toLowerCase(),h[e])})(this,t,e,i),this}MFI(t){return((t,e=14)=>{const{ohlcv:i}=t,n=((t,e,i=14)=>{i=parseInt(14);const{high:n,low:s,close:r,volume:o}=e,h=t(0),l=t(100),u=t(1),a=[],p=[],c=[],f=[],d=[],m=[];for(let t=0;t<r.length;t++){const e=n[t].plus(s[t]).plus(r[t]).dividedBy(3),i=e.times(o[t]);a.push(e),p.push(i)}for(let t=1;t<a.length;t++)a[t].isGreaterThan(a[t-1])?(c.push(p[t]),f.push(h)):a[t].isLessThan(a[t-1])?(c.push(h),f.push(p[t])):(c.push(h),f.push(h));for(let t=i;t<=c.length;t++){const e=c.slice(t-i,t),n=f.slice(t-i,t),s=e.reduce(((t,e)=>t.plus(e)),h),r=n.reduce(((t,e)=>t.plus(e)),h),o=s.dividedBy(r);d.push(o)}for(let t=0;t<d.length;t++){const e=l.minus(l.dividedBy(u.plus(d[t])));m.push(e)}return m})(t.BigNumber,i,e);t.addColumn(`mfi_${e}`,n)})(this,t),this}RelativeVolume(t){return((t,e)=>{const{ohlcv:i,compute:n}=t,s=i.volume,r=((t,e,i=10,n)=>{const s=b(t,e);return e.map(((t,e)=>{const i=s[e-1];return 0===e||!i||i.isZero()?null:t.dividedBy(i)})).filter((t=>!Number.isNaN(t)))})(t.BigNumber,s,e);t.addColumn(`relative_volume_${e}`,r)})(this,t),this}}})(),OHLCV_INDICATORS=n})();
|
|
2
|
+
var OHLCV_INDICATORS;(()=>{var t={978:function(t,i){!function(t){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])})(t,e)},e=function(){return(e=Object.assign||function(t){for(var i,e=arguments,s=1,n=arguments.length;s<n;s++)for(var r in i=e[s])Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r]);return t}).apply(this,arguments)};function s(){for(var t=arguments,i=0,e=0,s=arguments.length;e<s;e++)i+=t[e].length;var n=Array(i),r=0;for(e=0;e<s;e++)for(var o=arguments[e],h=0,a=o.length;h<a;h++,r++)n[r]=o[h];return n}var n=function(){function t(t,i,e,s,n,r){void 0===r&&(r=null),this.forked=!1,this.forkedAt=0,this.lastForkY=null,this.step=s,this.index=n,this.length=0,this.startPoint=r?{y:t?r.h:r.l,x:r.x}:{y:t||i,x:e},this.init(t,i,e),this.thisPoint=this.startPoint}return t.prototype.init=function(t,i,e){this.type||(this.type=t?"h":"l"),this.candlePoint={y:"h"==this.type?t:i,x:e},this.thisPoint&&(this.prevPoint=this.thisPoint,this.nextPoint&&(this.thisPoint=this.nextPoint),this.nextPoint={y:this.k*(this.candlePoint.x+this.step)+this.b,x:this.candlePoint.x+this.step})},t.prototype.update=function(t,i,e){var s=null;if(this.length++,this.init(t,i,e),this.k&&!isNaN(this.k)||(this.k=(this.candlePoint.y-this.startPoint.y)/(this.candlePoint.x-this.startPoint.x),this.b=this.candlePoint.y-this.k*this.candlePoint.x,this.prevPoint=this.startPoint,this.thisPoint=this.candlePoint,this.nextPoint={y:this.k*(this.candlePoint.x+this.step)+this.b,x:this.candlePoint.x+this.step},s={condition:"h"==this.type?"lt":"gt",value:this.nextPoint.y,action:"fork",lineIndex:this.index}),"h"==this.type&&this.thisPoint.y<=this.candlePoint.y||"l"==this.type&&this.thisPoint.y>=this.candlePoint.y){this.k=(this.candlePoint.y-this.startPoint.y)/(this.candlePoint.x-this.startPoint.x),this.b=this.candlePoint.y-this.k*this.candlePoint.x,this.thisPoint=this.candlePoint,this.length=0,this.nextPoint={y:this.k*(this.candlePoint.x+this.step)+this.b,x:this.candlePoint.x+this.step};var n=this.rollback?this.rollback.length:0,r=this.candlePoint.y-this.prevPoint.y;("h"==this.type?r>0:r<0)?(this.rollback={k:r,b:this.candlePoint.y-r*this.candlePoint.x,length:n+1,lastForkTime:this.forkedAt||(this.rollback?this.rollback.lastForkTime:0),lastForkValue:this.forkedValue||(this.rollback?this.rollback.lastForkValue:0)},this.forked=!1,this.forkedAt=null,this.forkedValue=null):(this.forkedAt=this.candlePoint.x,this.forkedValue=this.candlePoint.y,this.forked=!0,this.rollback=null),s={condition:"h"==this.type?"lt":"gt",value:this.nextPoint.y,action:"fork",lineIndex:this.index}}else this.rollback=null;return s},t.prototype.updateStep=function(t){this.step=t},t}(),r=function(){function t(t){this.lineIndex=0,this.forkDiffH=null,this.forkDiffL=null,this.step=t,this.list=[[],[]],this.id={}}return t.prototype.add=function(t,i,e,s,r){void 0===s&&(s=null),void 0===r&&(r=null);var o,h,a,l=null;if(null==r?(o=this.lineIndex,this.lineIndex++,null!=t?this.list[0].push(o):this.list[1].push(o)):(o=r,l=this.id[o].lastForkY||(null!=t?s.h:s.l)),this.id[o]=new n(t,i,e,this.step,o,s),l&&(this.id[o].lastForkY=l),o>1||null!=r&&null!=this.id[r]){h=null!=r?r:this.list["h"==this.id[o].type?0:1][this.list["h"==this.id[o].type?0:1].indexOf(o)-1],a=null!=r?r:this.list["h"==this.id[o].type?0:1][this.list["h"==this.id[o].type?0:1].indexOf(o)-2];var u=this.id[h].lastForkY;a&&!u&&(u=this.id[a].lastForkY);var p=null!=t?s.h:s.l;u&&(t?this.forkDiffH=u>=p?-h-1:h+1:this.forkDiffL=u>=p?-h-1:h+1),this.id[h].lastForkY=p}return o},t.prototype.update=function(t,i,e,s){return this.id[t].update(i,e,s)},t.prototype.delete=function(t){this.id[t]&&("h"==this.id[t].type?this.list[0].splice(this.list[0].indexOf(t),1):this.list[1].splice(this.list[1].indexOf(t),1),delete this.id[t])},t}(),o=function(){function t(t,i){this.kdiff=[],this.env=i,this.lines=t,this.in={state:null,lineIndex:null,line:null},this.is={state:null,lineIndex:null,line:null,start:null,size:0},this.was={state:null,lineIndex:null,line:null,size:null},this.width=0,this.speed=0,this.at=0}return t.prototype.update=function(t,i){var s=this;if(t.length>1?this.hlMaxDuration=t.map((function(t){return s.lines.id[t]})).filter((function(t){return!s.is.line||(t.forkedAt?t.forkedAt>s.is.line.startPoint.x:!!t.rollback&&t.rollback.lastForkTime>s.is.line.startPoint.x)})).reduce((function(t,i){return t.length>i.length?t:i}),this.lines.id[t[0]]):this.hlMaxDuration=this.lines.id[t[0]],i.length>1?this.llMaxDuration=i.map((function(t){return s.lines.id[t]})).filter((function(t){return!s.is.line||(t.forkedAt?t.forkedAt>s.is.line.startPoint.x:!!t.rollback&&t.rollback.lastForkTime>s.is.line.startPoint.x)})).reduce((function(t,i){return t.length>i.length?t:i}),this.lines.id[i[0]]):this.llMaxDuration=this.lines.id[i[0]],null==this.is.state&&null==this.was.state&&(this.is.line=this.llMaxDuration&&this.llMaxDuration.length>this.env.minLength&&this.hlMaxDuration.length<this.env.minLength?this.llMaxDuration:this.hlMaxDuration&&this.hlMaxDuration.length>this.env.minLength&&this.llMaxDuration.length<this.env.minLength?this.hlMaxDuration:null,this.is.line&&(this.is.lineIndex=this.is.line.index,this.is.state="h"==this.is.line.type?"fall":"rise",this.is.start=this.is.line.candlePoint)),this.is.state){this.is.size=Math.max(this.is.size,Math.abs(this.is.start.y-this.is.line.candlePoint.y));var n,r=this.lines.id[this.is.lineIndex]||this.lines.id["h"==this.is.line.type?0:1],o=null,h=null,a=this.lines.list["h"==r.type?1:0].filter((function(t){return s.lines.id[t].forked&&s.lines.id[t].thisPoint.x-s.lines.id[t].forkedAt>12}));a.length>1?a[1]:a.length>0&&a[0];var l=a.filter((function(t){return s.lines.id[t].forkedAt>s.is.start.x}));if(r&&this.lines.list["h"==r.type?0:1].forEach((function(t,i){var e=s.lines.id[t];if(t>=r.index&&null!=e.rollback){n=s.lines.list["h"==r.type?0:1][i-1];var a=1==s.env.deltaModel&&i>1&&n&&s.lines.id[n]?i>1&&n&&s.lines.id[n].lastForkY:s.lines.id[t>0?t-1:0];h=a?s.lines.id[t>1?n:"h"==r.type?0:1].lastForkY-e.candlePoint.y:e.rollback?e.rollback.lastForkValue-e.candlePoint.y:0,e.rollback.lastForkValue>0&&e.thisPoint.x-e.rollback.lastForkTime>s.env.minRightLeg&&("fall"==s.is.state?s.llMaxDuration.length>1:s.hlMaxDuration.length>1)&&(("h"==r.type?h<0:h>0)||e.rollback.length>s.env.rollbackLength||2*s.is.size/3>Math.abs(s.is.start.y-s.is.line.candlePoint.y)&&s.is.size>s.is.line.candlePoint.y*s.env.minIsSizeOnRollback&&l.length>1||("h"==r.type?e.candlePoint.y>s.is.start.y&&1==s.lines.list[0].length:e.candlePoint.y<s.is.start.y&&1==s.lines.list[1].length))&&(e.candlePoint.x-e.rollback.lastForkTime>s.env.forkDurationMin&&e.candlePoint.x-e.rollback.lastForkTime<s.env.forkDurationMax||("h"==r.type?e.candlePoint.y>e.startPoint.y:e.candlePoint.y<e.startPoint.y)||("h"==r.type?e.candlePoint.y>s.is.start.y&&1==s.lines.list[0].length:e.candlePoint.y<s.is.start.y&&1==s.lines.list[1].length))&&(o=t+1)}})),o){this.in.size=(this.was.size||0)+this.is.size;var u=this.lines.id[0].candlePoint.y-this.is.start.y,p="rise"==this.is.state?u>=0:u<0;this.was.size&&(this.in.state=this.was.size>this.is.size?this.was.state:this.is.state),this.was=e({},this.is),this.was.success=p,this.is.line="fall"==this.is.state?this.llMaxDuration:this.hlMaxDuration,this.is.state="h"==this.is.line.type?"fall":"rise",this.is.lineIndex=this.is.line.index,this.is.start=this.lines.id[0].candlePoint,this.is.size=0}}},t}(),h=function(){function t(t){this.hLineDirectives=[],this.lLineDirectives=[],this.step=1,this.i=0,this.localCounter=0,this.prevPoint=null,this.env=Object.assign({step:1,minLength:5,minRightLeg:3,maxForks:500,minLog:0,maxLog:0,rollbackLength:3,deltaModel:1,minIsSizeOnRollback:.05},t),this.env.minLength=Math.round(this.env.minLength/this.env.step)||1,this.env.minRightLeg=Math.round(this.env.minRightLeg/this.env.step)||1,this.env.rollbackLength=Math.round(this.env.rollbackLength/this.env.step)||1,this.env.forkDurationMin=Math.round(this.env.forkDurationMin/this.env.step)||1,this.env.forkDurationMax=Math.round(this.env.forkDurationMax/this.env.step)||1,this.lines=new r(this.step),this.trend=new o(this.lines,this.env)}return t.prototype.log=function(t){for(var i=arguments,e=[],n=1;n<arguments.length;n++)e[n-1]=i[n];this.consoleWindow=this.env.minLog<this.localCounter&&this.localCounter<this.env.maxLog,this.consoleWindow&&console.log.apply(console,s([t],e))},t.prototype.nextValue=function(t,i,e,s){var n,r=this;this.localCounter++,this.lLineDirectives.length>0&&this.lLineDirectives.forEach((function(t,i){var e=r.lines.id[t.lineIndex];"gt"==t.condition&&s>t.value&&"fork"==t.action&&e&&(null!=t.lineIndex&&null!=e&&e.k<0?r.lines.add(null,s,r.i-1,r.prevPoint,t.lineIndex):(e.forked=!0,e.forkedAt=e.thisPoint.x,e.forkedValue=e.thisPoint.y,r.lines.add(null,s,r.i-1,r.prevPoint)))})),this.hLineDirectives.length>0&&this.hLineDirectives.forEach((function(t,i){var s=r.lines.id[t.lineIndex];"lt"==t.condition&&e<t.value&&"fork"==t.action&&s&&(s.k>0?r.lines.add(e,null,r.i-1,r.prevPoint,t.lineIndex):(s.forked=!0,s.forkedAt=s.thisPoint.x,s.forkedValue=s.thisPoint.y,r.lines.add(e,null,r.i-1,r.prevPoint)))})),this.hLineDirectives.length=0,this.lLineDirectives.length=0,this.lines.list[0].length<1?(this.lines.add(e,null,this.i),this.lines.add(null,s,this.i)):this.lines.list.forEach((function(t){return t.forEach((function(t){var i=r.lines.id[t];if(i&&i.type){n=null,i&&i.startPoint.x<r.i&&(n=r.lines.update(t,e,s,r.i));var o=i.type;n&&("h"==o?r.hLineDirectives.push(n):r.lLineDirectives.push(n))}}))}));var o=[];return this.lines.list.forEach((function(t){t&&(o=[],t.forEach((function(i,e){var s=r.lines.id[t[e]],n=r.lines.id[t[e-1]];(e>0&&s&&n&&"h"==s.type&&s.thisPoint&&n.thisPoint.y<=s.thisPoint.y||e>r.env.maxForks||e>0&&s&&n&&"l"==s.type&&s.thisPoint&&n.thisPoint.y>=s.thisPoint.y||e>r.env.maxForks)&&o.push(i)})),o.forEach((function(t){return r.lines.delete(t)})))})),this.prevPoint={x:this.i,h:e,l:s},this.trend.update(this.lines.list[0],this.lines.list[1]),this.i++,this.lines},t}(),a=Object.freeze({__proto__:null,Indicator:h}),l=function(){function t(t){this.length=t,this.filled=!1,this.pointer=0,this.buffer=new Array(t),this.maxIndex=t-1}return t.prototype.push=function(t){var i=this.buffer[this.pointer];return this.buffer[this.pointer]=t,this.iteratorNext(),i},t.prototype.pushback=function(t){this.iteratorPrev();var i=this.buffer[this.pointer];return this.buffer[this.pointer]=t,i},t.prototype.peek=function(){return this.buffer[this.pointer]},t.prototype.forEach=function(t){for(var i=this.pointer,e=0;e!==this.length;)t(this.buffer[i],e),i=(this.length+i+1)%this.length,e++},t.prototype.forEachRight=function(t){for(var i=(this.length+this.pointer-1)%this.length,e=this.length-1;e!==this.length;)t(this.buffer[i],e),i=(this.length+i-1)%this.length,e--},t.prototype.fill=function(t){this.buffer.fill(t),this.filled=!0},t.prototype.toArray=function(){return this.buffer},t.prototype.iteratorNext=function(){this.pointer++,this.pointer>this.maxIndex&&(this.pointer=0,this.filled=!0)},t.prototype.iteratorPrev=function(){this.pointer--,this.pointer<0&&(this.pointer=this.maxIndex)},t}(),u=function(t){function e(i,e){void 0===i&&(i=100);var s=t.call(this,i)||this;return s.period=i,s.mode=e,s.comparator="max"===e?s.maxComporator:s.mminComporator,s}return function(t,e){function s(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)}(e,t),e.prototype.nextValue=function(t){return this.push(t),this.getExtremum()},e.prototype.momentValue=function(t){var i=this.push(t),e=this.getExtremum();return this.pushback(i),e},e.prototype.maxComporator=function(t,i){return t>i},e.prototype.mminComporator=function(t,i){return t<i},e.prototype.getExtremum=function(t){var i=(this.length+this.pointer-2)%this.length,e="max"===this.mode?-1/0:1/0;if(!this.filled)return 0;for(;i!==this.pointer;){var s=this.buffer[(this.length+i-1)%this.length],n=this.buffer[(this.length+i+1)%this.length],r=this.buffer[i];if(this.comparator(r,e)&&this.comparator(r,s)&&this.comparator(r,n)){if(e=r,this.prevIx===i)return null;if(this.prevIx=i,t)return e}i=(this.length+i-1)%this.length}return isFinite(e)?e:(this.prevIx=null,null)},e}(l),p=function(){function t(t){this.period=t,this.sum=0,this.circular=new l(t)}return t.prototype.nextValue=function(t){var i=this;if(this.circular.push(t),this.sum+=t,this.circular.filled)return this.nextValue=function(t){return i.sum=i.sum-i.circular.push(t)+t,i.sum/i.period},this.momentValue=function(t){return(i.sum-i.circular.peek()+t)/i.period},this.sum/this.period},t.prototype.momentValue=function(t){},t}(),c=function(){function t(t){this.period=t,this.smooth=1/this.period,this.sma=new p(this.period)}return t.prototype.nextValue=function(t){return this.wema?this.wema=(t-this.wema)*this.smooth+this.wema:this.wema=this.sma.nextValue(t)},t.prototype.momentValue=function(t){return this.wema?(t-this.wema)*this.smooth+this.wema:this.sma.momentValue(t)},t}(),f=function(){function t(t){this.period=t,this.smooth=2/(this.period+1),this.sma=new p(this.period)}return t.prototype.nextValue=function(t){var i=this,e=this.sma.nextValue(t);return e&&(this.ema=e,this.nextValue=function(t){return i.ema=(t-i.ema)*i.smooth+i.ema},this.momentValue=function(t){return(t-i.ema)*i.smooth+i.ema}),e},t.prototype.momentValue=function(t){},t}(),d=function(){function t(t,i){this.indicator=t,this.samples=i,this._indicators=[]}return t.prototype.create=function(){for(var t,i=arguments,e=[],n=0;n<arguments.length;n++)e[n]=i[n];for(var r=0;r<this.samples;r++)this._indicators.push(new((t=this.indicator).bind.apply(t,s([void 0],e))))},t.prototype.nextValue=function(t){for(var i=0;i<this.samples;i++)if(void 0===(t=this._indicators[i].nextValue(t)))return t;return t},t.prototype.momentValue=function(t){for(var i=0;i<this.samples;i++)if(null==(t=this._indicators[i].momentValue(t)))return t;return t},t}(),m=function(){function t(t,i,e,s,n){void 0===t&&(t=.85),void 0===s&&(s=1),void 0===n&&(n=1),this.redunant=t,this.multiplier=s,this.offset=n,this.prevValue=0,this.lastUpperValue=0,this.lastLowerValue=0,this.samplerUp=new d(i,e),this.samplerLow=new d(i,e)}return t.prototype.create=function(){for(var t,i,e=arguments,s=[],n=0;n<arguments.length;n++)s[n]=e[n];(t=this.samplerUp).create.apply(t,s),(i=this.samplerLow).create.apply(i,s)},t.prototype.nextValue=function(t){this.lastUpperValue=t>0?Math.max(t,this.prevValue):Math.max(0,this.lastUpperValue)*this.redunant,this.lastLowerValue=t<=0?Math.min(t,this.prevValue):Math.min(0,this.lastLowerValue)*this.redunant;var i=(t<=0?t:this.lastLowerValue)*this.multiplier,e=(t>=0?t:this.lastUpperValue)*this.multiplier;return[this.samplerUp.nextValue(e)+this.offset,this.samplerLow.nextValue(i)-this.offset]},t}(),v=function(){function t(t,i,e,s){void 0===e&&(e=.85),void 0===s&&(s="WEMA"),this.period=t,this.samples=i,this.redunant=e,this.type=s,this.upper=0,this.lower=0,this.lastUpperValue=0,this.lastLowerValue=0,this.sample1Up=this.createSample(),this.sample2Up=this.createSample(),this.sample3Up=this.createSample(),this.sample1Low=this.createSample(),this.sample2Low=this.createSample(),this.sample3Low=this.createSample()}return t.prototype.nextValue=function(t){return t>0?(this.upper=this.getUp(t),this.lastLowerValue*=this.redunant,this.lower=this.getDown(this.lastLowerValue),this.lastUpperValue=t):t<0&&(this.lower=this.getDown(t),this.lastUpperValue*=this.redunant,this.upper=this.getUp(this.lastUpperValue),this.lastLowerValue=t),{upper:this.upper,lower:this.lower}},t.prototype.getUp=function(t){var i=this.sample1Up.nextValue(t),e=null;return 1===this.samples?i:(i&&(e=this.sample2Up.nextValue(i)),2===this.samples?e:e?this.sample3Up.nextValue(e):null)},t.prototype.getDown=function(t){var i=this.sample1Low.nextValue(t),e=null;return 1===this.samples?i:(i&&(e=this.sample2Low.nextValue(i)),2===this.samples?e:e?this.sample3Low.nextValue(e):null)},t.prototype.createSample=function(){switch(this.type){case"EMA":return new f(this.period);case"WEMA":return new c(this.period);case"SMA":return new p(this.period)}},t}(),V=function(){function t(t){this.period=t,this.SMAx=new p(this.period),this.SMAy=new p(this.period),this.pricesX=new l(this.period),this.pricesY=new l(this.period)}return t.prototype.nextValue=function(t,i){this.pricesX.push(t),this.pricesY.push(i),this.SMAxValue=this.SMAx.nextValue(t),this.SMAyValue=this.SMAy.nextValue(i);for(var e=0,s=0,n=0,r=0;r<this.period;r++){var o=this.pricesX.toArray()[r],h=this.pricesY.toArray()[r];e+=(o-this.SMAxValue)*(h-this.SMAyValue),s+=Math.pow(o-this.SMAxValue,2),n+=Math.pow(h-this.SMAyValue,2)}return e/Math.sqrt(s*n)},t}(),w=function(){function t(t){this.period=t,this.denominator=t*(t+1)/2,this.buffer=new l(t),this.values=[]}return t.prototype.nextValue=function(t){var i=this;if(this.buffer.push(t),this.buffer.filled){var e=0;return this.buffer.forEach((function(t,s){e+=t*(s+1)/i.denominator})),e}},t.prototype.momentValue=function(t){var i=this,e=this.buffer.push(t);if(this.buffer.filled){var s=0;return this.buffer.forEach((function(t,e){s+=t*(e+1)/i.denominator})),this.buffer.pushback(e),s}this.buffer.pushback(e)},t}(),x=function(){function t(t){void 0===t&&(t=.2),this.alpha=t,this.filled=!1}return t.prototype.nextValue=function(t){var i=this.alpha*t+(1-this.alpha)*(this.prevValue||1);if(this.filled=this.filled||void 0!==this.prevValue,this.prevValue=i,this.filled)return i},t.prototype.momentValue=function(t){if(this.filled)return this.alpha*t+(1-this.alpha)*(this.prevValue||1)},t}(),y=function(){function t(t){this.period=t,this.sum=0,this.avg=0,this.filled=!1,this.fill=0}return t.prototype.nextValue=function(t){var i=this;return this.filled?(this.nextValue=function(t){return i.avg=(i.avg*(i.period-1)+t)/i.period},this.nextValue(t)):(this.sum+=t,this.fill++,this.fill===this.period?(this.filled=!0,this.avg=this.sum/this.period,this.avg):void 0)},t.prototype.momentValue=function(t){if(this.filled)return(this.avg*(this.period-1)+t)/this.period},t}(),g=function(){function t(t){void 0===t&&(t=14),this.period=t,this.alpha=1/t,this.sma=new p(this.period)}return t.prototype.nextValue=function(t){var i=this;return this.prevValue?(this.prevValue=this.alpha*t+(1-this.alpha)*this.prevValue,this.nextValue=function(t){return i.prevValue=i.alpha*t+(1-i.alpha)*i.prevValue,i.prevValue}):this.prevValue=this.sma.nextValue(t),this.prevValue},t.prototype.momentValue=function(t){if(this.prevValue)return this.alpha*t+(1-this.alpha)*this.prevValue},t}(),P=function(){function t(t,i){void 0===t&&(t=5),void 0===i&&(i=34),this.smaSlow=new p(i),this.smaFast=new p(t)}return t.prototype.nextValue=function(t,i){var e=this;if(this.smaSlowValue=this.smaSlow.nextValue((t+i)/2),this.smaFastValue=this.smaFast.nextValue((t+i)/2),void 0!==this.smaSlowValue&&void 0!==this.smaFastValue)return this.nextValue=function(t,i){return e.smaSlowValue=e.smaSlow.nextValue((t+i)/2),e.smaFastValue=e.smaFast.nextValue((t+i)/2),e.smaFastValue-e.smaSlowValue},this.momentValue=function(t,i){return e.smaFast.momentValue((t+i)/2)-e.smaSlow.momentValue((t+i)/2)},this.smaFastValue-this.smaSlowValue},t.prototype.momentValue=function(t,i){},t}(),k=function(){function t(){this.sma=new p(5),this.ao=new P}return t.prototype.nextValue=function(t,i){var e=this;if(this.aoValue=this.ao.nextValue(t,i),void 0!==this.aoValue&&(this.smaValue=this.sma.nextValue(this.aoValue),void 0!==this.smaValue))return this.nextValue=function(t,i){return e.aoValue=e.ao.nextValue(t,i),e.smaValue=e.sma.nextValue(e.aoValue),e.aoValue-e.smaValue},this.momentValue=function(t,i){return e.ao.momentValue(t,i)-e.sma.momentValue(e.aoValue)},this.aoValue-this.smaValue},t.prototype.momentValue=function(t,i){},t}(),b=function(t,i){return(t-i)/i*100},M=function(){function t(t){this.period=t,this.value=0,this.changes=new l(t)}return t.prototype.nextValue=function(t){if(this.prevPrice){var i=b(t,this.prevPrice);return this.calculate(i),this.prevPrice=t,this.value}this.prevPrice=t},t.prototype.calculate=function(t){return this.value+=t,this.value-=this.changes.push(t),this.value},t}();function A(t){return t.consolidate=0,t.power=0,t.streak=0,t.diff=0,t.startPrice=0,t.prevPeak=0,t}var L=function(){function t(){this.up={consolidate:0,power:0,streak:0,startPrice:0,diff:0,prevPeak:0},this.down={consolidate:0,power:0,streak:0,startPrice:0,diff:0,prevPeak:0}}return t.prototype.nextValue=function(t,i,s,n){if(t<i||this.up.streak&&this.up.prevPeak<n){this.up.startPrice||(this.up.startPrice=t),this.down.streak&&A(this.down);var r=i-t;this.up.streak++,this.up.prevPeak=n,this.up.diff>r?this.up.consolidate++:this.up.consolidate=0,this.up.diff=r,this.up.power=b(i,this.up.startPrice)}return(t>i||this.down.streak&&this.down.prevPeak>s)&&(this.down.startPrice||(this.down.startPrice=t),this.up.streak&&A(this.up),r=t-i,this.down.streak++,this.down.prevPeak=s,this.down.diff>r?this.down.consolidate++:this.down.consolidate=0,this.down.diff=r,this.down.power=b(i,this.down.startPrice)),t===i&&(this.up.streak++,this.down.streak++,this.up.diff=this.down.diff=0),this.up.streak>this.down.streak?e({},this.up):e({},this.down)},t}(),S=function(){function t(t){this.max=-1/0,this.highest=new l(t)}return t.prototype.filled=function(){return this.highest.filled},t.prototype.nextValue=function(t){return this.max<t&&(this.max=t),this.highest.push(t)===this.max&&t!==this.max&&(this.max=function(t){for(var i=-1/0,e=t.length-1;e>=0;e--){var s=t[e];i<s&&(i=s)}return i}(this.highest.toArray())),this.max},t.prototype.momentValue=function(t){return this.max>t?this.max:t},t}(),C=function(){function t(t){this.min=1/0,this.lowest=new l(t)}return t.prototype.filled=function(){return this.lowest.filled},t.prototype.nextValue=function(t){return this.min>t&&(this.min=t),this.lowest.push(t)===this.min&&t!==this.min&&(this.min=function(t){for(var i=1/0,e=t.length-1;e>=0;e--){var s=t[e];i>s&&(i=s)}return i}(this.lowest.toArray())),this.min},t.prototype.momentValue=function(t){return this.min<t?this.min:t},t}(),D=function(){function t(t,i){void 0===t&&(t=14),void 0===i&&(i=3),this.period=t,this.smaPeriod=i,this.sma=new p(this.smaPeriod),this.max=new S(t),this.min=new C(t)}return t.prototype.nextValue=function(t,i,e){var s=this.max.nextValue(t),n=this.min.nextValue(i);if(this.max.filled()){var r=(e-n)/(s-n)*100;return{k:r,d:this.sma.nextValue(r)}}},t.prototype.momentValue=function(t,i,e){if(this.max.filled()){var s=this.max.momentValue(t),n=this.min.momentValue(i),r=(e-n)/(s-n)*100;return{k:r,d:this.sma.momentValue(r)}}},t}(),F=function(){function t(t){this.avgGain=new y(t),this.avgLoss=new y(t)}return t.prototype.nextValue=function(t){var i=t-this.prev;if(this.prev){var e=i>0?i:0,s=i<0?i:0,n=this.avgGain.nextValue(e),r=this.avgLoss.nextValue(s);return this.prev=t,{upAvg:n,downAvg:r}}this.prev=t},t.prototype.momentValue=function(t){var i=t-this.prev,e=i>0?i:0,s=i<0?i:0;return{upAvg:this.avgGain.momentValue(e),downAvg:this.avgLoss.momentValue(s)}},t}(),I=function(){function t(t){void 0===t&&(t=14),this.period=t,this.change=new F(this.period)}return t.prototype.nextValue=function(t){var i=this.change.nextValue(t)||{},e=i.downAvg,s=i.upAvg;if(void 0!==s&&void 0!==e)return 100-100/(1+s/-e)},t.prototype.momentValue=function(t){var i=this.change.momentValue(t)||{},e=i.downAvg,s=i.upAvg;if(void 0!==s&&void 0!==e)return 100-100/(1+s/-e)},t}(),_=function(){function t(t,i,e,s){void 0===t&&(t=14),void 0===i&&(i=3),void 0===e&&(e=3),void 0===s&&(s=14),this.rsi=new I(t),this.sma1=new p(i),this.sma2=new p(e),this.max=new S(s),this.min=new C(s)}return t.prototype.nextValue=function(t){var i=this.rsi.nextValue(t);if(void 0!==i){var e=this.max.nextValue(i),s=this.min.nextValue(i);if(this.max.filled()){var n=(i-s)/(e-s)*100,r=this.sma1.nextValue(n);if(void 0!==r)return{k:r,d:this.sma2.nextValue(r),stochRsi:n}}}},t.prototype.momentValue=function(t){if(this.max.filled()){var i=this.rsi.momentValue(t),e=this.max.momentValue(i),s=this.min.momentValue(i),n=(i-s)/(e-s)*100,r=this.sma1.momentValue(n);return{k:r,d:this.sma2.momentValue(r),stochRsi:n}}},t}(),O=function(){function t(t){this.period=t,this.values=new l(t)}return t.prototype.nextValue=function(t,i){if(i)return this.nextValue=this.pureNextValue,this.momentValue=this.pureMomentValue,this.pureNextValue(t,i);this.values.push(t)},t.prototype.momentValue=function(t,i){},t.prototype.pureNextValue=function(t,i){var e=this;return this.values.push(t),this.values.toArray().reduce((function(t,s){return t+e.positiveDelta(i,s)}),0)/this.period},t.prototype.pureMomentValue=function(t,i){var e=this,s=this.values.push(t),n=this.values.toArray().reduce((function(t,s){return t+e.positiveDelta(i,s)}),0);return this.values.pushback(s),n/this.period},t.prototype.positiveDelta=function(t,i){return t>i?t-i:i-t},t}(),E=function(){function t(t){void 0===t&&(t=20),this.md=new O(t),this.sma=new p(t)}return t.prototype.nextValue=function(t,i,e){var s=(t+i+e)/3,n=this.sma.nextValue(s),r=this.md.nextValue(s,n);return r&&(s-n)/(.015*r)},t.prototype.momentValue=function(t,i,e){var s=(t+i+e)/3,n=this.sma.momentValue(s),r=this.md.momentValue(s,n);return r&&(s-n)/(.015*r)},t}(),U=function(){function t(t){this.period=t,this.arr=[],this.filled=!1,this.devider=0,this.lastSum=0,this.devider=function(t){for(var i=0,e=t.length;e>0;)i+=t[--e];return i}(Array.from(Array(this.period).keys()).map((function(t){return t+1})))}return t.prototype.nextValue=function(t){if(this.filled=this.filled||this.arr.length===this.period,this.arr.push(t),this.filled)return this.arr.shift(),this.arr.reduce((function(t,i,e){return t+i*(e+1)}),0)/this.devider},t.prototype.momentValue=function(t){if(this.filled){var i=this.arr.slice(1);return i.push(t),i.reduce((function(t,i,e){return t+i*(e+1)}),0)/this.devider}},t}();function R(t,i,e){if(e){var s=t-i,n=t>e?t-e:e-t,r=i>e?i-e:e-i;return s>=n&&s>=r?s:n>=s&&n>=r?n:r}}var T=function(){function t(t,i){switch(void 0===t&&(t=14),void 0===i&&(i="WEMA"),i){case"SMA":this.avg=new p(t);break;case"EMA":this.avg=new f(t);break;case"SMMA":this.avg=new y(t);break;case"WEMA":this.avg=new c(t);break;case"LWMA":this.avg=new U(t);break;case"EWMA":this.avg=new x(.2);break;case"RMA":this.avg=new g(t)}this.prevClose=0}return t.prototype.nextValue=function(t,i,e){var s=R(t,i,this.prevClose);if(this.prevClose=e,void 0!==s)return this.avg.nextValue(s)},t.prototype.momentValue=function(t,i){var e=R(t,i,this.prevClose);if(void 0!==e)return this.avg.momentValue(e)},t}(),N=function(){function t(t){void 0===t&&(t=5),this.values=new l(t)}return t.prototype.nextValue=function(t){var i=this.values.push(t);if(i)return(t-i)/i*100},t.prototype.momentValue=function(t){var i=this.values.peek();if(i)return(t-i)/i*100},t}(),W=function(){function t(t){void 0===t&&(t=20),this.maxProvider=new S(t),this.minProvider=new C(t)}return t.prototype.nextValue=function(t,i){var e=this.maxProvider.nextValue(t),s=this.minProvider.nextValue(i);return{upper:e,middle:(e+s)/2,lower:s}},t.prototype.momentValue=function(t,i){var e=this.maxProvider.momentValue(t),s=this.minProvider.momentValue(i);return{upper:e,middle:(e+s)/2,lower:s}},t}(),$=function(){function t(t){this.period=t,this.fill=0,this.values=new l(t)}return t.prototype.nextValue=function(t){var i=this;if(this.values.push(t),this.fill++,this.fill===this.period)return this.nextValue=function(t){var e=i.calc(t);return i.values.push(t),e},this.momentValue=this.calc,this.calc(t)},t.prototype.momentValue=function(t){},t.prototype.calc=function(t){var i=0;return this.values.toArray().forEach((function(e){e<=t&&i++})),i/this.period*100},t}(),j=function(){function t(t,i,e){void 0===t&&(t=3),void 0===i&&(i=2),void 0===e&&(e=100),this.period=t,this.rsi=new I(this.period),this.updownRsi=new I(i),this.roc=new N(1),this.percentRank=new $(e),this.updownPeriod=0,this.prevClose=0}return t.prototype.nextValue=function(t){var i=this.rsi.nextValue(t),e=this.percentRank.nextValue(this.roc.nextValue(t));if(this.updownPeriod=this.getUpdownPeriod(t),this.prevClose=t,this.updownValue=this.updownRsi.nextValue(this.updownPeriod),this.updownValue)return(i+this.updownValue+e)/3},t.prototype.momentValue=function(t){var i=this.rsi.momentValue(t),e=this.percentRank.momentValue(this.roc.momentValue(t)),s=this.getUpdownPeriod(t),n=this.updownRsi.momentValue(s);if(void 0!==n)return(i+n+e)/3},t.prototype.getUpdownPeriod=function(t){var i=this.updownPeriod;return t>this.prevClose?(this.updownPeriod<0&&(i=0),i++):t<this.prevClose?(this.updownPeriod>0&&(i=0),i--):i=0,i},t}(),z=function(){function t(t){this.period=t,this.values=new l(t)}return t.prototype.nextValue=function(t,i){return this.values.push(t),Math.sqrt(this.values.toArray().reduce((function(t,e){return t+Math.pow(e-i,2)}),0)/this.period)},t.prototype.momentValue=function(t,i){var e=this.values.push(t),s=Math.sqrt(this.values.toArray().reduce((function(t,e){return t+Math.pow(e-i,2)}),0)/this.period);return this.values.pushback(e),s},t}(),B=function(){function t(t,i){void 0===t&&(t=20),void 0===i&&(i=2),this.period=t,this.stdDev=i,this.fill=0,this.sma=new p(t),this.sd=new z(t)}return t.prototype.nextValue=function(t){var i=this,e=this.sma.nextValue(t),s=this.sd.nextValue(t,e);if(this.fill++,this.fill===this.period){var n=e-this.stdDev*s,r=e+this.stdDev*s;return this.nextValue=function(t){var e=i.sma.nextValue(t),s=i.sd.nextValue(t,e);return{lower:e-i.stdDev*s,middle:e,upper:e+i.stdDev*s}},{lower:n,middle:e,upper:r}}},t.prototype.momentValue=function(t){var i=this.sma.momentValue(t),e=this.sd.momentValue(t,i);return{lower:i-this.stdDev*e,middle:i,upper:i+this.stdDev*e}},t}(),H=function(){function t(t,i,e){void 0===t&&(t=12),void 0===i&&(i=26),void 0===e&&(e=9),this.periodEmaFast=t,this.periodEmaSlow=i,this.periodSignal=e,this.emaFastIndicator=new f(t),this.emaSlowIndicator=new f(i),this.emaSignalIndicator=new f(e)}return t.prototype.nextValue=function(t){var i=this.emaFastIndicator.nextValue(t),e=this.emaSlowIndicator.nextValue(t),s=i-e,n=s&&this.emaSignalIndicator.nextValue(s)||void 0,r=s-n||void 0;if(!isNaN(s))return{macd:s,emaFast:i,emaSlow:e,signal:n,histogram:r}},t.prototype.momentValue=function(t){var i=this.emaFastIndicator.momentValue(t),e=this.emaSlowIndicator.momentValue(t),s=i-e,n=s&&this.emaSignalIndicator.momentValue(s);return{macd:s,emaFast:i,emaSlow:e,signal:n,histogram:s-n}},t}(),Y=function(){function t(){this.prevOpen=0,this.prevClose=0}return t.prototype.nextValue=function(t,i,e,s){var n=this.calculate(t,i,e,s);return this.prevClose=n.c,this.prevOpen=n.o,n},t.prototype.momentValue=function(t,i,e,s){return this.calculate(t,i,e,s)},t.prototype.calculate=function(t,i,e,s){return s=(t+i+e+s)/4,this.prevOpen&&(t=(this.prevOpen+this.prevClose)/2),{o:t,h:i=Math.max(i,t,s),l:e=Math.min(e,t,s),c:s}},t}(),X=function(){function t(t){switch(void 0===t&&(t="classic"),this.mode=t,this.mode){case"classic":this.calculator=this.classic;break;case"camarilla":this.calculator=this.camarilla;break;case"woodie":this.calculator=this.woodie;break;case"fibonacci":this.calculator=this.fibonacci}}return t.prototype.nextValue=function(t,i,e){return this.calculator(t,i,e)},t.prototype.classic=function(t,i,e){var s=(t+i+e)/3;return{r3:t+2*(s-i),r2:s+(t-i),r1:2*s-i,pp:s,s1:2*s-t,s2:s-(t-i),s3:i-2*(t-s)}},t.prototype.woodie=function(t,i,e){var s=(t+i+2*e)/4;return{r2:s+t-i,r1:2*s-i,pp:s,s1:2*s-t,s2:s-t+i}},t.prototype.camarilla=function(t,i,e){var s=1.1*(t-i),n=t/i*e,r=e+s/2,o=n+1.168*(n-r);return{r6:o,r5:n,r4:r,r3:e+s/4,r2:e+s/6,r1:e+s/12,pp:(t+i+e)/3,s1:e-s/12,s2:e-s/6,s3:e-s/4,s4:e-s/2,s5:e-(n-e),s6:e-(o-e)}},t.prototype.fibonacci=function(t,i,e){var s=t-i,n=(t+i+e)/3;return{r3:n+s,r2:n+.618*s,r1:n+.382*s,pp:n,s1:n-.382*s,s2:n-.618*s,s3:n-s}},t}(),q=function(){function t(t,i,e){void 0===t&&(t=.02),void 0===i&&(i=.02),void 0===e&&(e=.2),this.start=t,this.acceleration=i,this.max=e,this.result=0,this.isBullTrend=!0}return t.prototype.nextValue=function(t,i,e){if(!this.result)return this.result=e,this.low1=i,this.high1=t,this.low2=i,this.high2=t,this.highest=t,this.lowest=i,this.accelerationFactor=this.start,i;if(this.isBullTrend?this.psar=this.result+this.accelerationFactor*(this.highest-this.result):this.psar=this.result+this.accelerationFactor*(this.lowest-this.result),this.isBullTrend)if(i<this.psar)this.isBullTrend=!1,this.psar=this.highest,this.lowest=i,this.accelerationFactor=this.start;else{if(t>this.highest){this.highest=t;var s=this.accelerationFactor+this.acceleration;this.accelerationFactor=s>this.max?this.max:s}this.low1<this.psar&&(this.psar=this.low1),this.low2<this.psar&&(this.psar=this.low2)}else t>this.psar?(this.isBullTrend=!0,this.psar=this.lowest,this.highest=t,this.accelerationFactor=this.start):(i<this.lowest&&(this.lowest=i,s=this.accelerationFactor+this.acceleration,this.accelerationFactor=s>this.max?this.max:s),this.high1>this.psar&&(this.psar=this.high1),this.high2>this.psar&&(this.psar=this.high2));return this.low2=this.low1,this.low1=i,this.high2=this.high1,this.high1=t,this.result=this.psar,this.result},t.prototype.momentValue=function(t,i){if(!this.result)return i;var e,s=this.isBullTrend,n=this.result,r=this.low1,o=this.high1,h=this.low2,a=this.high2,l=this.highest,u=this.lowest,p=this.accelerationFactor;return e=s?n+p*(l-n):n+p*(u-n),s?i<e?e=l:(r<e&&(e=r),h<e&&(e=h)):t>e?e=u:(o>e&&(e=o),a>e&&(e=a)),e},t}(),G=function(){function t(t){this.period=t,this.prevValue=0,this.sumCount=1}return t.prototype.nextValue=function(t){var i=this;return this.sumCount<this.period?(this.prevValue+=t,void this.sumCount++):this.sumCount===this.period?(this.prevValue+=t,this.sumCount++,this.nextValue=function(t){return i.prevValue=i.prevValue-i.prevValue/i.period+t},this.prevValue):void 0},t.prototype.momentValue=function(t){if(!(this.sumCount<this.period))return this.prevValue-this.prevValue/this.period+t},t}(),J=function(){function t(t){void 0===t&&(t=14),this.period=t,this.wma1=new G(t),this.wma2=new G(t),this.wma3=new G(t),this.wema=new c(t)}return t.prototype.nextValue=function(t,i,e){if(!this.prevClose)return this.prevHigh=t,this.prevLow=i,void(this.prevClose=e);var s=0,n=0,r=t-this.prevHigh,o=this.prevLow-i;r>o&&r>0&&(s=r),o>r&&o>0&&(n=o),(s>n||n<0)&&(n=0);var h=this.wma1.nextValue(R(t,i,this.prevClose)),a=this.wma2.nextValue(s),l=this.wma3.nextValue(n);if(this.prevHigh=t,this.prevLow=i,this.prevClose=e,void 0!==a&&void 0!==l){var u=100*a/h,p=100*l/h,c=u>p?u-p:p-u;return{adx:this.wema.nextValue(c/(u+p)*100),pdi:u,mdi:p}}},t.prototype.momentValue=function(t,i,e){if(this.prevClose){var s=0,n=0,r=t-this.prevHigh,o=this.prevLow-i;r>o&&r>0&&(s=r),o>r&&o>0&&(n=o),(s>n||n<0)&&(n=0);var h=this.wma1.momentValue(R(t,i,this.prevClose)),a=this.wma2.momentValue(s),l=this.wma3.momentValue(n);if(void 0!==a&&void 0!==l){var u=100*a/h,p=100*l/h,c=u>p?u-p:p-u;return{adx:this.wema.momentValue(c/(u+p)*100),pdi:u,mdi:p}}}},t}(),K=function(){function t(t,i,e){void 0===t&&(t=10),void 0===i&&(i=3),void 0===e&&(e="WEMA"),this.multiplier=i,this.atr=new T(t,e)}return t.prototype.nextValue=function(t,i,e){var s=this.atr.nextValue(t,i,e);if(s){var n=(t+i)/2,r=n+this.multiplier*s,o=n-this.multiplier*s;this.prevLower&&(o=o>this.prevLower||this.prevClose<this.prevLower?o:this.prevLower,r=r<this.prevUpper||this.prevClose>this.prevUpper?r:this.prevUpper);var h,a=(h=this.prevSuper===this.prevUpper?e>r?o:r:e<o?r:o)===r?1:-1;return this.prevUpper=r,this.prevLower=o,this.prevSuper=h,this.prevClose=e,{upper:r,lower:o,superTrend:h,direction:a}}},t.prototype.momentValue=function(t,i,e){var s=this.atr.momentValue(t,i),n=(t+i)/2,r=n+this.multiplier*s,o=n-this.multiplier*s;this.prevLower&&(o=o>this.prevLower||this.prevClose<this.prevLower?o:this.prevLower,r=r<this.prevSuper||this.prevClose>this.prevUpper?r:this.prevUpper);var h;return{upper:r,lower:o,superTrend:h=this.prevSuper===this.prevUpper?e>r?o:r:e<o?r:o,direction:h===r?1:-1}},t}(),Q=function(t){return(t.o+t.h+t.l+t.c)/4},Z=function(){function t(t,i){void 0===t&&(t=4),void 0===i&&(i=Q),this.sum=0,this.sessionPricesLookup=new Set,this.sessionVolumes={},this.prevCandle=null,this.source=i,this.precision=t,this.valueToRoundWith=Math.pow(10,this.precision)}return t.prototype.getSession=function(t,i){var e=this;void 0===i&&(i=15);var s=this.source(t),n=1/0,r=s;this.sessionPricesLookup.forEach((function(t){var o=e.diffPercent(t,s);o>i?(e.sessionPricesLookup.delete(t),delete e.sessionVolumes[t]):o<n&&(n=o,r=t)}));var o=Array.from(this.sessionPricesLookup).sort(),h=o.indexOf(r),a=new Map;if(-1===h)return a;for(var l=Math.round(o.length/4),u=0,p=0;p<4;p++){for(var c=p*l,f=c+l,d=0,m=0,v=c;v<f;v++){var V=o[c],w=this.sessionVolumes[V];d<w&&(d=w,m=V)}this.diffPercent(u,m)<1&&(d=a.get(u)+d,m=this.roundPrice((m+u)/2),a.delete(u)),a.set(m,d),u=m}return a},t.prototype.getSessionAvg=function(){return this.sum/this.sessionPricesLookup.size},t.prototype.getRawSession=function(){return this.sessionVolumes},t.prototype.nextValue=function(t){var i,e=this.roundPrice(this.source(t)),s=(null===(i=this.prevCandle)||void 0===i?void 0:i.time)===t.time?t.v-this.prevCandle.v:t.v;this.addToSession(e,s),this.sum+=s,this.lastPrice=e,this.prevCandle=t},t.prototype.roundPrice=function(t){return Math.round((t+Number.EPSILON)*this.valueToRoundWith)/this.valueToRoundWith},t.prototype.addToSession=function(t,i){this.sessionPricesLookup.has(t)?this.sessionVolumes[t]+=i:(this.sessionPricesLookup.add(t),this.sessionVolumes[t]=i)},t.prototype.diffPercent=function(t,i){return t<i?100*(i-t)/t:100*(t-i)/i},t}(),tt=function(){function t(t,i){void 0===t&&(t=3),void 0===i&&(i=10),this.accDistribution=0,this.emaFast=new f(t),this.emaSlow=new f(i)}return t.prototype.nextValue=function(t,i,e,s){return this.accDistribution+=e===t&&e===i||t===i?0:(2*e-i-t)/(t-i)*s,this.emaFast.nextValue(this.accDistribution)-this.emaSlow.nextValue(this.accDistribution)},t.prototype.momentValue=function(t,i,e,s){var n=this.accDistribution+(e===t&&e===i||t===i?0:(2*e-i-t)/(t-i)*s);return this.emaFast.momentValue(n)-this.emaSlow.momentValue(n)},t}();t.AC=k,t.ADX=J,t.AO=P,t.ATR=T,t.BollingerBands=B,t.CCI=E,t.ChaikinOscillator=tt,t.CircularBuffer=l,t.Correlation=V,t.DC=W,t.EMA=f,t.EWMA=x,t.Extremums=u,t.HeikenAshi=Y,t.LWMA=U,t.Level=v,t.MACD=H,t.Move=M,t.PSAR=q,t.Pivot=X,t.RMA=g,t.ROC=N,t.RSI=I,t.SMA=p,t.SMMA=y,t.Sampler=d,t.StandardDeviation=z,t.Stochastic=D,t.StochasticRSI=_,t.SuperTrend=K,t.TrendLines=a,t.UniLevel=m,t.VolumeProfile=Z,t.WEMA=c,t.WMA=w,t.WWS=G,t.Wave=L,t.cRSI=j,Object.defineProperty(t,"__esModule",{value:!0})}(i)}},i={};function e(s){var n=i[s];if(void 0!==n)return n.exports;var r=i[s]={exports:{}};return t[s].call(r.exports,r,r.exports,e),r.exports}e.d=(t,i)=>{for(var s in i)e.o(i,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:i[s]})},e.o=(t,i)=>Object.prototype.hasOwnProperty.call(t,i),e.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};(()=>{"use strict";e.r(s),e.d(s,{default:()=>u});var t=e(978);const i=(i,e)=>{const s=[],n=new t.EMA(e);return i.forEach((t=>{s.push(n.nextValue(t))})),s},n=(i,e)=>{const s=[],n=new t.SMA(e);return i.forEach((t=>{s.push(n.nextValue(t))})),s},r=(t,i)=>{var e;return(0===(e=t.map(((t,e)=>t>i[e]?"up":t<i[e]?"down":"neutral")).reverse()).length?[]:e.reduce(((t,i,e,s)=>{if(0===e)t.push([i]);else{const n=s[e-1],r=t[t.length-1];i!==n?t.push([i]):r.push(i)}return t}),[])).map((t=>{const i=t.length;return t.map(((t,e)=>{let s=i-e;return"down"===t?-s:"up"===t?s:0}))})).flat().reverse()},o=(t,i)=>{let{upper:e,lower:s}=i;const n=e.map(((t,i)=>t-s[i]));return t.map(((t,i)=>(t-s[i])/n[i]*100))},h={getSMA:n,getEMA:i},a=(t,i=10)=>{const{open:e,high:s,low:n,close:r,volume:o}=t,h=Math.min(...n),a=(Math.max(...s)-h)/i,u={upVolume:0,downVolume:0,grossVolume:0},p=Array.from({length:i},((t,i)=>({price:h+a*i,upVolume:0,downVolume:0,grossVolume:0}))),c=1/a;for(let t=0;t<r.length;t++){const a=r[t],l=e[t],u=s[t],f=n[t],d=o[t],m=a>=l?d:0,v=a<l?d:0,V=Math.max(0,Math.floor((f-h)*c)),w=Math.min(i,Math.ceil((u-h)*c));for(let t=V;t<w;t++)p[t].upVolume+=m,p[t].downVolume+=v,p[t].grossVolume+=m+v}for(const{upVolume:t,downVolume:i,grossVolume:e}of p)u.upVolume+=t,u.downVolume+=i,u.grossVolume+=e;return{bins:p,nodes:l(p)}},l=t=>{if(!t||0===t.length)throw new Error("Bins array is empty or not provided");let i=t[0],e=t[0];return t.forEach((t=>{t.grossVolume>i.grossVolume&&(i=t),t.grossVolume<e.grossVolume&&(e=t)})),{highestVolumeNode:i,lowestVolumeNode:e}};class u{constructor(){this.VolumeProfile=a}init(t){return this.ohlcv=t.reduce(((t,{open:i,high:e,low:s,close:n,volume:r,...o})=>{t.open.push(i),t.high.push(e),t.low.push(s),t.close.push(n),t.volume.push(r);for(const i of Object.keys(o))t[i]||(t[i]=[]),t[i].push(o[i]);return t}),{open:[],high:[],low:[],close:[],volume:[]}),this}getHeaders(){return Object.keys(this.ohlcv)}getData(){const{ohlcv:t}=this,i={};for(const[e,s]of Object.entries(t))i[e]=s;return i}getLastValues(){const t={};for(const[i,e]of Object.entries(this.ohlcv)){let s=e[e.length-1];t[i]=s}return t}addColumn(t,i){const e=this.ohlcv.open.length;if(i.length>e)throw new Error("Invalid column data: The length of the new column exceeds the length of the OHLCV data");i=[...new Array(e-i.length).fill(null),...i],this.ohlcv[t]=i}crossPairs(t){const i=this.ohlcv,e={},s=t=>{if(!i.hasOwnProperty(t)&&"string"==typeof t){const[i,...e]=t.split("_");this[i]&&e.length>0&&this[i](...e)}};for(const{fast:n,slow:o}of t)if(n&&o)if(s(n),s(o),"number"!=typeof o||e[o]||(e[o]=i.close.map((()=>o))),i[n]&&i[o]){const t=r(i[n],i[o]);this.addColumn(`${n}_x_${o}`,t)}else if(i[n]&&e[o]){const t=r(i[n],e[o]);this.addColumn(`${n}_x_${o}`,t)}else console.error(`Missing ohlcv properties for ${n} or ${o}`)}ema(t){return((t,e)=>{const{ohlcv:s}=t,n=s.close,r=i(n,e);t.addColumn(`ema_${e}`,r)})(this,t),this}sma(t){return((t,i)=>{const{ohlcv:e}=t,s=e.close,r=n(s,i);t.addColumn(`sma_${i}`,r)})(this,t),this}macd(t,e,s){return((t,e=12,s=26,n=9)=>{const{ohlcv:o}=t,h=((t,e=12,s=26,n=9)=>{const o=i(t,e),h=i(t,s),a=o.map(((t,i)=>isNaN(t)||isNaN(h[i])?null:t-h[i])),l=i(a,n),u=a.map(((t,i)=>t-l[i])),p=r(a,l);return{macd_diff:a,macd_dea:l,macd_histogram:u,macd_diff_x_macd_dea:p}})(o.close,e,s,n);for(let i in h)t.addColumn(i,h[i])})(this,t,e,s),this}bollingerBands(i,e,s){return((i,e,s)=>{const{ohlcv:n}=i,r=((i,e=20,s=2)=>{const n={lower:[],middle:[],upper:[]},r=new t.BollingerBands(e,s);i.forEach((t=>{const i=r.nextValue(t);if("object"==typeof i){const{lower:t,middle:e,upper:s}=i;n.lower.push(t),n.middle.push(e),n.upper.push(s)}else n.lower.push(null),n.middle.push(null),n.upper.push(null)}));const h=o(i,{upper:n.upper,lower:n.lower});return{...n,range:h}})(n.close,e,s);for(let t in r)i.addColumn(`bollinger_bands_${t}`,r[t])})(this,i,e),this}rsi(i,e,s){return((i,e,s,n)=>{const{ohlcv:o}=i,a=((i,e=14,s="SMA",n=14)=>{if(i.length<e)return[];let o=[];e=parseInt(e),n=parseInt(n);const a=new t.RSI(e);i.forEach((t=>{o.push(a.nextValue(t))})),o=o.filter((t=>t));let l={[`rsi_${e}`]:o};if("string"==typeof s&&"number"==typeof n&&h.hasOwnProperty(`get${s}`)){const t=h[`get${s}`](o,n);l[`rsi_${s}_${n}`]=t,l[`rsi_${e}_x_rsi_${s}_${n}`]=r(o,t)}return l})(o.close,e,s,n);for(let t in a)i.addColumn(`${t}`.toLowerCase(),a[t])})(this,i,e,s),this}}})(),OHLCV_INDICATORS=s})();
|
package/index.js
CHANGED
|
@@ -35,12 +35,12 @@ export default class OHLCV_INDICATORS {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
getData() {
|
|
38
|
-
const {
|
|
38
|
+
const {ohlcv} = this
|
|
39
39
|
const output = {}
|
|
40
40
|
|
|
41
41
|
for(const[key, arr] of Object.entries(ohlcv))
|
|
42
42
|
{
|
|
43
|
-
output[key] = arr
|
|
43
|
+
output[key] = arr
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
return output
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ohlcv-indicators",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "A JavaScript library featuring optimized trading indicators for OHLCV arrays [{open, high, low, close, value}]
|
|
3
|
+
"version": "1.1.8",
|
|
4
|
+
"description": "A JavaScript library featuring optimized trading indicators for OHLCV arrays [{open, high, low, close, value}]. This library is optimized for backtesting and trading bot development.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|