Socket
Socket
Sign inDemoInstall

technicalindicators

Package Overview
Dependencies
47
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.7 to 2.0.8

3

declarations/directionalmovement/ATR.d.ts
import { Indicator, IndicatorInput } from '../indicator/indicator';
import { CandleData } from '../StockData';
export declare class ATRInput extends IndicatorInput {

@@ -13,4 +14,4 @@ low: number[];

static calculate: typeof atr;
nextValue(price: number): number | undefined;
nextValue(price: CandleData): number | undefined;
}
export declare function atr(input: ATRInput): number[];
// Generated by dts-bundle v0.7.3
export { FixedSizeLinkedList };
/**

@@ -191,3 +191,3 @@ * Created by AAravindan on 5/7/16.

static calculate: typeof atr;
nextValue(price: number): number | undefined;
nextValue(price: CandleData): number | undefined;
}

@@ -194,0 +194,0 @@ export function atr(input: ATRInput): number[];

@@ -1,1 +0,1 @@

(function(e){'use strict';function r(e){return ie[e]}function t(e){let t=r('precision');return t?parseFloat(e.toPrecision(t)):e}function o(e){pe.reverseInputs(e);var r=new de(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function a(e){pe.reverseInputs(e);var r=new ge(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function l(e){pe.reverseInputs(e);var r=new ve(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function n(e){pe.reverseInputs(e);var r=new ce(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function s(e){pe.reverseInputs(e);var r=new me(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function u(e){pe.reverseInputs(e);var r=new xe(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function i(e){pe.reverseInputs(e);var r=new we(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function h(e){pe.reverseInputs(e);var r=new fe(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function p(e){pe.reverseInputs(e);var r=new Ie(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function d(e){pe.reverseInputs(e);var r=new Pe(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function g(e){pe.reverseInputs(e);var r=new Se(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function v(e){pe.reverseInputs(e);var r=new Ee(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function c(e){pe.reverseInputs(e);var r=new He(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function m(e){pe.reverseInputs(e);var r=new Ve(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function x(e){pe.reverseInputs(e);var r=new ke(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function w(e){pe.reverseInputs(e);var r=new Te(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function f(e){pe.reverseInputs(e);var r=new Ae(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function I(e){pe.reverseInputs(e);var r=new De(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function P(e){pe.reverseInputs(e);var r=new Be(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function _(e){pe.reverseInputs(e);var r=new Le(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function b(e){pe.reverseInputs(e);var r=new ze(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function C(e){pe.reverseInputs(e);var r=new Me(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function S(e){pe.reverseInputs(e);var r=new je(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function q(e){pe.reverseInputs(e);var r=new Re(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function E(e){pe.reverseInputs(e);var r=new ye(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function H(e,r,t,o){return e<=t&&r>=t||t<=e&&o>=e}function V(e){pe.reverseInputs(e);var r=new Oe(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function k(e){pe.reverseInputs(e);var r=new Ue(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function T(e){pe.reverseInputs(e);var r=new We(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function A(e){pe.reverseInputs(e);var r=new Ke(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function D(e){pe.reverseInputs(e);var r=new Ge(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function B(e){pe.reverseInputs(e);var r=new Ne(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function L(e){pe.reverseInputs(e);var r=new Xe(e).result;return e.reversedInput&&(r.open.reverse(),r.high.reverse(),r.low.reverse(),r.close.reverse(),r.volume.reverse(),r.timestamp.reverse()),pe.reverseInputs(e),r}function z(e){pe.reverseInputs(e);var r=new Qe(e).result;return e.reversedInput&&(r.open.reverse(),r.high.reverse(),r.low.reverse(),r.close.reverse(),r.volume.reverse(),r.timestamp.reverse()),pe.reverseInputs(e),r}function M(e){return new sr().hasPattern(e)}function j(e){return new ur().hasPattern(e)}function R(e){return new ir().hasPattern(e)}function y(e){return new hr().hasPattern(e)}function O(e,r){var t=function(e,r,t){return e+(r-e)*t},o=[],a=new Number((e.length-1)/(r-1));o[0]=e[0];for(var l=1;l<r-1;l++){var n=l*a,s=new Number(Math.floor(n)).toFixed(),u=new Number(Math.ceil(n)).toFixed();o[l]=t(e[s],e[u],n-s)}return o[r-1]=e[e.length-1],o}function F(e){var r=e.reduce((e,r)=>e+r*r,0),t=ae(r);return e.map((e)=>e/t)}function U(){return jr(this,void 0,void 0,function*(){return Fr?Promise.resolve(!0):Ur?Or:(Ur=!0,Or=new Promise(function(e){return jr(this,void 0,void 0,function*(){if(Rr){Mr=require('@tensorflow/tfjs'),console.log('Nodejs Environment detected ');var r=require('@tensorflow/tfjs-node'),t=require('path').resolve(__dirname,'../tf_model/model.json');zr=yield Mr.loadModel(r.io.fileSystem(t))}else return'undefined'==typeof window.tf?(Fr=!1,Ur=!1,console.log('Tensorflow js not imported, pattern detection may not work'),void e()):(Mr=window.tf,console.log('Browser Environment detected ',Mr),console.log('Loading model ....'),zr=yield Mr.loadModel('/tf_model/model.json'),Fr=!0,Ur=!1,setTimeout(e,1e3),void console.log('Loaded model'));return Fr=!0,Ur=!1,void e()})}),void(yield Or))})}function W(e){return jr(this,void 0,void 0,function*(){yield U(),300>e.values.length&&console.warn('Pattern detector requires atleast 300 data points for a reliable prediction, received just ',e.values.length),pe.reverseInputs(e);var r=e.values,t=yield zr.predict(Mr.tensor2d([F(O(r,400))])),o=Mr.argMax(t,1).get(0);return pe.reverseInputs(e),{patternId:o,pattern:yr[o],probability:100*t.get(0,4)}})}function K(r){return jr(this,void 0,void 0,function*(){var t=yield W(r);return t.patternId===e.AvailablePatterns.DB})}function G(r){return jr(this,void 0,void 0,function*(){var t=yield W(r);return t.patternId===e.AvailablePatterns.DT})}function N(r){return jr(this,void 0,void 0,function*(){var t=yield W(r);return t.patternId===e.AvailablePatterns.HS})}function X(r){return jr(this,void 0,void 0,function*(){var t=yield W(r);return t.patternId===e.AvailablePatterns.IHS})}function Q(r){return jr(this,void 0,void 0,function*(){var t=yield W(r);return t.patternId===e.AvailablePatterns.TU})}function Y(r){return jr(this,void 0,void 0,function*(){var t=yield W(r);return t.patternId===e.AvailablePatterns.TD})}function Z(e){pe.reverseInputs(e);var r=new Kr(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function $(e){pe.reverseInputs(e);var r=new Gr(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function J(e){pe.reverseInputs(e);var r=new Nr(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function ee(){return['sma','ema','wma','wema','macd','rsi','bollingerbands','adx','atr','truerange','roc','kst','psar','stochastic','williamsr','adl','obv','trix','cci','awesomeoscillator','forceindex','vwap','volumeprofile','renko','heikinashi','stochasticrsi','mfi','averagegain','averageloss','highest','lowest','sum','FixedSizeLinkedList','sd','bullish','bearish','abandonedbaby','doji','bearishengulfingpattern','bullishengulfingpattern','darkcloudcover','downsidetasukigap','dragonflydoji','gravestonedoji','bullishharami','bearishharami','bullishharamicross','bearishharamicross','eveningdojistar','eveningstar','morningdojistar','morningstar','bullishmarubozu','bearishmarubozu','piercingline','bullishspinningtop','bearishspinningtop','threeblackcrows','threewhitesoldiers','bullishhammerstick','bearishhammerstick','bullishinvertedhammerstick','bearishinvertedhammerstick','hammerpattern','hammerpatternunconfirmed','hangingman','hangingmanunconfirmed','shootingstar','shootingstarunconfirmed','tweezertop','tweezerbottom','predictPattern','hasDoubleBottom','hasDoubleTop','hasHeadAndShoulder','hasInverseHeadAndShoulder','isTrendingUp','isTrendingDown','ichimokucloud','keltnerchannels','chandelierexit']}var re=Math.min,te=Math.max,oe=Math.abs,ae=Math.sqrt;class le{constructor(e,r,t){this.next=t,t&&(t.prev=this),this.prev=r,r&&(r.next=this),this.data=e}}class ne{constructor(){this._length=0}get head(){return this._head&&this._head.data}get tail(){return this._tail&&this._tail.data}get current(){return this._current&&this._current.data}get length(){return this._length}push(e){this._tail=new le(e,this._tail),0===this._length&&(this._head=this._tail,this._current=this._head,this._next=this._head),this._length++}pop(){var e=this._tail;if(0!==this._length)return(this._length--,0===this._length)?(this._head=this._tail=this._current=this._next=void 0,e.data):(this._tail=e.prev,this._tail.next=void 0,this._current===e&&(this._current=this._tail,this._next=void 0),e.data)}shift(){var e=this._head;if(0!==this._length)return(this._length--,0===this._length)?(this._head=this._tail=this._current=this._next=void 0,e.data):(this._head=this._head.next,this._current===e&&(this._current=this._head,this._next=this._current.next),e.data)}unshift(e){this._head=new le(e,void 0,this._head),0===this._length&&(this._tail=this._head,this._next=this._head),this._length++}unshiftCurrent(){var e=this._current;return e===this._head||2>this._length?e&&e.data:(e===this._tail?(this._tail=e.prev,this._tail.next=void 0,this._current=this._tail):(e.next.prev=e.prev,e.prev.next=e.next,this._current=e.prev),this._next=this._current.next,e.next=this._head,e.prev=void 0,this._head.prev=e,this._head=e,e.data)}removeCurrent(){var e=this._current;if(0!==this._length)return(this._length--,0===this._length)?(this._head=this._tail=this._current=this._next=void 0,e.data):(e===this._tail?(this._tail=e.prev,this._tail.next=void 0,this._current=this._tail):e===this._head?(this._head=e.next,this._head.prev=void 0,this._current=this._head):(e.next.prev=e.prev,e.prev.next=e.next,this._current=e.prev),this._next=this._current.next,e.data)}resetCursor(){return this._current=this._next=this._head,this}next(){var e=this._next;if(void 0!==e)return this._next=e.next,this._current=e,e.data}}class se extends ne{constructor(e,r,t,o){if(super(),this.size=e,this.maintainHigh=r,this.maintainLow=t,this.maintainSum=o,this.totalPushed=0,this.periodHigh=0,this.periodLow=Infinity,this.periodSum=0,!e||'number'!=typeof e)throw'Size required and should be a number.';this._push=this.push,this.push=function(e){this.add(e),this.totalPushed++}}add(e){this.length===this.size?(this.lastShift=this.shift(),this._push(e),this.maintainHigh&&this.lastShift==this.periodHigh&&this.calculatePeriodHigh(),this.maintainLow&&this.lastShift==this.periodLow&&this.calculatePeriodLow(),this.maintainSum&&(this.periodSum-=this.lastShift)):this._push(e),this.maintainHigh&&this.periodHigh<=e&&(this.periodHigh=e),this.maintainLow&&this.periodLow>=e&&(this.periodLow=e),this.maintainSum&&(this.periodSum+=e)}*iterator(){for(this.resetCursor();this.next();)yield this.current}calculatePeriodHigh(){for(this.resetCursor(),this.next()&&(this.periodHigh=this.current);this.next();)this.periodHigh<=this.current&&(this.periodHigh=this.current)}calculatePeriodLow(){for(this.resetCursor(),this.next()&&(this.periodLow=this.current);this.next();)this.periodLow>=this.current&&(this.periodLow=this.current)}}class ue{constructor(){this.open=[],this.high=[],this.low=[],this.close=[],this.volume=[],this.timestamp=[]}}let ie={};class he{}class pe{constructor(e){this.format=e.format||t}static reverseInputs(e){e.reversedInput&&(e.values?e.values.reverse():void 0,e.open?e.open.reverse():void 0,e.high?e.high.reverse():void 0,e.low?e.low.reverse():void 0,e.close?e.close.reverse():void 0,e.volume?e.volume.reverse():void 0,e.timestamp?e.timestamp.reverse():void 0)}getResult(){return this.result}}class de extends pe{constructor(e){super(e),this.period=e.period,this.price=e.values;this.generator=function*(e){var r,t=new ne,o=0,a=1,l=yield;for(t.push(0);;)a<e?(a++,t.push(l),o+=l):(o=o-t.shift()+l,r=o/e,t.push(l)),l=yield r}(this.period),this.generator.next(),this.result=[],this.price.forEach((e)=>{var r=this.generator.next(e);r.value!==void 0&&this.result.push(this.format(r.value))})}nextValue(e){var r=this.generator.next(e).value;if(r!=void 0)return this.format(r)}}de.calculate=o;class ge extends pe{constructor(e){super(e);var r,t=e.period,o=e.values;this.result=[],r=new de({period:t,values:[]});this.generator=function*(){for(var e,o=yield;;)void 0!=e&&void 0!==o?(e=(o-e)*(2/(t+1))+e,o=yield e):(o=yield,e=r.nextValue(o),e&&(o=yield e))}(),this.generator.next(),this.generator.next(),o.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(this.format(r.value))})}nextValue(e){var r=this.generator.next(e).value;if(r!=void 0)return this.format(r)}}ge.calculate=a;class ve extends pe{constructor(e){super(e);var r=e.period,t=e.values;this.result=[],this.generator=function*(){for(let t=new ne;;)if(t.length<r)t.push((yield));else{t.resetCursor();let o=0;for(let e=1;e<=r;e++)o+=t.next()*e/(r*(r+1)/2);var e=yield o;t.shift(),t.push(e)}}(),this.generator.next(),t.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(this.format(r.value))})}nextValue(e){var r=this.generator.next(e).value;if(r!=void 0)return this.format(r)}}ve.calculate=l;class ce extends pe{constructor(e){super(e);var r,t=e.period,o=e.values;this.result=[],r=new de({period:t,values:[]});this.generator=function*(){for(var e,o=yield;;)void 0!=e&&void 0!==o?(e=(o-e)*(1/t)+e,o=yield e):(o=yield,e=r.nextValue(o),void 0!==e&&(o=yield e))}(),this.generator.next(),this.generator.next(),o.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(this.format(r.value))})}nextValue(e){var r=this.generator.next(e).value;if(r!=void 0)return this.format(r)}}ce.calculate=n;class me extends pe{constructor(e){super(e);var r=e.SimpleMAOscillator?de:ge,t=e.SimpleMASignal?de:ge,o=new r({period:e.fastPeriod,values:[],format:(e)=>e}),a=new r({period:e.slowPeriod,values:[],format:(e)=>e}),l=new t({period:e.signalPeriod,values:[],format:(e)=>e}),n=this.format;this.result=[],this.generator=function*(){for(var r,t,s,u,i,h,p=0;;){if(p<e.slowPeriod){r=yield,i=o.nextValue(r),h=a.nextValue(r),p++;continue}i&&h&&(t=i-h,s=l.nextValue(t)),u=t-s,r=yield{MACD:n(t),signal:s?n(s):void 0,histogram:isNaN(u)?void 0:n(u)},i=o.nextValue(r),h=a.nextValue(r)}}(),this.generator.next(),e.values.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(r.value)})}nextValue(e){var r=this.generator.next(e).value;return r}}me.calculate=s;class xe extends pe{constructor(e){super(e);let r=e.values,t=e.period,o=this.format;this.generator=function*(e){var r,t,a=yield,l=1,n=0,s=a;for(a=yield;;)t=a-s,t=0<t?t:0,0<t&&(n+=t),l<e?l++:void 0==r?r=n/e:r=(r*(e-1)+t)/e,s=a,r=void 0===r?void 0:o(r),a=yield r}(t),this.generator.next(),this.result=[],r.forEach((e)=>{var r=this.generator.next(e);r.value!==void 0&&this.result.push(r.value)})}nextValue(e){return this.generator.next(e).value}}xe.calculate=u;class we extends pe{constructor(e){super(e);let r=e.values,t=e.period,o=this.format;this.generator=function*(e){var r,t,a=yield,l=1,n=0,s=a;for(a=yield;;)t=s-a,t=0<t?t:0,0<t&&(n+=t),l<e?l++:void 0==r?r=n/e:r=(r*(e-1)+t)/e,s=a,r=void 0===r?void 0:o(r),a=yield r}(t),this.generator.next(),this.result=[],r.forEach((e)=>{var r=this.generator.next(e);r.value!==void 0&&this.result.push(r.value)})}nextValue(e){return this.generator.next(e).value}}we.calculate=i;class fe extends pe{constructor(e){super(e);var r=e.period,t=e.values,o=new xe({period:r,values:[]}),a=new we({period:r,values:[]});let l=1;this.generator=function*(){for(var e,r,t,n,s=yield;;)e=o.nextValue(s),r=a.nextValue(s),void 0!==e&&void 0!==r&&(0===r?n=100:0===e?n=0:(t=e/r,t=isNaN(t)?0:t,n=parseFloat((100-100/(1+t)).toFixed(2)))),l++,s=yield n}(r),this.generator.next(),this.result=[],t.forEach((e)=>{var r=this.generator.next(e);r.value!==void 0&&this.result.push(r.value)})}nextValue(e){return this.generator.next(e).value}}fe.calculate=h;class Ie extends pe{constructor(e){super(e);var r=e.period,t=e.values,o=new de({period:r,values:[],format:(e)=>e});this.result=[],this.generator=function*(){var e,t,a=new se(r);e=yield;for(var l;;){if(a.push(e),t=o.nextValue(e),t){let e=0;for(let r of a.iterator())e+=Math.pow(r-t,2);l=ae(e/r)}e=yield l}}(),this.generator.next(),t.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(this.format(r.value))})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return this.format(r.value)}}Ie.calculate=p;class Pe extends pe{constructor(e){super(e);var r,t,o=e.period,a=e.values,l=e.stdDev,n=this.format;this.result=[],r=new de({period:o,values:[],format:(e)=>e}),t=new Ie({period:o,values:[],format:(e)=>e}),this.generator=function*(){var e,o,a,s;for(o=yield;;){if(a=r.nextValue(o),s=t.nextValue(o),a){let r=n(a),t=n(a+s*l),u=n(a-s*l),i=n((o-u)/(t-u));e={middle:r,upper:t,lower:u,pb:i}}o=yield e}}(),this.generator.next(),a.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(r.value)})}nextValue(e){return this.generator.next(e).value}}Pe.calculate=d;class _e extends pe{constructor(e){super(e),this.period=e.period,this.price=e.values;this.generator=function*(e){for(var r=new ne,t=0,o=1,a=yield,l=0;;)o<e?(o++,t+=a,l=void 0):o==e?(o++,t+=a,l=t):l=l-l/e+a,a=yield l}(this.period),this.generator.next(),this.result=[],this.price.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(this.format(r.value))})}nextValue(e){var r=this.generator.next(e).value;if(r!=void 0)return this.format(r)}}_e.calculate=function(e){pe.reverseInputs(e);var r=new _e(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r};class be extends pe{constructor(e){super(e);var r=e.low,t=e.high,o=this.format;if(r.length!=t.length)throw'Inputs(low,high) not of equal size';this.result=[],this.generator=function*(){for(var e,r,t=yield;;){if(r){let a=t.high-r.high,l=r.low-t.low;e=o(l>a&&0<l?l:0)}r=t,t=yield e}}(),this.generator.next(),r.forEach((e,o)=>{var a=this.generator.next({high:t[o],low:r[o]});a.value!==void 0&&this.result.push(a.value)})}static calculate(e){pe.reverseInputs(e);var r=new be(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}nextValue(e){return this.generator.next(e).value}}class Ce extends pe{constructor(e){super(e);var r=e.low,t=e.high,o=this.format;if(r.length!=t.length)throw'Inputs(low,high) not of equal size';this.result=[],this.generator=function*(){for(var e,r,t=yield;;){if(r){let a=t.high-r.high,l=r.low-t.low;e=o(a>l&&0<a?a:0)}r=t,t=yield e}}(),this.generator.next(),r.forEach((e,o)=>{var a=this.generator.next({high:t[o],low:r[o]});a.value!==void 0&&this.result.push(a.value)})}static calculate(e){pe.reverseInputs(e);var r=new Ce(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}nextValue(e){return this.generator.next(e).value}}class Se extends pe{constructor(e){super(e);var r=e.low,t=e.high,o=e.close,a=this.format;if(r.length!=t.length)throw'Inputs(low,high) not of equal size';this.result=[],this.generator=function*(){for(var e,r,t=yield;;)void 0==e&&(e=t.close,t=yield r),r=te(t.high-t.low,isNaN(oe(t.high-e))?0:oe(t.high-e),isNaN(oe(t.low-e))?0:oe(t.low-e)),e=t.close,void 0!=r&&(r=a(r)),t=yield r}(),this.generator.next(),r.forEach((e,a)=>{var l=this.generator.next({high:t[a],low:r[a],close:o[a]});l.value!=void 0&&this.result.push(l.value)})}nextValue(e){return this.generator.next(e).value}}Se.calculate=g;class qe extends he{}class Ee extends pe{constructor(e){super(e);var r=e.low,t=e.high,o=e.close,a=e.period,l=this.format,n=new Ce({high:[],low:[]}),s=new be({high:[],low:[]}),u=new _e({period:a,values:[],format:(e)=>e}),i=new _e({period:a,values:[],format:(e)=>e}),h=new _e({period:a,values:[],format:(e)=>e}),p=new ce({period:a,values:[],format:(e)=>e}),d=new Se({low:[],high:[],close:[]});if(r.length!==t.length||t.length!==o.length)throw'Inputs(low,high, close) not of equal size';this.result=[],qe,this.generator=function*(){var e,r,t,o,a,l,g,v=yield;for(e=0,r=0,t=0;;){let e=d.nextValue(v),r=n.nextValue(v),t=s.nextValue(v);if(e===void 0){v=yield;continue}let c=h.nextValue(e),m=u.nextValue(r),x=i.nextValue(t);if(c!=void 0&&m!=void 0&&x!=void 0){o=100*m/c,a=100*x/c;let e=oe(o-a),r=o+a;l=100*(e/r),g=p.nextValue(l)}v=yield{adx:g,pdi:o,mdi:a}}}(),this.generator.next(),r.forEach((e,a)=>{var n=this.generator.next({high:t[a],low:r[a],close:o[a]});n.value!=void 0&&n.value.adx!=void 0&&this.result.push({adx:l(n.value.adx),pdi:l(n.value.pdi),mdi:l(n.value.mdi)})})}nextValue(e){let r=this.generator.next(e).value;if(r!=void 0&&r.adx!=void 0)return{adx:this.format(r.adx),pdi:this.format(r.pdi),mdi:this.format(r.mdi)}}}Ee.calculate=v;class He extends pe{constructor(e){super(e);var r=e.low,t=e.high,o=e.close,a=e.period,l=this.format;if(r.length!==t.length||t.length!==o.length)throw'Inputs(low,high, close) not of equal size';var n=new Se({low:[],high:[],close:[]}),s=new ce({period:a,values:[],format:(e)=>e});this.result=[],this.generator=function*(){for(var e,r,t=yield;;)r=n.nextValue({low:t.low,high:t.high,close:t.close}),e=void 0===r?void 0:s.nextValue(r),t=yield e}(),this.generator.next(),r.forEach((e,a)=>{var n=this.generator.next({high:t[a],low:r[a],close:o[a]});n.value!==void 0&&this.result.push(l(n.value))})}nextValue(e){return this.generator.next(e).value}}He.calculate=c;class Ve extends pe{constructor(e){super(e);var r=e.period,t=e.values;this.result=[],this.generator=function*(){let e=1;for(var t,o=new se(r),a=yield;;)o.push(a),e<r?e++:t=100*((a-o.lastShift)/o.lastShift),a=yield t}(),this.generator.next(),t.forEach((e)=>{var r=this.generator.next(e);r.value==void 0||isNaN(r.value)||this.result.push(this.format(r.value))})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0&&!isNaN(r.value))return this.format(r.value)}}Ve.calculate=m;class ke extends pe{constructor(e){super(e);let r=e.values,t=e.ROCPer1,o=e.ROCPer2,a=e.ROCPer3,l=e.ROCPer4,n=e.SMAROCPer1,s=e.SMAROCPer2,u=e.SMAROCPer3,i=e.SMAROCPer4,h=e.signalPeriod,p=new Ve({period:t,values:[]}),d=new Ve({period:o,values:[]}),g=new Ve({period:a,values:[]}),v=new Ve({period:l,values:[]}),c=new de({period:n,values:[],format:(e)=>e}),m=new de({period:s,values:[],format:(e)=>e}),x=new de({period:u,values:[],format:(e)=>e}),w=new de({period:i,values:[],format:(e)=>e}),f=new de({period:h,values:[],format:(e)=>e});var I=this.format;this.result=[];let P=te(t+n,o+s,a+u,l+i);this.generator=function*(){for(let e,r,t,o,a,l,n,s=1,u=yield;;){let i=p.nextValue(u),h=d.nextValue(u),_=g.nextValue(u),b=v.nextValue(u);r=i===void 0?void 0:c.nextValue(i),t=h===void 0?void 0:m.nextValue(h),o=_===void 0?void 0:x.nextValue(_),a=b===void 0?void 0:w.nextValue(b),s<P?s++:e=1*r+2*t+3*o+4*a,l=e===void 0?void 0:f.nextValue(e),n=e===void 0?void 0:{kst:I(e),signal:l?I(l):void 0},u=yield n}}(),this.generator.next(),r.forEach((e)=>{let r=this.generator.next(e);r.value!=void 0&&this.result.push(r.value)})}nextValue(e){let r=this.generator.next(e);if(r.value!=void 0)return r.value}}ke.calculate=x;class Te extends pe{constructor(e){super(e);let r=e.high||[],t=e.low||[];this.result=[],this.generator=function*(e,r){for(let t,o,a,l,n=!0,s=e,u=yield;;)t?(a+=s*(o-a),n?(a=re(a,l.low,u.low),t.high>o&&(o=t.high,s=re(s+e,r))):(a=te(a,l.high,u.high),t.low<o&&(o=t.low,s=re(s+e,r))),(n&&t.low<a||!n&&t.high>a)&&(s=e,a=o,n=!n,o=n?t.high:t.low)):(a=u.low,o=u.high),l=u,t&&(u=t),t=yield a}(e.step,e.max),this.generator.next(),t.forEach((e,o)=>{var a=this.generator.next({high:r[o],low:t[o]});a.value!==void 0&&this.result.push(a.value)})}nextValue(e){let r=this.generator.next(e);if(r.value!==void 0)return r.value}}Te.calculate=w;class Ae extends pe{constructor(e){super(e);let r=e.low,t=e.high,o=e.close,a=e.period,l=e.signalPeriod,n=this.format;if(r.length!==t.length||t.length!==o.length)throw'Inputs(low,high, close) not of equal size';this.result=[],this.generator=function*(){let e,r,t=1,o=new se(a,!0,!1),s=new se(a,!1,!0),u=new de({period:l,values:[],format:(e)=>e});for(var i=yield;;){if(o.push(i.high),s.push(i.low),t<a){t++,i=yield;continue}let l=s.periodLow;e=100*((i.close-l)/(o.periodHigh-l)),e=isNaN(e)?0:e,r=u.nextValue(e),i=yield{k:n(e),d:void 0===r?void 0:n(r)}}}(),this.generator.next(),r.forEach((e,a)=>{var l=this.generator.next({high:t[a],low:r[a],close:o[a]});l.value!==void 0&&this.result.push(l.value)})}nextValue(e){let r=this.generator.next(e);if(r.value!==void 0)return r.value}}Ae.calculate=f;class De extends pe{constructor(e){super(e);let r=e.low,t=e.high,o=e.close,a=e.period,l=this.format;if(r.length!==t.length||t.length!==o.length)throw'Inputs(low,high, close) not of equal size';this.result=[],this.generator=function*(){let e,r,t=1,o=new se(a,!0,!1),n=new se(a,!1,!0);var s=yield;for(let u;;){if(o.push(s.high),n.push(s.low),t<a){t++,s=yield;continue}e=n.periodLow,r=o.periodHigh,u=l(-100*((r-s.close)/(r-e))),s=yield u}}(),this.generator.next(),r.forEach((e,a)=>{var l=this.generator.next({high:t[a],low:r[a],close:o[a]});l.value!==void 0&&this.result.push(l.value)})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return this.format(r.value)}}De.calculate=I;class Be extends pe{constructor(e){super(e);var r=e.high,t=e.low,o=e.close,a=e.volume;if(t.length!==r.length||r.length!==o.length||r.length!==a.length)throw'Inputs(low,high, close, volumes) not of equal size';this.result=[],this.generator=function*(){var e,r=0;for(e=yield;;){let t=(e.close-e.low-(e.high-e.close))/(e.high-e.low);t=isNaN(t)?1:t;let o=t*e.volume;r+=o,e=yield Math.round(r)}}(),this.generator.next(),r.forEach((e,r)=>{var l={high:e,low:t[r],close:o[r],volume:a[r]},n=this.generator.next(l);n.value!=void 0&&this.result.push(n.value)})}nextValue(e){return this.generator.next(e).value}}Be.calculate=P;class Le extends pe{constructor(e){super(e);var r=e.close,t=e.volume;this.result=[],this.generator=function*(){var e,r,t=0;for(e=yield,e.close&&'number'==typeof e.close&&(r=e.close,e=yield);;)r<e.close?t+=e.volume:e.close<r&&(t-=e.volume),r=e.close,e=yield t}(),this.generator.next(),r.forEach((e,o)=>{let a={close:r[o],volume:t[o]},l=this.generator.next(a);l.value!=void 0&&this.result.push(l.value)})}nextValue(e){return this.generator.next(e).value}}Le.calculate=_;class ze extends pe{constructor(e){super(e);let r=e.values,t=e.period,o=this.format,a=new ge({period:t,values:[],format:(e)=>e}),l=new ge({period:t,values:[],format:(e)=>e}),n=new ge({period:t,values:[],format:(e)=>e}),s=new Ve({period:1,values:[],format:(e)=>e});this.result=[],this.generator=function*(){for(let e=yield;;){let r=a.nextValue(e),t=r?l.nextValue(r):void 0,u=t?n.nextValue(t):void 0,i=u?s.nextValue(u):void 0;e=yield i?o(i):void 0}}(),this.generator.next(),r.forEach((e)=>{let r=this.generator.next(e);r.value!==void 0&&this.result.push(r.value)})}nextValue(e){let r=this.generator.next(e);if(r.value!==void 0)return r.value}}ze.calculate=b;class Me extends pe{constructor(e){super(e);var r=e.close,t=e.volume,o=e.period||1;if(t.length!==r.length)throw'Inputs(volume, close) not of equal size';let a=new ge({values:[],period:o});this.result=[],this.generator=function*(){var e=yield,r=yield;for(let t;;)t=(r.close-e.close)*r.volume,e=r,r=yield a.nextValue(t)}(),this.generator.next(),t.forEach((e,o)=>{var a=this.generator.next({close:r[o],volume:t[o]});a.value!=void 0&&this.result.push(a.value)})}nextValue(e){let r=this.generator.next(e).value;if(r!=void 0)return r}}Me.calculate=C;class je extends pe{constructor(e){super(e);var r=e.low,t=e.high,o=e.close,a=e.period,l=this.format;var n=new se(a),s=new de({period:a,values:[],format:(e)=>e});if(r.length!==t.length||t.length!==o.length)throw'Inputs(low,high, close) not of equal size';this.result=[],this.generator=function*(){for(var e=yield;;){let r=(e.high+e.low+e.close)/3;n.push(r);let t,o=s.nextValue(r),a=null,l=0;if(o!=void 0){for(let e of n.iterator())l+=oe(e-o);a=l/20,t=(r-o)/(.015*a)}e=yield t}}(),this.generator.next(),r.forEach((e,a)=>{var l=this.generator.next({high:t[a],low:r[a],close:o[a]});l.value!=void 0&&this.result.push(l.value)})}nextValue(e){let r=this.generator.next(e).value;if(r!=void 0)return r}}je.calculate=S;class Re extends pe{constructor(e){super(e);var r=e.high,t=e.low,o=e.fastPeriod,a=e.slowPeriod,l=new de({values:[],period:a}),n=new de({values:[],period:o});this.result=[],this.generator=function*(){var e,r,t,o,a;for(r=yield;;)t=(r.high+r.low)/2,o=l.nextValue(t),a=n.nextValue(t),void 0!==o&&void 0!==a&&(e=a-o),r=yield e}(),this.generator.next(),r.forEach((e,r)=>{var o={high:e,low:t[r]},a=this.generator.next(o);a.value!=void 0&&this.result.push(this.format(a.value))})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return this.format(r.value)}}Re.calculate=q;class ye extends pe{constructor(e){super(e);var r=e.low,t=e.high,o=e.close,a=e.volume,l=this.format;if(r.length!==t.length||t.length!==o.length)throw'Inputs(low,high, close) not of equal size';this.result=[],this.generator=function*(){var e=yield;for(let r=0,t=0;;){let o=(e.high+e.low+e.close)/3,a=e.volume*o;r+=a,t+=e.volume,e=yield r/t}}(),this.generator.next(),r.forEach((e,l)=>{var n=this.generator.next({high:t[l],low:r[l],close:o[l],volume:a[l]});n.value!=void 0&&this.result.push(n.value)})}nextValue(e){let r=this.generator.next(e).value;if(r!=void 0)return r}}ye.calculate=E;class Oe extends pe{constructor(e){super(e);var r=e.high,t=e.low,o=e.close,a=e.open,l=e.volume,n=e.noOfBars;if(t.length!==r.length||r.length!==o.length||r.length!==l.length)throw'Inputs(low,high, close, volumes) not of equal size';this.result=[];var s=te(...r,...t,...o,...a),u=re(...r,...t,...o,...a),i=u;for(let h=0;h<n;h++){let e=i,h=e+(s-u)/n;i=h;let p=0,d=0,g=0;for(let n=0;n<r.length;n++){let s=t[n],u=r[n],i=a[n],v=o[n],c=l[n];H(e,h,s,u)&&(g+=c,i>v?d+=c:p+=c)}this.result.push({rangeStart:e,rangeEnd:h,bullishVolume:p,bearishVolume:d,totalVolume:g})}}nextValue(){throw'Next value not supported for volume profile'}}Oe.calculate=V;class Fe extends pe{constructor(e){super(e),this.result=[],this.generator=function*(){for(let e=yield;;)e=yield(e.high+e.low+e.close)/3}(),this.generator.next(),e.low.forEach((r,t)=>{var o=this.generator.next({high:e.high[t],low:e.low[t],close:e.close[t]});this.result.push(o.value)})}nextValue(e){var r=this.generator.next(e).value;return r}}Fe.calculate=function(e){pe.reverseInputs(e);var r=new Fe(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r};class Ue extends pe{constructor(e){super(e);var r=e.high,t=e.low,o=e.close,a=e.volume,l=e.period,n=new Fe({low:[],high:[],close:[]}),s=new se(l,!1,!1,!0),u=new se(l,!1,!1,!0);if(t.length!==r.length||r.length!==o.length||r.length!==a.length)throw'Inputs(low,high, close, volumes) not of equal size';this.result=[],this.generator=function*(){var e,r,t,o,a,i,h=0;let p=null,d=null;for(r=yield,t=r.close,r=yield;;){var{high:g,low:v,close:c,volume:m}=r,x=0,w=0;p=n.nextValue({high:g,low:v,close:c}),h=p*m,null!=p&&null!=d&&(p>d?x=h:w=h,s.push(x),u.push(w),o=s.periodSum,i=u.periodSum,s.totalPushed>=l&&s.totalPushed>=l&&(a=o/i,e=100-100/(1+a))),d=p,r=yield e}}(),this.generator.next(),r.forEach((e,r)=>{var l={high:e,low:t[r],close:o[r],volume:a[r]},n=this.generator.next(l);n.value!=void 0&&this.result.push(parseFloat(n.value.toFixed(2)))})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return parseFloat(r.value.toFixed(2))}}Ue.calculate=k;class We extends pe{constructor(e){super(e);let r=e.values,t=e.rsiPeriod,o=e.stochasticPeriod,a=e.kPeriod,l=e.dPeriod,n=this.format;this.result=[],this.generator=function*(){let e,r,n,s,u=new fe({period:t,values:[]}),i=new Ae({period:o,high:[],low:[],close:[],signalPeriod:a}),h=new de({period:l,values:[],format:(e)=>e});for(var p=yield;;){if(e=u.nextValue(p),void 0!==e){var g={high:e,low:e,close:e};r=i.nextValue(g),void 0!==r&&void 0!==r.d&&(n=h.nextValue(r.d),void 0!==n&&(s={stochRSI:r.k,k:r.d,d:n}))}p=yield s}}(),this.generator.next(),r.forEach((e)=>{var r=this.generator.next(e);r.value!==void 0&&this.result.push(r.value)})}nextValue(e){let r=this.generator.next(e);if(r.value!==void 0)return r.value}}We.calculate=T;class Ke extends pe{constructor(e){super(e);var r=e.values,t=e.period;this.result=[];var o=new se(t,!0,!1,!1);this.generator=function*(){var e,r;for(e=yield;;)o.push(e),o.totalPushed>=t&&(r=o.periodHigh),e=yield r}(),this.generator.next(),r.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(r.value)})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return r.value}}Ke.calculate=A;class Ge extends pe{constructor(e){super(e);var r=e.values,t=e.period;this.result=[];var o=new se(t,!1,!0,!1);this.generator=function*(){var e,r;for(e=yield;;)o.push(e),o.totalPushed>=t&&(r=o.periodLow),e=yield r}(),this.generator.next(),r.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(r.value)})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return r.value}}Ge.calculate=D;class Ne extends pe{constructor(e){super(e);var r=e.values,t=e.period;this.result=[];var o=new se(t,!1,!1,!0);this.generator=function*(){var e,r;for(e=yield;;)o.push(e),o.totalPushed>=t&&(r=o.periodSum),e=yield r}(),this.generator.next(),r.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(r.value)})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return r.value}}Ne.calculate=B;class Xe extends pe{constructor(e){super(e);this.format;let r=e.useATR,t=e.brickSize||0;if(r){let r=c(Object.assign({},e));t=r[r.length-1]}if(this.result=new ue,0===t)return void console.error('Not enough data to calculate brickSize for renko when using ATR');let o=0,a=0,l=Infinity,n=0,s=0,u=0;this.generator=function*(){for(let e=yield;;){if(0==o){o=e.close,a=e.high,l=e.low,n=e.close,s=e.volume,u=e.timestamp,e=yield;continue}let r=oe(e.close-n),i=oe(e.close-o);if(r>=t&&i>=t){let u=r>i?o:n,h={open:u,high:a>e.high?a:e.high,low:l<e.Low?l:e.low,close:u>e.close?u-t:u+t,volume:s+e.volume,timestamp:e.timestamp};o=h.open,a=h.close,l=h.close,n=h.close,s=0,e=yield h}else a=a>e.high?a:e.high,l=l<e.Low?l:e.low,s+=e.volume,u=e.timestamp,e=yield}}(),this.generator.next(),e.low.forEach((r,t)=>{var o=this.generator.next({open:e.open[t],high:e.high[t],low:e.low[t],close:e.close[t],volume:e.volume[t],timestamp:e.timestamp[t]});o.value&&(this.result.open.push(o.value.open),this.result.high.push(o.value.high),this.result.low.push(o.value.low),this.result.close.push(o.value.close),this.result.volume.push(o.value.volume),this.result.timestamp.push(o.value.timestamp))})}nextValue(){return console.error('Cannot calculate next value on Renko, Every value has to be recomputed for every change, use calcualte method'),null}}Xe.calculate=L;class Qe extends pe{constructor(e){super(e);this.format;this.result=new ue;let r=null,t=0,o=Infinity,a=0,l=0,n=0;this.generator=function*(){for(let e=yield,s=null;;){if(null==r)r=(e.close+e.open)/2,t=e.high,o=e.low,a=(e.close+e.open+e.high+e.low)/4,l=e.volume||0,n=e.timestamp||0,s={open:r,high:t,low:o,close:a,volume:e.volume||0,timestamp:e.timestamp||0};else{let l=(e.close+e.open+e.high+e.low)/4,n=(r+a)/2,u=te(n,l,e.high),i=re(e.low,n,l);s={close:l,open:n,high:u,low:i,volume:e.volume||0,timestamp:e.timestamp||0},a=l,r=n,t=u,o=i}e=yield s}}(),this.generator.next(),e.low.forEach((r,t)=>{var o=this.generator.next({open:e.open[t],high:e.high[t],low:e.low[t],close:e.close[t],volume:e.volume?e.volume[t]:e.volume,timestamp:e.timestamp?e.timestamp[t]:e.timestamp});o.value&&(this.result.open.push(o.value.open),this.result.high.push(o.value.high),this.result.low.push(o.value.low),this.result.close.push(o.value.close),this.result.volume.push(o.value.volume),this.result.timestamp.push(o.value.timestamp))})}nextValue(e){var r=this.generator.next(e).value;return r}}Qe.calculate=z;class Ye{constructor(){}approximateEqual(e,r){let t=1*parseFloat(oe(e-r).toPrecision(4)),o=1*parseFloat((1e-3*e).toPrecision(4));return t<=o}logic(){throw'this has to be implemented'}getAllPatternIndex(e){if(e.close.length<this.requiredCount)return console.warn('Data count less than data required for the strategy ',this.name),[];e.reversedInput&&(e.open.reverse(),e.high.reverse(),e.low.reverse(),e.close.reverse());let r=this.logic;return this._generateDataForCandleStick(e).map((e,t)=>r.call(this,e)?t:void 0).filter((e)=>e)}hasPattern(e){if(e.close.length<this.requiredCount)return console.warn('Data count less than data required for the strategy ',this.name),!1;e.reversedInput&&(e.open.reverse(),e.high.reverse(),e.low.reverse(),e.close.reverse());let r=this.logic;return r.call(this,this._getLastDataForCandleStick(e))}_getLastDataForCandleStick(e){let r=this.requiredCount;if(e.close.length===r)return e;else{let t={open:[],high:[],low:[],close:[]},o=0,a=e.close.length-r;for(;o<r;)t.open.push(e.open[a+o]),t.high.push(e.high[a+o]),t.low.push(e.low[a+o]),t.close.push(e.close[a+o]),o++;return t}}_generateDataForCandleStick(e){let r=this.requiredCount,t=e.close.map(function(t,o){let a=0,l={open:[],high:[],low:[],close:[]};for(;a<r;)l.open.push(e.open[o+a]),l.high.push(e.high[o+a]),l.low.push(e.low[o+a]),l.close.push(e.close[o+a]),a++;return l}).filter((t,o)=>o<=e.close.length-r);return t}}class Ze extends Ye{constructor(){super(),this.name='MorningStar',this.requiredCount=3}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2];return t<r&&a>u&&a>s&&s<a&&u<a&&i>s&&n<i&&i<h&&h>(r+t)/2}}class $e extends Ye{constructor(){super(),this.name='BullishEngulfingPattern',this.requiredCount=2}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1];return t<r&&r>l&&t>l&&r<n}}class Je extends Ye{constructor(){super(),this.requiredCount=2,this.name='BullishHarami'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1];return r>l&&t<l&&t<n&&r>u&&o>s}}class er extends Ye{constructor(){super(),this.requiredCount=2,this.name='BullishHaramiCross'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=this.approximateEqual(l,n);return r>l&&t<l&&t<n&&r>u&&o>s&&i}}class rr extends Ye{constructor(){super(),this.name='Doji',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=this.approximateEqual(r,t),n=l&&this.approximateEqual(r,o),s=l&&this.approximateEqual(t,a);return l&&n==s}}class tr extends Ye{constructor(){super(),this.name='MorningDojiStar',this.requiredCount=3}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2],g=new rr().hasPattern({open:[l],close:[n],high:[s],low:[u]});return t<r&&g&&i<h&&s<a&&u<a&&i>s&&n<i&&h>(r+t)/2}}class or extends Ye{constructor(){super(),this.requiredCount=3,this.name='DownsideTasukiGap'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2];return t<r&&n<l&&h>i&&s<a&&l>i&&n<i&&h>l&&h<t}}class ar extends Ye{constructor(){super(),this.name='BullishMarubozu',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=this.approximateEqual(t,o)&&this.approximateEqual(a,r)&&r<t&&r<o;return l}}class lr extends Ye{constructor(){super(),this.requiredCount=2,this.name='PiercingLine'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1];return u<a&&t<r&&a>l&&n>(r+t)/2&&n>l}}class nr extends Ye{constructor(){super(),this.name='ThreeWhiteSoldiers',this.requiredCount=3}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2];return s>o&&p>s&&r<t&&l<n&&i<h&&t>l&&l<o&&s>i&&i<n}}class sr extends Ye{constructor(){super(),this.name='BullishHammerStick',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=t>r;return l=l&&this.approximateEqual(t,o),l=l&&t-r<=2*(r-a),l}}class ur extends Ye{constructor(){super(),this.name='BullishInvertedHammerStick',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=t>r;return l=l&&this.approximateEqual(r,a),l=l&&t-r<=2*(o-t),l}}class ir extends Ye{constructor(){super(),this.name='BearishHammerStick',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=r>t;return l=l&&this.approximateEqual(r,o),l=l&&r-t<=2*(t-a),l}}class hr extends Ye{constructor(){super(),this.name='BearishInvertedHammerStick',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=r>t;return l=l&&this.approximateEqual(t,a),l=l&&r-t<=2*(o-r),l}}class pr extends Ye{constructor(){super(),this.name='HammerPattern',this.requiredCount=5}logic(e){let r=this.downwardTrend(e);return r=r&&this.includesHammer(e),r=r&&this.hasConfirmation(e),r}downwardTrend(e,r=!0){let t=r?3:4,o=u({values:e.close.slice(0,t),period:t-1}),a=i({values:e.close.slice(0,t),period:t-1});return a>o}includesHammer(e,r=!0){let t=r?3:4,o=r?4:void 0,a={open:e.open.slice(t,o),close:e.close.slice(t,o),low:e.low.slice(t,o),high:e.high.slice(t,o)},l=R(a);return l=l||y(a),l=l||M(a),l=l||j(a),l}hasConfirmation(e){let r={open:e.open[3],close:e.close[3],low:e.low[3],high:e.high[3]},t={open:e.open[4],close:e.close[4],low:e.low[4],high:e.high[4]},o=t.open<t.close;return o&&r.close<t.close}}class dr extends pr{constructor(){super(),this.name='HammerPatternUnconfirmed'}logic(e){let r=this.downwardTrend(e,!1);return r=r&&this.includesHammer(e,!1),r}}class gr extends Ye{constructor(){super(),this.name='TweezerBottom',this.requiredCount=5}logic(e){return this.downwardTrend(e)&&e.low[3]==e.low[4]}downwardTrend(e){let r=u({values:e.close.slice(0,3),period:2}),t=i({values:e.close.slice(0,3),period:2});return t>r}}let vr=[new $e,new or,new Je,new er,new tr,new Ze,new ar,new lr,new nr,new sr,new ur,new pr,new dr,new gr];class cr extends Ye{constructor(){super(),this.name='Bullish Candlesticks'}hasPattern(e){return vr.reduce(function(r,t){let o=t.hasPattern(e);return r||o},!1)}}class mr extends Ye{constructor(){super(),this.name='BearishEngulfingPattern',this.requiredCount=2}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1];return t>r&&r<l&&t<l&&r>n}}class xr extends Ye{constructor(){super(),this.requiredCount=2,this.name='BearishHarami'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1];return r<l&&t>l&&t>n&&r<u&&o>s}}class wr extends Ye{constructor(){super(),this.requiredCount=2,this.name='BearishHaramiCross'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=this.approximateEqual(l,n);return r<l&&t>l&&t>n&&r<u&&o>s&&i}}class fr extends Ye{constructor(){super(),this.name='EveningDojiStar',this.requiredCount=3}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2],g=new rr().hasPattern({open:[l],close:[n],high:[s],low:[u]});return t>r&&g&&s>o&&u>o&&i<u&&n>i&&i>h&&h<(r+t)/2}}class Ir extends Ye{constructor(){super(),this.name='EveningStar',this.requiredCount=3}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2];return t>r&&o<u&&o<s&&s>o&&u>o&&i<u&&n>i&&i>h&&h<(r+t)/2}}class Pr extends Ye{constructor(){super(),this.name='BearishMarubozu',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=this.approximateEqual(r,o)&&this.approximateEqual(a,t)&&r>t&&r>a;return l}}class _r extends Ye{constructor(){super(),this.name='ThreeBlackCrows',this.requiredCount=3}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2];return a>u&&u>d&&r>t&&l>n&&i>h&&r>l&&l>t&&l>i&&i>n}}class br extends Ye{constructor(){super(),this.name='HangingMan',this.requiredCount=5}logic(e){let r=this.upwardTrend(e);return r=r&&this.includesHammer(e),r=r&&this.hasConfirmation(e),r}upwardTrend(e,r=!0){let t=r?3:4,o=u({values:e.close.slice(0,t),period:t-1}),a=i({values:e.close.slice(0,t),period:t-1});return o>a}includesHammer(e,r=!0){let t=r?3:4,o=r?4:void 0,a={open:e.open.slice(t,o),close:e.close.slice(t,o),low:e.low.slice(t,o),high:e.high.slice(t,o)},l=R(a);return l=l||M(a),l}hasConfirmation(e){let r={open:e.open[3],close:e.close[3],low:e.low[3],high:e.high[3]},t={open:e.open[4],close:e.close[4],low:e.low[4],high:e.high[4]},o=t.open>t.close;return o&&r.close>t.close}}class Cr extends br{constructor(){super(),this.name='HangingManUnconfirmed'}logic(e){let r=this.upwardTrend(e,!1);return r=r&&this.includesHammer(e,!1),r}}class Sr extends Ye{constructor(){super(),this.name='ShootingStar',this.requiredCount=5}logic(e){let r=this.upwardTrend(e);return r=r&&this.includesHammer(e),r=r&&this.hasConfirmation(e),r}upwardTrend(e,r=!0){let t=r?3:4,o=u({values:e.close.slice(0,t),period:t-1}),a=i({values:e.close.slice(0,t),period:t-1});return o>a}includesHammer(e,r=!0){let t=r?3:4,o=r?4:void 0,a={open:e.open.slice(t,o),close:e.close.slice(t,o),low:e.low.slice(t,o),high:e.high.slice(t,o)},l=y(a);return l=l||j(a),l}hasConfirmation(e){let r={open:e.open[3],close:e.close[3],low:e.low[3],high:e.high[3]},t={open:e.open[4],close:e.close[4],low:e.low[4],high:e.high[4]},o=t.open>t.close;return o&&r.close>t.close}}class qr extends Sr{constructor(){super(),this.name='ShootingStarUnconfirmed'}logic(e){let r=this.upwardTrend(e,!1);return r=r&&this.includesHammer(e,!1),r}}class Er extends Ye{constructor(){super(),this.name='TweezerTop',this.requiredCount=5}logic(e){return this.upwardTrend(e)&&e.high[3]==e.high[4]}upwardTrend(e){let r=u({values:e.close.slice(0,3),period:2}),t=i({values:e.close.slice(0,3),period:2});return r>t}}let Hr=[new mr,new xr,new wr,new fr,new Ir,new Pr,new _r,new ir,new hr,new br,new Cr,new Sr,new qr,new Er];class Vr extends Ye{constructor(){super(),this.name='Bearish Candlesticks'}hasPattern(e){return Hr.reduce(function(r,t){return r||t.hasPattern(e)},!1)}}class kr extends Ye{constructor(){super(),this.name='AbandonedBaby',this.requiredCount=3}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2],g=new rr().hasPattern({open:[l],close:[n],high:[s],low:[u]});return t<r&&g&&s<a&&d>s&&h>i&&p<r}}class Tr extends Ye{constructor(){super(),this.name='DarkCloudCover',this.requiredCount=2}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1];return t>r&&n<l&&l>o&&n<(t+r)/2&&n>r}}class Ar extends Ye{constructor(){super(),this.requiredCount=1,this.name='DragonFlyDoji'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=this.approximateEqual(r,t),n=l&&this.approximateEqual(r,o),s=l&&this.approximateEqual(t,a);return l&&n&&!s}}class Dr extends Ye{constructor(){super(),this.requiredCount=1,this.name='GraveStoneDoji'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=this.approximateEqual(r,t),n=l&&this.approximateEqual(r,o),s=l&&this.approximateEqual(t,a);return l&&s&&!n}}class Br extends Ye{constructor(){super(),this.name='BullishSpinningTop',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=oe(t-r),n=oe(o-t),s=oe(r-a);return l<n&&l<s}}class Lr extends Ye{constructor(){super(),this.name='BearishSpinningTop',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=oe(t-r),n=oe(o-r),s=oe(o-a);return l<n&&l<s}}var zr,Mr,jr=function(e,r,t,o){return new(t||(t=Promise))(function(a,l){function n(e){try{u(o.next(e))}catch(r){l(r)}}function s(e){try{u(o['throw'](e))}catch(r){l(r)}}function u(e){e.done?a(e.value):new t(function(r){r(e.value)}).then(n,s)}u((o=o.apply(e,r||[])).next())})},Rr=!1,yr=['IHS','TU','DB','HS','TD','DT'];try{Rr='[object process]'===Object.prototype.toString.call(global.process)}catch(r){}(function(e){e[e.IHS=0]='IHS',e[e.TU=1]='TU',e[e.DB=2]='DB',e[e.HS=3]='HS',e[e.TD=4]='TD',e[e.DT=5]='DT'})(e.AvailablePatterns||(e.AvailablePatterns={}));var Or,Fr=!1,Ur=!1;U();class Wr extends pe{}Wr.predictPattern=W,Wr.hasDoubleBottom=K,Wr.hasDoubleTop=G,Wr.hasHeadAndShoulder=N,Wr.hasInverseHeadAndShoulder=X,Wr.isTrendingUp=Q,Wr.isTrendingDown=Y;class Kr extends pe{constructor(e){super(e),this.result=[];var r=Object.assign({},{conversionPeriod:9,basePeriod:26,spanPeriod:52,displacement:26},e),t=new se(2*r.conversionPeriod,!0,!0,!1),o=new se(2*r.basePeriod,!0,!0,!1),a=new se(2*r.spanPeriod,!0,!0,!1);this.generator=function*(){let e,l,n=te(r.conversionPeriod,r.basePeriod,r.spanPeriod,r.displacement),s=1;for(l=yield;;){if(t.push(l.high),t.push(l.low),o.push(l.high),o.push(l.low),a.push(l.high),a.push(l.low),s<n)s++;else{let r=(t.periodHigh+t.periodLow)/2,l=(o.periodHigh+o.periodLow)/2,n=(a.periodHigh+a.periodLow)/2;e={conversion:r,base:l,spanA:(r+l)/2,spanB:n}}l=yield e}}(),this.generator.next(),e.low.forEach((r,t)=>{var o=this.generator.next({high:e.high[t],low:e.low[t]});o.value&&this.result.push(o.value)})}nextValue(e){return this.generator.next(e).value}}Kr.calculate=Z;class Gr extends pe{constructor(e){super(e);var r,t=e.useSMA?de:ge,o=new t({period:e.maPeriod,values:[],format:(e)=>e}),a=new He({period:e.atrPeriod,high:[],low:[],close:[],format:(e)=>e});this.result=[],this.generator=function*(){var t;for(r=yield;;){var{close:l}=r,n=o.nextValue(l),s=a.nextValue(r);n!=void 0&&s!=void 0&&(t={middle:n,upper:n+e.multiplier*s,lower:n-e.multiplier*s}),r=yield t}}(),this.generator.next();var l=e.high;l.forEach((r,t)=>{var o={high:r,low:e.low[t],close:e.close[t]},a=this.generator.next(o);a.value!=void 0&&this.result.push(a.value)})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return r.value}}Gr.calculate=$;class Nr extends pe{constructor(e){super(e);var r=e.high,t=e.low,o=e.close;this.result=[];var a=new He({period:e.period,high:[],low:[],close:[],format:(e)=>e}),l=new se(2*e.period,!0,!0,!1);this.generator=function*(){for(var r,t,o=yield;;){var{high:n,low:s}=o;l.push(n),l.push(s),t=a.nextValue(o),l.totalPushed>=2*e.period&&t!=void 0&&(r={exitLong:l.periodHigh-t*e.multiplier,exitShort:l.periodLow+t*e.multiplier}),o=yield r}}(),this.generator.next(),r.forEach((e,r)=>{var a={high:e,low:t[r],close:o[r]},l=this.generator.next(a);l.value!=void 0&&this.result.push(l.value)})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return r.value}}Nr.calculate=J;let Xr=ee();e.getAvailableIndicators=ee,e.AvailableIndicators=Xr,e.FixedSizeLinkedList=se,e.CandleData=class{},e.CandleList=ue,e.sma=o,e.SMA=de,e.ema=a,e.EMA=ge,e.wma=l,e.WMA=ve,e.wema=n,e.WEMA=ce,e.macd=s,e.MACD=me,e.rsi=h,e.RSI=fe,e.bollingerbands=d,e.BollingerBands=Pe,e.adx=v,e.ADX=Ee,e.atr=c,e.ATR=He,e.truerange=g,e.TrueRange=Se,e.roc=m,e.ROC=Ve,e.kst=x,e.KST=ke,e.psar=w,e.PSAR=Te,e.stochastic=f,e.Stochastic=Ae,e.williamsr=I,e.WilliamsR=De,e.adl=P,e.ADL=Be,e.obv=_,e.OBV=Le,e.trix=b,e.TRIX=ze,e.forceindex=C,e.ForceIndex=Me,e.cci=S,e.CCI=je,e.awesomeoscillator=q,e.AwesomeOscillator=Re,e.vwap=E,e.VWAP=ye,e.volumeprofile=V,e.VolumeProfile=Oe,e.mfi=k,e.MFI=Ue,e.stochasticrsi=T,e.StochasticRSI=We,e.averagegain=u,e.AverageGain=xe,e.averageloss=i,e.AverageLoss=we,e.sd=p,e.SD=Ie,e.highest=A,e.Highest=Ke,e.lowest=D,e.Lowest=Ge,e.sum=B,e.Sum=Ne,e.renko=L,e.HeikinAshi=Qe,e.heikinashi=z,e.bullish=function(e){return new cr().hasPattern(e)},e.bearish=function(e){return new Vr().hasPattern(e)},e.abandonedbaby=function(e){return new kr().hasPattern(e)},e.doji=function(e){return new rr().hasPattern(e)},e.bearishengulfingpattern=function(e){return new mr().hasPattern(e)},e.bullishengulfingpattern=function(e){return new $e().hasPattern(e)},e.darkcloudcover=function(e){return new Tr().hasPattern(e)},e.downsidetasukigap=function(e){return new or().hasPattern(e)},e.dragonflydoji=function(e){return new Ar().hasPattern(e)},e.gravestonedoji=function(e){return new Dr().hasPattern(e)},e.bullishharami=function(e){return new Je().hasPattern(e)},e.bearishharami=function(e){return new xr().hasPattern(e)},e.bullishharamicross=function(e){return new er().hasPattern(e)},e.bearishharamicross=function(e){return new wr().hasPattern(e)},e.eveningdojistar=function(e){return new fr().hasPattern(e)},e.eveningstar=function(e){return new Ir().hasPattern(e)},e.morningdojistar=function(e){return new tr().hasPattern(e)},e.morningstar=function(e){return new Ze().hasPattern(e)},e.bullishmarubozu=function(e){return new ar().hasPattern(e)},e.bearishmarubozu=function(e){return new Pr().hasPattern(e)},e.piercingline=function(e){return new lr().hasPattern(e)},e.bullishspinningtop=function(e){return new Br().hasPattern(e)},e.bearishspinningtop=function(e){return new Lr().hasPattern(e)},e.threeblackcrows=function(e){return new _r().hasPattern(e)},e.threewhitesoldiers=function(e){return new nr().hasPattern(e)},e.bullishhammerstick=M,e.bearishhammerstick=R,e.bullishinvertedhammerstick=j,e.bearishinvertedhammerstick=y,e.hammerpattern=function(e){return new pr().hasPattern(e)},e.hammerpatternunconfirmed=function(e){return new dr().hasPattern(e)},e.hangingman=function(e){return new br().hasPattern(e)},e.hangingmanunconfirmed=function(e){return new Cr().hasPattern(e)},e.shootingstar=function(e){return new Sr().hasPattern(e)},e.shootingstarunconfirmed=function(e){return new qr().hasPattern(e)},e.tweezertop=function(e){return new Er().hasPattern(e)},e.tweezerbottom=function(e){return new gr().hasPattern(e)},e.fibonacciretracement=function(e,r){let t,o=[0,23.6,38.2,50,61.8,78.6,100,127.2,161.8,261.8,423.6];return t=e<r?o.map(function(t){let o=r-oe(e-r)*t/100;return 0<o?o:0}):o.map(function(t){let o=r+oe(e-r)*t/100;return 0<o?o:0}),t},e.predictPattern=W,e.PatternDetector=Wr,e.hasDoubleBottom=K,e.hasDoubleTop=G,e.hasHeadAndShoulder=N,e.hasInverseHeadAndShoulder=X,e.isTrendingUp=Q,e.isTrendingDown=Y,e.ichimokucloud=Z,e.IchimokuCloud=Kr,e.keltnerchannels=$,e.KeltnerChannels=Gr,e.KeltnerChannelsInput=class extends he{constructor(){super(...arguments),this.maPeriod=20,this.atrPeriod=10,this.useSMA=!1,this.multiplier=1}},e.KeltnerChannelsOutput=class extends he{},e.chandelierexit=J,e.ChandelierExit=Nr,e.ChandelierExitInput=class extends he{constructor(){super(...arguments),this.period=22,this.multiplier=3}},e.ChandelierExitOutput=class extends he{},e.setConfig=function(e,r){ie[e]=r},e.getConfig=r})(this.window=this.window||{});
(function(e){'use strict';function r(e){return ie[e]}function t(e){let t=r('precision');return t?parseFloat(e.toPrecision(t)):e}function o(e){pe.reverseInputs(e);var r=new de(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function a(e){pe.reverseInputs(e);var r=new ge(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function l(e){pe.reverseInputs(e);var r=new ve(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function n(e){pe.reverseInputs(e);var r=new ce(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function s(e){pe.reverseInputs(e);var r=new me(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function u(e){pe.reverseInputs(e);var r=new xe(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function i(e){pe.reverseInputs(e);var r=new we(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function h(e){pe.reverseInputs(e);var r=new fe(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function p(e){pe.reverseInputs(e);var r=new Ie(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function d(e){pe.reverseInputs(e);var r=new Pe(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function g(e){pe.reverseInputs(e);var r=new Se(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function v(e){pe.reverseInputs(e);var r=new Ee(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function c(e){pe.reverseInputs(e);var r=new He(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function m(e){pe.reverseInputs(e);var r=new Ve(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function x(e){pe.reverseInputs(e);var r=new ke(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function w(e){pe.reverseInputs(e);var r=new Te(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function f(e){pe.reverseInputs(e);var r=new Ae(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function I(e){pe.reverseInputs(e);var r=new De(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function P(e){pe.reverseInputs(e);var r=new Be(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function _(e){pe.reverseInputs(e);var r=new Le(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function b(e){pe.reverseInputs(e);var r=new ze(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function C(e){pe.reverseInputs(e);var r=new Me(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function S(e){pe.reverseInputs(e);var r=new je(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function q(e){pe.reverseInputs(e);var r=new Re(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function E(e){pe.reverseInputs(e);var r=new ye(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function H(e,r,t,o){return e<=t&&r>=t||t<=e&&o>=e}function V(e){pe.reverseInputs(e);var r=new Oe(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function k(e){pe.reverseInputs(e);var r=new Ue(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function T(e){pe.reverseInputs(e);var r=new We(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function A(e){pe.reverseInputs(e);var r=new Ke(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function D(e){pe.reverseInputs(e);var r=new Ge(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function B(e){pe.reverseInputs(e);var r=new Ne(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function L(e){pe.reverseInputs(e);var r=new Xe(e).result;return e.reversedInput&&(r.open.reverse(),r.high.reverse(),r.low.reverse(),r.close.reverse(),r.volume.reverse(),r.timestamp.reverse()),pe.reverseInputs(e),r}function z(e){pe.reverseInputs(e);var r=new Qe(e).result;return e.reversedInput&&(r.open.reverse(),r.high.reverse(),r.low.reverse(),r.close.reverse(),r.volume.reverse(),r.timestamp.reverse()),pe.reverseInputs(e),r}function M(e){return new sr().hasPattern(e)}function j(e){return new ur().hasPattern(e)}function R(e){return new ir().hasPattern(e)}function y(e){return new hr().hasPattern(e)}function O(e,r){var t=function(e,r,t){return e+(r-e)*t},o=[],a=new Number((e.length-1)/(r-1));o[0]=e[0];for(var l=1;l<r-1;l++){var n=l*a,s=new Number(Math.floor(n)).toFixed(),u=new Number(Math.ceil(n)).toFixed();o[l]=t(e[s],e[u],n-s)}return o[r-1]=e[e.length-1],o}function F(e){var r=e.reduce((e,r)=>e+r*r,0),t=ae(r);return e.map((e)=>e/t)}function U(){return jr(this,void 0,void 0,function*(){return Fr?Promise.resolve(!0):Ur?Or:(Ur=!0,Or=new Promise(function(e){return jr(this,void 0,void 0,function*(){if(Rr){Mr=require('@tensorflow/tfjs'),console.log('Nodejs Environment detected ');var r=require('@tensorflow/tfjs-node'),t=require('path').resolve(__dirname,'../tf_model/model.json');zr=yield Mr.loadModel(r.io.fileSystem(t))}else return'undefined'==typeof window.tf?(Fr=!1,Ur=!1,console.log('Tensorflow js not imported, pattern detection may not work'),void e()):(Mr=window.tf,console.log('Browser Environment detected ',Mr),console.log('Loading model ....'),zr=yield Mr.loadModel('/tf_model/model.json'),Fr=!0,Ur=!1,setTimeout(e,1e3),void console.log('Loaded model'));return Fr=!0,Ur=!1,void e()})}),void(yield Or))})}function W(e){return jr(this,void 0,void 0,function*(){yield U(),300>e.values.length&&console.warn('Pattern detector requires atleast 300 data points for a reliable prediction, received just ',e.values.length),pe.reverseInputs(e);var r=e.values,t=yield zr.predict(Mr.tensor2d([F(O(r,400))])),o=Mr.argMax(t,1).get(0);return pe.reverseInputs(e),{patternId:o,pattern:yr[o],probability:100*t.get(0,4)}})}function K(r){return jr(this,void 0,void 0,function*(){var t=yield W(r);return t.patternId===e.AvailablePatterns.DB})}function G(r){return jr(this,void 0,void 0,function*(){var t=yield W(r);return t.patternId===e.AvailablePatterns.DT})}function N(r){return jr(this,void 0,void 0,function*(){var t=yield W(r);return t.patternId===e.AvailablePatterns.HS})}function X(r){return jr(this,void 0,void 0,function*(){var t=yield W(r);return t.patternId===e.AvailablePatterns.IHS})}function Q(r){return jr(this,void 0,void 0,function*(){var t=yield W(r);return t.patternId===e.AvailablePatterns.TU})}function Y(r){return jr(this,void 0,void 0,function*(){var t=yield W(r);return t.patternId===e.AvailablePatterns.TD})}function Z(e){pe.reverseInputs(e);var r=new Kr(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function $(e){pe.reverseInputs(e);var r=new Gr(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function J(e){pe.reverseInputs(e);var r=new Nr(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}function ee(){return['sma','ema','wma','wema','macd','rsi','bollingerbands','adx','atr','truerange','roc','kst','psar','stochastic','williamsr','adl','obv','trix','cci','awesomeoscillator','forceindex','vwap','volumeprofile','renko','heikinashi','stochasticrsi','mfi','averagegain','averageloss','highest','lowest','sum','FixedSizeLinkedList','sd','bullish','bearish','abandonedbaby','doji','bearishengulfingpattern','bullishengulfingpattern','darkcloudcover','downsidetasukigap','dragonflydoji','gravestonedoji','bullishharami','bearishharami','bullishharamicross','bearishharamicross','eveningdojistar','eveningstar','morningdojistar','morningstar','bullishmarubozu','bearishmarubozu','piercingline','bullishspinningtop','bearishspinningtop','threeblackcrows','threewhitesoldiers','bullishhammerstick','bearishhammerstick','bullishinvertedhammerstick','bearishinvertedhammerstick','hammerpattern','hammerpatternunconfirmed','hangingman','hangingmanunconfirmed','shootingstar','shootingstarunconfirmed','tweezertop','tweezerbottom','predictPattern','hasDoubleBottom','hasDoubleTop','hasHeadAndShoulder','hasInverseHeadAndShoulder','isTrendingUp','isTrendingDown','ichimokucloud','keltnerchannels','chandelierexit']}var re=Math.min,te=Math.max,oe=Math.abs,ae=Math.sqrt;class le{constructor(e,r,t){this.next=t,t&&(t.prev=this),this.prev=r,r&&(r.next=this),this.data=e}}class ne{constructor(){this._length=0}get head(){return this._head&&this._head.data}get tail(){return this._tail&&this._tail.data}get current(){return this._current&&this._current.data}get length(){return this._length}push(e){this._tail=new le(e,this._tail),0===this._length&&(this._head=this._tail,this._current=this._head,this._next=this._head),this._length++}pop(){var e=this._tail;if(0!==this._length)return(this._length--,0===this._length)?(this._head=this._tail=this._current=this._next=void 0,e.data):(this._tail=e.prev,this._tail.next=void 0,this._current===e&&(this._current=this._tail,this._next=void 0),e.data)}shift(){var e=this._head;if(0!==this._length)return(this._length--,0===this._length)?(this._head=this._tail=this._current=this._next=void 0,e.data):(this._head=this._head.next,this._current===e&&(this._current=this._head,this._next=this._current.next),e.data)}unshift(e){this._head=new le(e,void 0,this._head),0===this._length&&(this._tail=this._head,this._next=this._head),this._length++}unshiftCurrent(){var e=this._current;return e===this._head||2>this._length?e&&e.data:(e===this._tail?(this._tail=e.prev,this._tail.next=void 0,this._current=this._tail):(e.next.prev=e.prev,e.prev.next=e.next,this._current=e.prev),this._next=this._current.next,e.next=this._head,e.prev=void 0,this._head.prev=e,this._head=e,e.data)}removeCurrent(){var e=this._current;if(0!==this._length)return(this._length--,0===this._length)?(this._head=this._tail=this._current=this._next=void 0,e.data):(e===this._tail?(this._tail=e.prev,this._tail.next=void 0,this._current=this._tail):e===this._head?(this._head=e.next,this._head.prev=void 0,this._current=this._head):(e.next.prev=e.prev,e.prev.next=e.next,this._current=e.prev),this._next=this._current.next,e.data)}resetCursor(){return this._current=this._next=this._head,this}next(){var e=this._next;if(void 0!==e)return this._next=e.next,this._current=e,e.data}}class se extends ne{constructor(e,r,t,o){if(super(),this.size=e,this.maintainHigh=r,this.maintainLow=t,this.maintainSum=o,this.totalPushed=0,this.periodHigh=0,this.periodLow=Infinity,this.periodSum=0,!e||'number'!=typeof e)throw'Size required and should be a number.';this._push=this.push,this.push=function(e){this.add(e),this.totalPushed++}}add(e){this.length===this.size?(this.lastShift=this.shift(),this._push(e),this.maintainHigh&&this.lastShift==this.periodHigh&&this.calculatePeriodHigh(),this.maintainLow&&this.lastShift==this.periodLow&&this.calculatePeriodLow(),this.maintainSum&&(this.periodSum-=this.lastShift)):this._push(e),this.maintainHigh&&this.periodHigh<=e&&(this.periodHigh=e),this.maintainLow&&this.periodLow>=e&&(this.periodLow=e),this.maintainSum&&(this.periodSum+=e)}*iterator(){for(this.resetCursor();this.next();)yield this.current}calculatePeriodHigh(){for(this.resetCursor(),this.next()&&(this.periodHigh=this.current);this.next();)this.periodHigh<=this.current&&(this.periodHigh=this.current)}calculatePeriodLow(){for(this.resetCursor(),this.next()&&(this.periodLow=this.current);this.next();)this.periodLow>=this.current&&(this.periodLow=this.current)}}class ue{constructor(){this.open=[],this.high=[],this.low=[],this.close=[],this.volume=[],this.timestamp=[]}}let ie={};class he{}class pe{constructor(e){this.format=e.format||t}static reverseInputs(e){e.reversedInput&&(e.values?e.values.reverse():void 0,e.open?e.open.reverse():void 0,e.high?e.high.reverse():void 0,e.low?e.low.reverse():void 0,e.close?e.close.reverse():void 0,e.volume?e.volume.reverse():void 0,e.timestamp?e.timestamp.reverse():void 0)}getResult(){return this.result}}class de extends pe{constructor(e){super(e),this.period=e.period,this.price=e.values;this.generator=function*(e){var r,t=new ne,o=0,a=1,l=yield;for(t.push(0);;)a<e?(a++,t.push(l),o+=l):(o=o-t.shift()+l,r=o/e,t.push(l)),l=yield r}(this.period),this.generator.next(),this.result=[],this.price.forEach((e)=>{var r=this.generator.next(e);r.value!==void 0&&this.result.push(this.format(r.value))})}nextValue(e){var r=this.generator.next(e).value;if(r!=void 0)return this.format(r)}}de.calculate=o;class ge extends pe{constructor(e){super(e);var r,t=e.period,o=e.values;this.result=[],r=new de({period:t,values:[]});this.generator=function*(){for(var e,o=yield;;)void 0!=e&&void 0!==o?(e=(o-e)*(2/(t+1))+e,o=yield e):(o=yield,e=r.nextValue(o),e&&(o=yield e))}(),this.generator.next(),this.generator.next(),o.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(this.format(r.value))})}nextValue(e){var r=this.generator.next(e).value;if(r!=void 0)return this.format(r)}}ge.calculate=a;class ve extends pe{constructor(e){super(e);var r=e.period,t=e.values;this.result=[],this.generator=function*(){for(let t=new ne;;)if(t.length<r)t.push((yield));else{t.resetCursor();let o=0;for(let e=1;e<=r;e++)o+=t.next()*e/(r*(r+1)/2);var e=yield o;t.shift(),t.push(e)}}(),this.generator.next(),t.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(this.format(r.value))})}nextValue(e){var r=this.generator.next(e).value;if(r!=void 0)return this.format(r)}}ve.calculate=l;class ce extends pe{constructor(e){super(e);var r,t=e.period,o=e.values;this.result=[],r=new de({period:t,values:[]});this.generator=function*(){for(var e,o=yield;;)void 0!=e&&void 0!==o?(e=(o-e)*(1/t)+e,o=yield e):(o=yield,e=r.nextValue(o),void 0!==e&&(o=yield e))}(),this.generator.next(),this.generator.next(),o.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(this.format(r.value))})}nextValue(e){var r=this.generator.next(e).value;if(r!=void 0)return this.format(r)}}ce.calculate=n;class me extends pe{constructor(e){super(e);var r=e.SimpleMAOscillator?de:ge,t=e.SimpleMASignal?de:ge,o=new r({period:e.fastPeriod,values:[],format:(e)=>e}),a=new r({period:e.slowPeriod,values:[],format:(e)=>e}),l=new t({period:e.signalPeriod,values:[],format:(e)=>e}),n=this.format;this.result=[],this.generator=function*(){for(var r,t,s,u,i,h,p=0;;){if(p<e.slowPeriod){r=yield,i=o.nextValue(r),h=a.nextValue(r),p++;continue}i&&h&&(t=i-h,s=l.nextValue(t)),u=t-s,r=yield{MACD:n(t),signal:s?n(s):void 0,histogram:isNaN(u)?void 0:n(u)},i=o.nextValue(r),h=a.nextValue(r)}}(),this.generator.next(),e.values.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(r.value)})}nextValue(e){var r=this.generator.next(e).value;return r}}me.calculate=s;class xe extends pe{constructor(e){super(e);let r=e.values,t=e.period,o=this.format;this.generator=function*(e){var r,t,a=yield,l=1,n=0,s=a;for(a=yield;;)t=a-s,t=0<t?t:0,0<t&&(n+=t),l<e?l++:void 0==r?r=n/e:r=(r*(e-1)+t)/e,s=a,r=void 0===r?void 0:o(r),a=yield r}(t),this.generator.next(),this.result=[],r.forEach((e)=>{var r=this.generator.next(e);r.value!==void 0&&this.result.push(r.value)})}nextValue(e){return this.generator.next(e).value}}xe.calculate=u;class we extends pe{constructor(e){super(e);let r=e.values,t=e.period,o=this.format;this.generator=function*(e){var r,t,a=yield,l=1,n=0,s=a;for(a=yield;;)t=s-a,t=0<t?t:0,0<t&&(n+=t),l<e?l++:void 0==r?r=n/e:r=(r*(e-1)+t)/e,s=a,r=void 0===r?void 0:o(r),a=yield r}(t),this.generator.next(),this.result=[],r.forEach((e)=>{var r=this.generator.next(e);r.value!==void 0&&this.result.push(r.value)})}nextValue(e){return this.generator.next(e).value}}we.calculate=i;class fe extends pe{constructor(e){super(e);var r=e.period,t=e.values,o=new xe({period:r,values:[]}),a=new we({period:r,values:[]});let l=1;this.generator=function*(){for(var e,r,t,n,s=yield;;)e=o.nextValue(s),r=a.nextValue(s),void 0!==e&&void 0!==r&&(0===r?n=100:0===e?n=0:(t=e/r,t=isNaN(t)?0:t,n=parseFloat((100-100/(1+t)).toFixed(2)))),l++,s=yield n}(r),this.generator.next(),this.result=[],t.forEach((e)=>{var r=this.generator.next(e);r.value!==void 0&&this.result.push(r.value)})}nextValue(e){return this.generator.next(e).value}}fe.calculate=h;class Ie extends pe{constructor(e){super(e);var r=e.period,t=e.values,o=new de({period:r,values:[],format:(e)=>e});this.result=[],this.generator=function*(){var e,t,a=new se(r);e=yield;for(var l;;){if(a.push(e),t=o.nextValue(e),t){let e=0;for(let r of a.iterator())e+=Math.pow(r-t,2);l=ae(e/r)}e=yield l}}(),this.generator.next(),t.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(this.format(r.value))})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return this.format(r.value)}}Ie.calculate=p;class Pe extends pe{constructor(e){super(e);var r,t,o=e.period,a=e.values,l=e.stdDev,n=this.format;this.result=[],r=new de({period:o,values:[],format:(e)=>e}),t=new Ie({period:o,values:[],format:(e)=>e}),this.generator=function*(){var e,o,a,s;for(o=yield;;){if(a=r.nextValue(o),s=t.nextValue(o),a){let r=n(a),t=n(a+s*l),u=n(a-s*l),i=n((o-u)/(t-u));e={middle:r,upper:t,lower:u,pb:i}}o=yield e}}(),this.generator.next(),a.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(r.value)})}nextValue(e){return this.generator.next(e).value}}Pe.calculate=d;class _e extends pe{constructor(e){super(e),this.period=e.period,this.price=e.values;this.generator=function*(e){for(var r=new ne,t=0,o=1,a=yield,l=0;;)o<e?(o++,t+=a,l=void 0):o==e?(o++,t+=a,l=t):l=l-l/e+a,a=yield l}(this.period),this.generator.next(),this.result=[],this.price.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(this.format(r.value))})}nextValue(e){var r=this.generator.next(e).value;if(r!=void 0)return this.format(r)}}_e.calculate=function(e){pe.reverseInputs(e);var r=new _e(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r};class be extends pe{constructor(e){super(e);var r=e.low,t=e.high,o=this.format;if(r.length!=t.length)throw'Inputs(low,high) not of equal size';this.result=[],this.generator=function*(){for(var e,r,t=yield;;){if(r){let a=t.high-r.high,l=r.low-t.low;e=o(l>a&&0<l?l:0)}r=t,t=yield e}}(),this.generator.next(),r.forEach((e,o)=>{var a=this.generator.next({high:t[o],low:r[o]});a.value!==void 0&&this.result.push(a.value)})}static calculate(e){pe.reverseInputs(e);var r=new be(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}nextValue(e){return this.generator.next(e).value}}class Ce extends pe{constructor(e){super(e);var r=e.low,t=e.high,o=this.format;if(r.length!=t.length)throw'Inputs(low,high) not of equal size';this.result=[],this.generator=function*(){for(var e,r,t=yield;;){if(r){let a=t.high-r.high,l=r.low-t.low;e=o(a>l&&0<a?a:0)}r=t,t=yield e}}(),this.generator.next(),r.forEach((e,o)=>{var a=this.generator.next({high:t[o],low:r[o]});a.value!==void 0&&this.result.push(a.value)})}static calculate(e){pe.reverseInputs(e);var r=new Ce(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r}nextValue(e){return this.generator.next(e).value}}class Se extends pe{constructor(e){super(e);var r=e.low,t=e.high,o=e.close,a=this.format;if(r.length!=t.length)throw'Inputs(low,high) not of equal size';this.result=[],this.generator=function*(){for(var e,r,t=yield;;)void 0==e&&(e=t.close,t=yield r),r=te(t.high-t.low,isNaN(oe(t.high-e))?0:oe(t.high-e),isNaN(oe(t.low-e))?0:oe(t.low-e)),e=t.close,void 0!=r&&(r=a(r)),t=yield r}(),this.generator.next(),r.forEach((e,a)=>{var l=this.generator.next({high:t[a],low:r[a],close:o[a]});l.value!=void 0&&this.result.push(l.value)})}nextValue(e){return this.generator.next(e).value}}Se.calculate=g;class qe extends he{}class Ee extends pe{constructor(e){super(e);var r=e.low,t=e.high,o=e.close,a=e.period,l=this.format,n=new Ce({high:[],low:[]}),s=new be({high:[],low:[]}),u=new _e({period:a,values:[],format:(e)=>e}),i=new _e({period:a,values:[],format:(e)=>e}),h=new _e({period:a,values:[],format:(e)=>e}),p=new ce({period:a,values:[],format:(e)=>e}),d=new Se({low:[],high:[],close:[]});if(r.length!==t.length||t.length!==o.length)throw'Inputs(low,high, close) not of equal size';this.result=[],qe,this.generator=function*(){var e,r,t,o,a,l,g,v=yield;for(e=0,r=0,t=0;;){let e=d.nextValue(v),r=n.nextValue(v),t=s.nextValue(v);if(e===void 0){v=yield;continue}let c=h.nextValue(e),m=u.nextValue(r),x=i.nextValue(t);if(c!=void 0&&m!=void 0&&x!=void 0){o=100*m/c,a=100*x/c;let e=oe(o-a),r=o+a;l=100*(e/r),g=p.nextValue(l)}v=yield{adx:g,pdi:o,mdi:a}}}(),this.generator.next(),r.forEach((e,a)=>{var n=this.generator.next({high:t[a],low:r[a],close:o[a]});n.value!=void 0&&n.value.adx!=void 0&&this.result.push({adx:l(n.value.adx),pdi:l(n.value.pdi),mdi:l(n.value.mdi)})})}nextValue(e){let r=this.generator.next(e).value;if(r!=void 0&&r.adx!=void 0)return{adx:this.format(r.adx),pdi:this.format(r.pdi),mdi:this.format(r.mdi)}}}Ee.calculate=v;class He extends pe{constructor(e){super(e);var r=e.low,t=e.high,o=e.close,a=e.period,l=this.format;if(r.length!==t.length||t.length!==o.length)throw'Inputs(low,high, close) not of equal size';var n=new Se({low:[],high:[],close:[]}),s=new ce({period:a,values:[],format:(e)=>e});this.result=[],this.generator=function*(){for(var e,r,t=yield;;)r=n.nextValue({low:t.low,high:t.high,close:t.close}),e=void 0===r?void 0:s.nextValue(r),t=yield e}(),this.generator.next(),r.forEach((e,a)=>{var n=this.generator.next({high:t[a],low:r[a],close:o[a]});n.value!==void 0&&this.result.push(l(n.value))})}nextValue(e){return this.generator.next(e).value}}He.calculate=c;class Ve extends pe{constructor(e){super(e);var r=e.period,t=e.values;this.result=[],this.generator=function*(){let e=1;for(var t,o=new se(r),a=yield;;)o.push(a),e<r?e++:t=100*((a-o.lastShift)/o.lastShift),a=yield t}(),this.generator.next(),t.forEach((e)=>{var r=this.generator.next(e);r.value==void 0||isNaN(r.value)||this.result.push(this.format(r.value))})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0&&!isNaN(r.value))return this.format(r.value)}}Ve.calculate=m;class ke extends pe{constructor(e){super(e);let r=e.values,t=e.ROCPer1,o=e.ROCPer2,a=e.ROCPer3,l=e.ROCPer4,n=e.SMAROCPer1,s=e.SMAROCPer2,u=e.SMAROCPer3,i=e.SMAROCPer4,h=e.signalPeriod,p=new Ve({period:t,values:[]}),d=new Ve({period:o,values:[]}),g=new Ve({period:a,values:[]}),v=new Ve({period:l,values:[]}),c=new de({period:n,values:[],format:(e)=>e}),m=new de({period:s,values:[],format:(e)=>e}),x=new de({period:u,values:[],format:(e)=>e}),w=new de({period:i,values:[],format:(e)=>e}),f=new de({period:h,values:[],format:(e)=>e});var I=this.format;this.result=[];let P=te(t+n,o+s,a+u,l+i);this.generator=function*(){for(let e,r,t,o,a,l,n,s=1,u=yield;;){let i=p.nextValue(u),h=d.nextValue(u),_=g.nextValue(u),b=v.nextValue(u);r=i===void 0?void 0:c.nextValue(i),t=h===void 0?void 0:m.nextValue(h),o=_===void 0?void 0:x.nextValue(_),a=b===void 0?void 0:w.nextValue(b),s<P?s++:e=1*r+2*t+3*o+4*a,l=e===void 0?void 0:f.nextValue(e),n=e===void 0?void 0:{kst:I(e),signal:l?I(l):void 0},u=yield n}}(),this.generator.next(),r.forEach((e)=>{let r=this.generator.next(e);r.value!=void 0&&this.result.push(r.value)})}nextValue(e){let r=this.generator.next(e);if(r.value!=void 0)return r.value}}ke.calculate=x;class Te extends pe{constructor(e){super(e);let r=e.high||[],t=e.low||[];this.result=[],this.generator=function*(e,r){for(let t,o,a,l,n=!0,s=e,u=yield;;)t?(a+=s*(o-a),n?(a=re(a,l.low,u.low),t.high>o&&(o=t.high,s=re(s+e,r))):(a=te(a,l.high,u.high),t.low<o&&(o=t.low,s=re(s+e,r))),(n&&t.low<a||!n&&t.high>a)&&(s=e,a=o,n=!n,o=n?t.high:t.low)):(a=u.low,o=u.high),l=u,t&&(u=t),t=yield a}(e.step,e.max),this.generator.next(),t.forEach((e,o)=>{var a=this.generator.next({high:r[o],low:t[o]});a.value!==void 0&&this.result.push(a.value)})}nextValue(e){let r=this.generator.next(e);if(r.value!==void 0)return r.value}}Te.calculate=w;class Ae extends pe{constructor(e){super(e);let r=e.low,t=e.high,o=e.close,a=e.period,l=e.signalPeriod,n=this.format;if(r.length!==t.length||t.length!==o.length)throw'Inputs(low,high, close) not of equal size';this.result=[],this.generator=function*(){let e,r,t=1,o=new se(a,!0,!1),s=new se(a,!1,!0),u=new de({period:l,values:[],format:(e)=>e});for(var i=yield;;){if(o.push(i.high),s.push(i.low),t<a){t++,i=yield;continue}let l=s.periodLow;e=100*((i.close-l)/(o.periodHigh-l)),e=isNaN(e)?0:e,r=u.nextValue(e),i=yield{k:n(e),d:void 0===r?void 0:n(r)}}}(),this.generator.next(),r.forEach((e,a)=>{var l=this.generator.next({high:t[a],low:r[a],close:o[a]});l.value!==void 0&&this.result.push(l.value)})}nextValue(e){let r=this.generator.next(e);if(r.value!==void 0)return r.value}}Ae.calculate=f;class De extends pe{constructor(e){super(e);let r=e.low,t=e.high,o=e.close,a=e.period,l=this.format;if(r.length!==t.length||t.length!==o.length)throw'Inputs(low,high, close) not of equal size';this.result=[],this.generator=function*(){let e,r,t=1,o=new se(a,!0,!1),n=new se(a,!1,!0);var s=yield;for(let u;;){if(o.push(s.high),n.push(s.low),t<a){t++,s=yield;continue}e=n.periodLow,r=o.periodHigh,u=l(-100*((r-s.close)/(r-e))),s=yield u}}(),this.generator.next(),r.forEach((e,a)=>{var l=this.generator.next({high:t[a],low:r[a],close:o[a]});l.value!==void 0&&this.result.push(l.value)})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return this.format(r.value)}}De.calculate=I;class Be extends pe{constructor(e){super(e);var r=e.high,t=e.low,o=e.close,a=e.volume;if(t.length!==r.length||r.length!==o.length||r.length!==a.length)throw'Inputs(low,high, close, volumes) not of equal size';this.result=[],this.generator=function*(){var e,r=0;for(e=yield;;){let t=(e.close-e.low-(e.high-e.close))/(e.high-e.low);t=isNaN(t)?1:t;let o=t*e.volume;r+=o,e=yield Math.round(r)}}(),this.generator.next(),r.forEach((e,r)=>{var l={high:e,low:t[r],close:o[r],volume:a[r]},n=this.generator.next(l);n.value!=void 0&&this.result.push(n.value)})}nextValue(e){return this.generator.next(e).value}}Be.calculate=P;class Le extends pe{constructor(e){super(e);var r=e.close,t=e.volume;this.result=[],this.generator=function*(){var e,r,t=0;for(e=yield,e.close&&'number'==typeof e.close&&(r=e.close,e=yield);;)r<e.close?t+=e.volume:e.close<r&&(t-=e.volume),r=e.close,e=yield t}(),this.generator.next(),r.forEach((e,o)=>{let a={close:r[o],volume:t[o]},l=this.generator.next(a);l.value!=void 0&&this.result.push(l.value)})}nextValue(e){return this.generator.next(e).value}}Le.calculate=_;class ze extends pe{constructor(e){super(e);let r=e.values,t=e.period,o=this.format,a=new ge({period:t,values:[],format:(e)=>e}),l=new ge({period:t,values:[],format:(e)=>e}),n=new ge({period:t,values:[],format:(e)=>e}),s=new Ve({period:1,values:[],format:(e)=>e});this.result=[],this.generator=function*(){for(let e=yield;;){let r=a.nextValue(e),t=r?l.nextValue(r):void 0,u=t?n.nextValue(t):void 0,i=u?s.nextValue(u):void 0;e=yield i?o(i):void 0}}(),this.generator.next(),r.forEach((e)=>{let r=this.generator.next(e);r.value!==void 0&&this.result.push(r.value)})}nextValue(e){let r=this.generator.next(e);if(r.value!==void 0)return r.value}}ze.calculate=b;class Me extends pe{constructor(e){super(e);var r=e.close,t=e.volume,o=e.period||1;if(t.length!==r.length)throw'Inputs(volume, close) not of equal size';let a=new ge({values:[],period:o});this.result=[],this.generator=function*(){var e=yield,r=yield;for(let t;;)t=(r.close-e.close)*r.volume,e=r,r=yield a.nextValue(t)}(),this.generator.next(),t.forEach((e,o)=>{var a=this.generator.next({close:r[o],volume:t[o]});a.value!=void 0&&this.result.push(a.value)})}nextValue(e){let r=this.generator.next(e).value;if(r!=void 0)return r}}Me.calculate=C;class je extends pe{constructor(e){super(e);var r=e.low,t=e.high,o=e.close,a=e.period,l=this.format;var n=new se(a),s=new de({period:a,values:[],format:(e)=>e});if(r.length!==t.length||t.length!==o.length)throw'Inputs(low,high, close) not of equal size';this.result=[],this.generator=function*(){for(var e=yield;;){let r=(e.high+e.low+e.close)/3;n.push(r);let t,o=s.nextValue(r),l=null,u=0;if(o!=void 0){for(let e of n.iterator())u+=oe(e-o);l=u/a,t=(r-o)/(.015*l)}e=yield t}}(),this.generator.next(),r.forEach((e,a)=>{var l=this.generator.next({high:t[a],low:r[a],close:o[a]});l.value!=void 0&&this.result.push(l.value)})}nextValue(e){let r=this.generator.next(e).value;if(r!=void 0)return r}}je.calculate=S;class Re extends pe{constructor(e){super(e);var r=e.high,t=e.low,o=e.fastPeriod,a=e.slowPeriod,l=new de({values:[],period:a}),n=new de({values:[],period:o});this.result=[],this.generator=function*(){var e,r,t,o,a;for(r=yield;;)t=(r.high+r.low)/2,o=l.nextValue(t),a=n.nextValue(t),void 0!==o&&void 0!==a&&(e=a-o),r=yield e}(),this.generator.next(),r.forEach((e,r)=>{var o={high:e,low:t[r]},a=this.generator.next(o);a.value!=void 0&&this.result.push(this.format(a.value))})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return this.format(r.value)}}Re.calculate=q;class ye extends pe{constructor(e){super(e);var r=e.low,t=e.high,o=e.close,a=e.volume,l=this.format;if(r.length!==t.length||t.length!==o.length)throw'Inputs(low,high, close) not of equal size';this.result=[],this.generator=function*(){var e=yield;for(let r=0,t=0;;){let o=(e.high+e.low+e.close)/3,a=e.volume*o;r+=a,t+=e.volume,e=yield r/t}}(),this.generator.next(),r.forEach((e,l)=>{var n=this.generator.next({high:t[l],low:r[l],close:o[l],volume:a[l]});n.value!=void 0&&this.result.push(n.value)})}nextValue(e){let r=this.generator.next(e).value;if(r!=void 0)return r}}ye.calculate=E;class Oe extends pe{constructor(e){super(e);var r=e.high,t=e.low,o=e.close,a=e.open,l=e.volume,n=e.noOfBars;if(t.length!==r.length||r.length!==o.length||r.length!==l.length)throw'Inputs(low,high, close, volumes) not of equal size';this.result=[];var s=te(...r,...t,...o,...a),u=re(...r,...t,...o,...a),i=u;for(let h=0;h<n;h++){let e=i,h=e+(s-u)/n;i=h;let p=0,d=0,g=0;for(let n=0;n<r.length;n++){let s=t[n],u=r[n],i=a[n],v=o[n],c=l[n];H(e,h,s,u)&&(g+=c,i>v?d+=c:p+=c)}this.result.push({rangeStart:e,rangeEnd:h,bullishVolume:p,bearishVolume:d,totalVolume:g})}}nextValue(){throw'Next value not supported for volume profile'}}Oe.calculate=V;class Fe extends pe{constructor(e){super(e),this.result=[],this.generator=function*(){for(let e=yield;;)e=yield(e.high+e.low+e.close)/3}(),this.generator.next(),e.low.forEach((r,t)=>{var o=this.generator.next({high:e.high[t],low:e.low[t],close:e.close[t]});this.result.push(o.value)})}nextValue(e){var r=this.generator.next(e).value;return r}}Fe.calculate=function(e){pe.reverseInputs(e);var r=new Fe(e).result;return e.reversedInput&&r.reverse(),pe.reverseInputs(e),r};class Ue extends pe{constructor(e){super(e);var r=e.high,t=e.low,o=e.close,a=e.volume,l=e.period,n=new Fe({low:[],high:[],close:[]}),s=new se(l,!1,!1,!0),u=new se(l,!1,!1,!0);if(t.length!==r.length||r.length!==o.length||r.length!==a.length)throw'Inputs(low,high, close, volumes) not of equal size';this.result=[],this.generator=function*(){var e,r,t,o,a,i,h=0;let p=null,d=null;for(r=yield,t=r.close,r=yield;;){var{high:g,low:v,close:c,volume:m}=r,x=0,w=0;p=n.nextValue({high:g,low:v,close:c}),h=p*m,null!=p&&null!=d&&(p>d?x=h:w=h,s.push(x),u.push(w),o=s.periodSum,i=u.periodSum,s.totalPushed>=l&&s.totalPushed>=l&&(a=o/i,e=100-100/(1+a))),d=p,r=yield e}}(),this.generator.next(),r.forEach((e,r)=>{var l={high:e,low:t[r],close:o[r],volume:a[r]},n=this.generator.next(l);n.value!=void 0&&this.result.push(parseFloat(n.value.toFixed(2)))})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return parseFloat(r.value.toFixed(2))}}Ue.calculate=k;class We extends pe{constructor(e){super(e);let r=e.values,t=e.rsiPeriod,o=e.stochasticPeriod,a=e.kPeriod,l=e.dPeriod,n=this.format;this.result=[],this.generator=function*(){let e,r,n,s,u=new fe({period:t,values:[]}),i=new Ae({period:o,high:[],low:[],close:[],signalPeriod:a}),h=new de({period:l,values:[],format:(e)=>e});for(var p=yield;;){if(e=u.nextValue(p),void 0!==e){var g={high:e,low:e,close:e};r=i.nextValue(g),void 0!==r&&void 0!==r.d&&(n=h.nextValue(r.d),void 0!==n&&(s={stochRSI:r.k,k:r.d,d:n}))}p=yield s}}(),this.generator.next(),r.forEach((e)=>{var r=this.generator.next(e);r.value!==void 0&&this.result.push(r.value)})}nextValue(e){let r=this.generator.next(e);if(r.value!==void 0)return r.value}}We.calculate=T;class Ke extends pe{constructor(e){super(e);var r=e.values,t=e.period;this.result=[];var o=new se(t,!0,!1,!1);this.generator=function*(){var e,r;for(e=yield;;)o.push(e),o.totalPushed>=t&&(r=o.periodHigh),e=yield r}(),this.generator.next(),r.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(r.value)})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return r.value}}Ke.calculate=A;class Ge extends pe{constructor(e){super(e);var r=e.values,t=e.period;this.result=[];var o=new se(t,!1,!0,!1);this.generator=function*(){var e,r;for(e=yield;;)o.push(e),o.totalPushed>=t&&(r=o.periodLow),e=yield r}(),this.generator.next(),r.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(r.value)})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return r.value}}Ge.calculate=D;class Ne extends pe{constructor(e){super(e);var r=e.values,t=e.period;this.result=[];var o=new se(t,!1,!1,!0);this.generator=function*(){var e,r;for(e=yield;;)o.push(e),o.totalPushed>=t&&(r=o.periodSum),e=yield r}(),this.generator.next(),r.forEach((e)=>{var r=this.generator.next(e);r.value!=void 0&&this.result.push(r.value)})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return r.value}}Ne.calculate=B;class Xe extends pe{constructor(e){super(e);this.format;let r=e.useATR,t=e.brickSize||0;if(r){let r=c(Object.assign({},e));t=r[r.length-1]}if(this.result=new ue,0===t)return void console.error('Not enough data to calculate brickSize for renko when using ATR');let o=0,a=0,l=Infinity,n=0,s=0,u=0;this.generator=function*(){for(let e=yield;;){if(0==o){o=e.close,a=e.high,l=e.low,n=e.close,s=e.volume,u=e.timestamp,e=yield;continue}let r=oe(e.close-n),i=oe(e.close-o);if(r>=t&&i>=t){let u=r>i?o:n,h={open:u,high:a>e.high?a:e.high,low:l<e.Low?l:e.low,close:u>e.close?u-t:u+t,volume:s+e.volume,timestamp:e.timestamp};o=h.open,a=h.close,l=h.close,n=h.close,s=0,e=yield h}else a=a>e.high?a:e.high,l=l<e.Low?l:e.low,s+=e.volume,u=e.timestamp,e=yield}}(),this.generator.next(),e.low.forEach((r,t)=>{var o=this.generator.next({open:e.open[t],high:e.high[t],low:e.low[t],close:e.close[t],volume:e.volume[t],timestamp:e.timestamp[t]});o.value&&(this.result.open.push(o.value.open),this.result.high.push(o.value.high),this.result.low.push(o.value.low),this.result.close.push(o.value.close),this.result.volume.push(o.value.volume),this.result.timestamp.push(o.value.timestamp))})}nextValue(){return console.error('Cannot calculate next value on Renko, Every value has to be recomputed for every change, use calcualte method'),null}}Xe.calculate=L;class Qe extends pe{constructor(e){super(e);this.format;this.result=new ue;let r=null,t=0,o=Infinity,a=0,l=0,n=0;this.generator=function*(){for(let e=yield,s=null;;){if(null==r)r=(e.close+e.open)/2,t=e.high,o=e.low,a=(e.close+e.open+e.high+e.low)/4,l=e.volume||0,n=e.timestamp||0,s={open:r,high:t,low:o,close:a,volume:e.volume||0,timestamp:e.timestamp||0};else{let l=(e.close+e.open+e.high+e.low)/4,n=(r+a)/2,u=te(n,l,e.high),i=re(e.low,n,l);s={close:l,open:n,high:u,low:i,volume:e.volume||0,timestamp:e.timestamp||0},a=l,r=n,t=u,o=i}e=yield s}}(),this.generator.next(),e.low.forEach((r,t)=>{var o=this.generator.next({open:e.open[t],high:e.high[t],low:e.low[t],close:e.close[t],volume:e.volume?e.volume[t]:e.volume,timestamp:e.timestamp?e.timestamp[t]:e.timestamp});o.value&&(this.result.open.push(o.value.open),this.result.high.push(o.value.high),this.result.low.push(o.value.low),this.result.close.push(o.value.close),this.result.volume.push(o.value.volume),this.result.timestamp.push(o.value.timestamp))})}nextValue(e){var r=this.generator.next(e).value;return r}}Qe.calculate=z;class Ye{constructor(){}approximateEqual(e,r){let t=1*parseFloat(oe(e-r).toPrecision(4)),o=1*parseFloat((1e-3*e).toPrecision(4));return t<=o}logic(){throw'this has to be implemented'}getAllPatternIndex(e){if(e.close.length<this.requiredCount)return console.warn('Data count less than data required for the strategy ',this.name),[];e.reversedInput&&(e.open.reverse(),e.high.reverse(),e.low.reverse(),e.close.reverse());let r=this.logic;return this._generateDataForCandleStick(e).map((e,t)=>r.call(this,e)?t:void 0).filter((e)=>e)}hasPattern(e){if(e.close.length<this.requiredCount)return console.warn('Data count less than data required for the strategy ',this.name),!1;e.reversedInput&&(e.open.reverse(),e.high.reverse(),e.low.reverse(),e.close.reverse());let r=this.logic;return r.call(this,this._getLastDataForCandleStick(e))}_getLastDataForCandleStick(e){let r=this.requiredCount;if(e.close.length===r)return e;else{let t={open:[],high:[],low:[],close:[]},o=0,a=e.close.length-r;for(;o<r;)t.open.push(e.open[a+o]),t.high.push(e.high[a+o]),t.low.push(e.low[a+o]),t.close.push(e.close[a+o]),o++;return t}}_generateDataForCandleStick(e){let r=this.requiredCount,t=e.close.map(function(t,o){let a=0,l={open:[],high:[],low:[],close:[]};for(;a<r;)l.open.push(e.open[o+a]),l.high.push(e.high[o+a]),l.low.push(e.low[o+a]),l.close.push(e.close[o+a]),a++;return l}).filter((t,o)=>o<=e.close.length-r);return t}}class Ze extends Ye{constructor(){super(),this.name='MorningStar',this.requiredCount=3}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2];return t<r&&a>u&&a>s&&s<a&&u<a&&i>s&&n<i&&i<h&&h>(r+t)/2}}class $e extends Ye{constructor(){super(),this.name='BullishEngulfingPattern',this.requiredCount=2}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1];return t<r&&r>l&&t>l&&r<n}}class Je extends Ye{constructor(){super(),this.requiredCount=2,this.name='BullishHarami'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1];return r>l&&t<l&&t<n&&r>u&&o>s}}class er extends Ye{constructor(){super(),this.requiredCount=2,this.name='BullishHaramiCross'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=this.approximateEqual(l,n);return r>l&&t<l&&t<n&&r>u&&o>s&&i}}class rr extends Ye{constructor(){super(),this.name='Doji',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=this.approximateEqual(r,t),n=l&&this.approximateEqual(r,o),s=l&&this.approximateEqual(t,a);return l&&n==s}}class tr extends Ye{constructor(){super(),this.name='MorningDojiStar',this.requiredCount=3}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2],g=new rr().hasPattern({open:[l],close:[n],high:[s],low:[u]});return t<r&&g&&i<h&&s<a&&u<a&&i>s&&n<i&&h>(r+t)/2}}class or extends Ye{constructor(){super(),this.requiredCount=3,this.name='DownsideTasukiGap'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2];return t<r&&n<l&&h>i&&s<a&&l>i&&n<i&&h>l&&h<t}}class ar extends Ye{constructor(){super(),this.name='BullishMarubozu',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=this.approximateEqual(t,o)&&this.approximateEqual(a,r)&&r<t&&r<o;return l}}class lr extends Ye{constructor(){super(),this.requiredCount=2,this.name='PiercingLine'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1];return u<a&&t<r&&a>l&&n>(r+t)/2&&n>l}}class nr extends Ye{constructor(){super(),this.name='ThreeWhiteSoldiers',this.requiredCount=3}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2];return s>o&&p>s&&r<t&&l<n&&i<h&&t>l&&l<o&&s>i&&i<n}}class sr extends Ye{constructor(){super(),this.name='BullishHammerStick',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=t>r;return l=l&&this.approximateEqual(t,o),l=l&&t-r<=2*(r-a),l}}class ur extends Ye{constructor(){super(),this.name='BullishInvertedHammerStick',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=t>r;return l=l&&this.approximateEqual(r,a),l=l&&t-r<=2*(o-t),l}}class ir extends Ye{constructor(){super(),this.name='BearishHammerStick',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=r>t;return l=l&&this.approximateEqual(r,o),l=l&&r-t<=2*(t-a),l}}class hr extends Ye{constructor(){super(),this.name='BearishInvertedHammerStick',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=r>t;return l=l&&this.approximateEqual(t,a),l=l&&r-t<=2*(o-r),l}}class pr extends Ye{constructor(){super(),this.name='HammerPattern',this.requiredCount=5}logic(e){let r=this.downwardTrend(e);return r=r&&this.includesHammer(e),r=r&&this.hasConfirmation(e),r}downwardTrend(e,r=!0){let t=r?3:4,o=u({values:e.close.slice(0,t),period:t-1}),a=i({values:e.close.slice(0,t),period:t-1});return a>o}includesHammer(e,r=!0){let t=r?3:4,o=r?4:void 0,a={open:e.open.slice(t,o),close:e.close.slice(t,o),low:e.low.slice(t,o),high:e.high.slice(t,o)},l=R(a);return l=l||y(a),l=l||M(a),l=l||j(a),l}hasConfirmation(e){let r={open:e.open[3],close:e.close[3],low:e.low[3],high:e.high[3]},t={open:e.open[4],close:e.close[4],low:e.low[4],high:e.high[4]},o=t.open<t.close;return o&&r.close<t.close}}class dr extends pr{constructor(){super(),this.name='HammerPatternUnconfirmed'}logic(e){let r=this.downwardTrend(e,!1);return r=r&&this.includesHammer(e,!1),r}}class gr extends Ye{constructor(){super(),this.name='TweezerBottom',this.requiredCount=5}logic(e){return this.downwardTrend(e)&&e.low[3]==e.low[4]}downwardTrend(e){let r=u({values:e.close.slice(0,3),period:2}),t=i({values:e.close.slice(0,3),period:2});return t>r}}let vr=[new $e,new or,new Je,new er,new tr,new Ze,new ar,new lr,new nr,new sr,new ur,new pr,new dr,new gr];class cr extends Ye{constructor(){super(),this.name='Bullish Candlesticks'}hasPattern(e){return vr.reduce(function(r,t){let o=t.hasPattern(e);return r||o},!1)}}class mr extends Ye{constructor(){super(),this.name='BearishEngulfingPattern',this.requiredCount=2}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1];return t>r&&r<l&&t<l&&r>n}}class xr extends Ye{constructor(){super(),this.requiredCount=2,this.name='BearishHarami'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1];return r<l&&t>l&&t>n&&r<u&&o>s}}class wr extends Ye{constructor(){super(),this.requiredCount=2,this.name='BearishHaramiCross'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=this.approximateEqual(l,n);return r<l&&t>l&&t>n&&r<u&&o>s&&i}}class fr extends Ye{constructor(){super(),this.name='EveningDojiStar',this.requiredCount=3}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2],g=new rr().hasPattern({open:[l],close:[n],high:[s],low:[u]});return t>r&&g&&s>o&&u>o&&i<u&&n>i&&i>h&&h<(r+t)/2}}class Ir extends Ye{constructor(){super(),this.name='EveningStar',this.requiredCount=3}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2];return t>r&&o<u&&o<s&&s>o&&u>o&&i<u&&n>i&&i>h&&h<(r+t)/2}}class Pr extends Ye{constructor(){super(),this.name='BearishMarubozu',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=this.approximateEqual(r,o)&&this.approximateEqual(a,t)&&r>t&&r>a;return l}}class _r extends Ye{constructor(){super(),this.name='ThreeBlackCrows',this.requiredCount=3}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2];return a>u&&u>d&&r>t&&l>n&&i>h&&r>l&&l>t&&l>i&&i>n}}class br extends Ye{constructor(){super(),this.name='HangingMan',this.requiredCount=5}logic(e){let r=this.upwardTrend(e);return r=r&&this.includesHammer(e),r=r&&this.hasConfirmation(e),r}upwardTrend(e,r=!0){let t=r?3:4,o=u({values:e.close.slice(0,t),period:t-1}),a=i({values:e.close.slice(0,t),period:t-1});return o>a}includesHammer(e,r=!0){let t=r?3:4,o=r?4:void 0,a={open:e.open.slice(t,o),close:e.close.slice(t,o),low:e.low.slice(t,o),high:e.high.slice(t,o)},l=R(a);return l=l||M(a),l}hasConfirmation(e){let r={open:e.open[3],close:e.close[3],low:e.low[3],high:e.high[3]},t={open:e.open[4],close:e.close[4],low:e.low[4],high:e.high[4]},o=t.open>t.close;return o&&r.close>t.close}}class Cr extends br{constructor(){super(),this.name='HangingManUnconfirmed'}logic(e){let r=this.upwardTrend(e,!1);return r=r&&this.includesHammer(e,!1),r}}class Sr extends Ye{constructor(){super(),this.name='ShootingStar',this.requiredCount=5}logic(e){let r=this.upwardTrend(e);return r=r&&this.includesHammer(e),r=r&&this.hasConfirmation(e),r}upwardTrend(e,r=!0){let t=r?3:4,o=u({values:e.close.slice(0,t),period:t-1}),a=i({values:e.close.slice(0,t),period:t-1});return o>a}includesHammer(e,r=!0){let t=r?3:4,o=r?4:void 0,a={open:e.open.slice(t,o),close:e.close.slice(t,o),low:e.low.slice(t,o),high:e.high.slice(t,o)},l=y(a);return l=l||j(a),l}hasConfirmation(e){let r={open:e.open[3],close:e.close[3],low:e.low[3],high:e.high[3]},t={open:e.open[4],close:e.close[4],low:e.low[4],high:e.high[4]},o=t.open>t.close;return o&&r.close>t.close}}class qr extends Sr{constructor(){super(),this.name='ShootingStarUnconfirmed'}logic(e){let r=this.upwardTrend(e,!1);return r=r&&this.includesHammer(e,!1),r}}class Er extends Ye{constructor(){super(),this.name='TweezerTop',this.requiredCount=5}logic(e){return this.upwardTrend(e)&&e.high[3]==e.high[4]}upwardTrend(e){let r=u({values:e.close.slice(0,3),period:2}),t=i({values:e.close.slice(0,3),period:2});return r>t}}let Hr=[new mr,new xr,new wr,new fr,new Ir,new Pr,new _r,new ir,new hr,new br,new Cr,new Sr,new qr,new Er];class Vr extends Ye{constructor(){super(),this.name='Bearish Candlesticks'}hasPattern(e){return Hr.reduce(function(r,t){return r||t.hasPattern(e)},!1)}}class kr extends Ye{constructor(){super(),this.name='AbandonedBaby',this.requiredCount=3}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1],i=e.open[2],h=e.close[2],p=e.high[2],d=e.low[2],g=new rr().hasPattern({open:[l],close:[n],high:[s],low:[u]});return t<r&&g&&s<a&&d>s&&h>i&&p<r}}class Tr extends Ye{constructor(){super(),this.name='DarkCloudCover',this.requiredCount=2}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=e.open[1],n=e.close[1],s=e.high[1],u=e.low[1];return t>r&&n<l&&l>o&&n<(t+r)/2&&n>r}}class Ar extends Ye{constructor(){super(),this.requiredCount=1,this.name='DragonFlyDoji'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=this.approximateEqual(r,t),n=l&&this.approximateEqual(r,o),s=l&&this.approximateEqual(t,a);return l&&n&&!s}}class Dr extends Ye{constructor(){super(),this.requiredCount=1,this.name='GraveStoneDoji'}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=this.approximateEqual(r,t),n=l&&this.approximateEqual(r,o),s=l&&this.approximateEqual(t,a);return l&&s&&!n}}class Br extends Ye{constructor(){super(),this.name='BullishSpinningTop',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=oe(t-r),n=oe(o-t),s=oe(r-a);return l<n&&l<s}}class Lr extends Ye{constructor(){super(),this.name='BearishSpinningTop',this.requiredCount=1}logic(e){let r=e.open[0],t=e.close[0],o=e.high[0],a=e.low[0],l=oe(t-r),n=oe(o-r),s=oe(o-a);return l<n&&l<s}}var zr,Mr,jr=function(e,r,t,o){return new(t||(t=Promise))(function(a,l){function n(e){try{u(o.next(e))}catch(r){l(r)}}function s(e){try{u(o['throw'](e))}catch(r){l(r)}}function u(e){e.done?a(e.value):new t(function(r){r(e.value)}).then(n,s)}u((o=o.apply(e,r||[])).next())})},Rr=!1,yr=['IHS','TU','DB','HS','TD','DT'];try{Rr='[object process]'===Object.prototype.toString.call(global.process)}catch(r){}(function(e){e[e.IHS=0]='IHS',e[e.TU=1]='TU',e[e.DB=2]='DB',e[e.HS=3]='HS',e[e.TD=4]='TD',e[e.DT=5]='DT'})(e.AvailablePatterns||(e.AvailablePatterns={}));var Or,Fr=!1,Ur=!1;U();class Wr extends pe{}Wr.predictPattern=W,Wr.hasDoubleBottom=K,Wr.hasDoubleTop=G,Wr.hasHeadAndShoulder=N,Wr.hasInverseHeadAndShoulder=X,Wr.isTrendingUp=Q,Wr.isTrendingDown=Y;class Kr extends pe{constructor(e){super(e),this.result=[];var r=Object.assign({},{conversionPeriod:9,basePeriod:26,spanPeriod:52,displacement:26},e),t=new se(2*r.conversionPeriod,!0,!0,!1),o=new se(2*r.basePeriod,!0,!0,!1),a=new se(2*r.spanPeriod,!0,!0,!1);this.generator=function*(){let e,l,n=te(r.conversionPeriod,r.basePeriod,r.spanPeriod,r.displacement),s=1;for(l=yield;;){if(t.push(l.high),t.push(l.low),o.push(l.high),o.push(l.low),a.push(l.high),a.push(l.low),s<n)s++;else{let r=(t.periodHigh+t.periodLow)/2,l=(o.periodHigh+o.periodLow)/2,n=(a.periodHigh+a.periodLow)/2;e={conversion:r,base:l,spanA:(r+l)/2,spanB:n}}l=yield e}}(),this.generator.next(),e.low.forEach((r,t)=>{var o=this.generator.next({high:e.high[t],low:e.low[t]});o.value&&this.result.push(o.value)})}nextValue(e){return this.generator.next(e).value}}Kr.calculate=Z;class Gr extends pe{constructor(e){super(e);var r,t=e.useSMA?de:ge,o=new t({period:e.maPeriod,values:[],format:(e)=>e}),a=new He({period:e.atrPeriod,high:[],low:[],close:[],format:(e)=>e});this.result=[],this.generator=function*(){var t;for(r=yield;;){var{close:l}=r,n=o.nextValue(l),s=a.nextValue(r);n!=void 0&&s!=void 0&&(t={middle:n,upper:n+e.multiplier*s,lower:n-e.multiplier*s}),r=yield t}}(),this.generator.next();var l=e.high;l.forEach((r,t)=>{var o={high:r,low:e.low[t],close:e.close[t]},a=this.generator.next(o);a.value!=void 0&&this.result.push(a.value)})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return r.value}}Gr.calculate=$;class Nr extends pe{constructor(e){super(e);var r=e.high,t=e.low,o=e.close;this.result=[];var a=new He({period:e.period,high:[],low:[],close:[],format:(e)=>e}),l=new se(2*e.period,!0,!0,!1);this.generator=function*(){for(var r,t,o=yield;;){var{high:n,low:s}=o;l.push(n),l.push(s),t=a.nextValue(o),l.totalPushed>=2*e.period&&t!=void 0&&(r={exitLong:l.periodHigh-t*e.multiplier,exitShort:l.periodLow+t*e.multiplier}),o=yield r}}(),this.generator.next(),r.forEach((e,r)=>{var a={high:e,low:t[r],close:o[r]},l=this.generator.next(a);l.value!=void 0&&this.result.push(l.value)})}nextValue(e){var r=this.generator.next(e);if(r.value!=void 0)return r.value}}Nr.calculate=J;let Xr=ee();e.getAvailableIndicators=ee,e.AvailableIndicators=Xr,e.FixedSizeLinkedList=se,e.CandleData=class{},e.CandleList=ue,e.sma=o,e.SMA=de,e.ema=a,e.EMA=ge,e.wma=l,e.WMA=ve,e.wema=n,e.WEMA=ce,e.macd=s,e.MACD=me,e.rsi=h,e.RSI=fe,e.bollingerbands=d,e.BollingerBands=Pe,e.adx=v,e.ADX=Ee,e.atr=c,e.ATR=He,e.truerange=g,e.TrueRange=Se,e.roc=m,e.ROC=Ve,e.kst=x,e.KST=ke,e.psar=w,e.PSAR=Te,e.stochastic=f,e.Stochastic=Ae,e.williamsr=I,e.WilliamsR=De,e.adl=P,e.ADL=Be,e.obv=_,e.OBV=Le,e.trix=b,e.TRIX=ze,e.forceindex=C,e.ForceIndex=Me,e.cci=S,e.CCI=je,e.awesomeoscillator=q,e.AwesomeOscillator=Re,e.vwap=E,e.VWAP=ye,e.volumeprofile=V,e.VolumeProfile=Oe,e.mfi=k,e.MFI=Ue,e.stochasticrsi=T,e.StochasticRSI=We,e.averagegain=u,e.AverageGain=xe,e.averageloss=i,e.AverageLoss=we,e.sd=p,e.SD=Ie,e.highest=A,e.Highest=Ke,e.lowest=D,e.Lowest=Ge,e.sum=B,e.Sum=Ne,e.renko=L,e.HeikinAshi=Qe,e.heikinashi=z,e.bullish=function(e){return new cr().hasPattern(e)},e.bearish=function(e){return new Vr().hasPattern(e)},e.abandonedbaby=function(e){return new kr().hasPattern(e)},e.doji=function(e){return new rr().hasPattern(e)},e.bearishengulfingpattern=function(e){return new mr().hasPattern(e)},e.bullishengulfingpattern=function(e){return new $e().hasPattern(e)},e.darkcloudcover=function(e){return new Tr().hasPattern(e)},e.downsidetasukigap=function(e){return new or().hasPattern(e)},e.dragonflydoji=function(e){return new Ar().hasPattern(e)},e.gravestonedoji=function(e){return new Dr().hasPattern(e)},e.bullishharami=function(e){return new Je().hasPattern(e)},e.bearishharami=function(e){return new xr().hasPattern(e)},e.bullishharamicross=function(e){return new er().hasPattern(e)},e.bearishharamicross=function(e){return new wr().hasPattern(e)},e.eveningdojistar=function(e){return new fr().hasPattern(e)},e.eveningstar=function(e){return new Ir().hasPattern(e)},e.morningdojistar=function(e){return new tr().hasPattern(e)},e.morningstar=function(e){return new Ze().hasPattern(e)},e.bullishmarubozu=function(e){return new ar().hasPattern(e)},e.bearishmarubozu=function(e){return new Pr().hasPattern(e)},e.piercingline=function(e){return new lr().hasPattern(e)},e.bullishspinningtop=function(e){return new Br().hasPattern(e)},e.bearishspinningtop=function(e){return new Lr().hasPattern(e)},e.threeblackcrows=function(e){return new _r().hasPattern(e)},e.threewhitesoldiers=function(e){return new nr().hasPattern(e)},e.bullishhammerstick=M,e.bearishhammerstick=R,e.bullishinvertedhammerstick=j,e.bearishinvertedhammerstick=y,e.hammerpattern=function(e){return new pr().hasPattern(e)},e.hammerpatternunconfirmed=function(e){return new dr().hasPattern(e)},e.hangingman=function(e){return new br().hasPattern(e)},e.hangingmanunconfirmed=function(e){return new Cr().hasPattern(e)},e.shootingstar=function(e){return new Sr().hasPattern(e)},e.shootingstarunconfirmed=function(e){return new qr().hasPattern(e)},e.tweezertop=function(e){return new Er().hasPattern(e)},e.tweezerbottom=function(e){return new gr().hasPattern(e)},e.fibonacciretracement=function(e,r){let t,o=[0,23.6,38.2,50,61.8,78.6,100,127.2,161.8,261.8,423.6];return t=e<r?o.map(function(t){let o=r-oe(e-r)*t/100;return 0<o?o:0}):o.map(function(t){let o=r+oe(e-r)*t/100;return 0<o?o:0}),t},e.predictPattern=W,e.PatternDetector=Wr,e.hasDoubleBottom=K,e.hasDoubleTop=G,e.hasHeadAndShoulder=N,e.hasInverseHeadAndShoulder=X,e.isTrendingUp=Q,e.isTrendingDown=Y,e.ichimokucloud=Z,e.IchimokuCloud=Kr,e.keltnerchannels=$,e.KeltnerChannels=Gr,e.KeltnerChannelsInput=class extends he{constructor(){super(...arguments),this.maPeriod=20,this.atrPeriod=10,this.useSMA=!1,this.multiplier=1}},e.KeltnerChannelsOutput=class extends he{},e.chandelierexit=J,e.ChandelierExit=Nr,e.ChandelierExitInput=class extends he{constructor(){super(...arguments),this.period=22,this.multiplier=3}},e.ChandelierExitOutput=class extends he{},e.setConfig=function(e,r){ie[e]=r},e.getConfig=r})(this.window=this.window||{});

@@ -190,3 +190,3 @@ declare class ForceIndexInput extends IndicatorInput {

static calculate: typeof atr;
nextValue(price: number): number | undefined;
nextValue(price: CandleData): number | undefined;
}

@@ -193,0 +193,0 @@ declare function atr(input: ATRInput): number[];

@@ -40,3 +40,3 @@ import { Indicator, IndicatorInput } from '../indicator/indicator';

//Fourth, divide by the total number of periods (20).
meanDeviation = sum / 20;
meanDeviation = sum / period;
cci = (tp - smaTp) / (constant * meanDeviation);

@@ -43,0 +43,0 @@ }

{
"name": "technicalindicators",
"version": "2.0.7",
"version": "2.0.8",
"description": "Techincal Indicators written in javascript",

@@ -123,2 +123,3 @@ "main": "dist/index.js",

"draw-candlestick": "2.0.3",
"dts-bundle": "^0.7.3",
"gulp": "^3.9.1",

@@ -125,0 +126,0 @@ "gulp-mocha": "^2.2.0",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc