UNPKG

vases-indicatorts

Version:

Stock technical indicators and strategies in TypeScript for browser and server programs.

3 lines (2 loc) 38.6 kB
"use strict";var xe=Object.defineProperty;var nr=Object.getOwnPropertyDescriptor;var or=Object.getOwnPropertyNames;var ir=Object.prototype.hasOwnProperty;var sr=(e,r)=>{for(var n in r)xe(e,n,{get:r[n],enumerable:!0})},ur=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of or(r))!ir.call(e,i)&&i!==n&&xe(e,i,{get:()=>r[i],enumerable:!(t=nr(r,i))||t.enumerable});return e};var mr=e=>ur(xe({},"__esModule",{value:!0}),e);var mn={};sr(mn,{ABDefaultConfig:()=>se,AODefaultConfig:()=>j,APODefaultConfig:()=>$,ATRDefaultConfig:()=>Jt,Action:()=>h,AroonDefaultConfig:()=>Z,BBDefaultConfig:()=>ue,BBWDefaultConfig:()=>$t,BinarySearchTree:()=>k,CCIDefaultConfig:()=>Ht,CEDefaultConfig:()=>zt,CFODefaultConfig:()=>Rr,CMFDefaultConfig:()=>ae,CMODefaultConfig:()=>Et,Chart:()=>wt,CompanyResultSortBy:()=>Lt,DCDefaultConfig:()=>Zt,DEMADefaultConfig:()=>Ut,EMADefaultConfig:()=>Pt,EMVDefaultConfig:()=>ce,FIDefaultConfig:()=>fe,IchimokuCloudDefaultConfig:()=>K,KCDefaultConfig:()=>er,KDJDefaultConfig:()=>ne,MACDDefaultConfig:()=>ee,MCFODefaultConfig:()=>qt,MFIDefaultConfig:()=>le,MIDefaultConfig:()=>Gt,MMaxDefaultConfig:()=>_t,MMinDefaultConfig:()=>Vt,MSTDDefaultConfig:()=>Qt,MSumDefaultConfig:()=>Yt,NVIDefaultConfig:()=>pe,NumRange:()=>I,NumScaler:()=>P,PODefaultConfig:()=>me,PPODefaultConfig:()=>kt,PSARDefaultConfig:()=>re,PVODefaultConfig:()=>Ft,QstickDefaultConfig:()=>Wt,RMADefaultConfig:()=>It,ROCDefaultConfig:()=>Tt,RSIDefaultConfig:()=>Ot,RTSDefaultConfig:()=>Hr,SMADefaultConfig:()=>Bt,STRATEGY_INFOS:()=>Yr,StochDefaultConfig:()=>J,StockAnalysis:()=>de,StrategyStatsSortBy:()=>rr,TEMADefaultConfig:()=>Xt,TRIMADefaultConfig:()=>jt,TRIXDefaultConfig:()=>Kt,Trend:()=>te,UIDefaultConfig:()=>tr,VWAPDefaultConfig:()=>ge,VWMADefaultConfig:()=>oe,VortexDefaultConfig:()=>ie,WillrDefaultConfig:()=>Q,ab:()=>Ge,abStrategy:()=>pt,abs:()=>B,absolutePriceOscillator:()=>Ee,absolutePriceOscillatorStrategy:()=>ot,accelerationBands:()=>Ge,accelerationBandsStrategy:()=>pt,accumulationDistribution:()=>Ie,ad:()=>Ie,add:()=>A,addBy:()=>v,ao:()=>we,aoStrategy:()=>Me,apo:()=>Ee,apoStrategy:()=>ot,applyActions:()=>Se,aroon:()=>ke,aroonStrategy:()=>it,atr:()=>G,averageTrueRange:()=>G,avg:()=>ar,awesomeOscillator:()=>we,awesomeOscillatorStrategy:()=>Me,backtest:()=>pr,balanceOfPower:()=>Fe,balanceOfPowerStrategy:()=>st,bb:()=>Ke,bbStrategy:()=>gt,bbw:()=>Pr,bollingerBands:()=>Ke,bollingerBandsStrategy:()=>gt,bollingerBandsWidth:()=>Pr,bop:()=>Fe,bopStrategy:()=>st,buyAndHoldStrategy:()=>Re,cci:()=>Mr,ce:()=>Er,cfo:()=>_e,cfoStrategy:()=>ut,chaikinMoneyFlow:()=>Je,chaikinMoneyFlowStrategy:()=>bt,chaikinOscillator:()=>Cr,chandeForecastOscillator:()=>_e,chandeForecastOscillatorStrategy:()=>ut,chandelierExit:()=>Er,changes:()=>E,checkSameLength:()=>b,cmf:()=>Je,cmfStrategy:()=>bt,cmo:()=>Cr,communityChannelIndex:()=>Mr,computeStrategyStats:()=>jr,concatAssets:()=>un,daysAgo:()=>tn,daysLaterFrom:()=>rn,dc:()=>kr,dema:()=>Dr,divide:()=>l,divideBy:()=>D,donchianChannel:()=>kr,doubleExponentialMovingAverage:()=>Dr,easeOfMovement:()=>Qe,easeOfMovementStrategy:()=>xt,ema:()=>g,emv:()=>Qe,emvStrategy:()=>xt,exponentialMovingAverage:()=>g,extractSigns:()=>Ce,fi:()=>$e,fiStrategy:()=>ht,forceIndex:()=>$e,forceIndexStrategy:()=>ht,generateNumbers:()=>_,ichimokuCloud:()=>ve,ichimokuCloudStrategy:()=>Le,kc:()=>Fr,kdj:()=>He,kdjStrategy:()=>mt,keltnerChannel:()=>Fr,leastSquare:()=>Nt,linearRegressionUsingLeastSquare:()=>Te,macd:()=>Ne,macdStrategy:()=>at,massIndex:()=>vr,max:()=>U,mcfo:()=>wr,mfi:()=>ze,mfiStrategy:()=>Ct,mi:()=>vr,mmax:()=>w,mmin:()=>M,moneyFlowIndex:()=>ze,moneyFlowIndexStrategy:()=>Ct,movingAverageConvergenceDivergence:()=>Ne,movingAverageConvergenceDivergenceStrategy:()=>at,movingChandeForecastOscillator:()=>wr,movingLeastSquare:()=>Y,movingLinearRegressionUsingLeastSquare:()=>Ve,movingMax:()=>w,movingMin:()=>M,movingStandardDeviation:()=>je,movingSum:()=>y,mstd:()=>je,msum:()=>y,multiply:()=>C,multiplyBy:()=>p,negativeVolumeIndex:()=>Ze,negativeVolumeIndexStrategy:()=>At,newAssetWithLength:()=>sn,nvi:()=>Ze,nviStrategy:()=>At,obv:()=>Vr,onBalanceVolume:()=>Vr,parabolicSAR:()=>qe,parabolicSARStrategy:()=>ct,percentagePriceOscillator:()=>Ar,percentageVolumeOscillator:()=>yr,po:()=>Xe,poStrategy:()=>dt,pow:()=>Ae,ppo:()=>Ar,priceRateOfChange:()=>Sr,projectionOscillator:()=>Xe,projectionOscillatorStrategy:()=>dt,psar:()=>qe,psarStrategy:()=>ct,pvo:()=>yr,qstick:()=>Lr,randomIndex:()=>He,recursiveTrendStrength:()=>Ur,relativeStrengthIndex:()=>Be,reverseActions:()=>lr,rma:()=>X,roc:()=>Sr,rollingMovingAverage:()=>X,roundDigits:()=>W,roundDigitsAll:()=>fr,rsi:()=>Be,rsi2Strategy:()=>tt,rts:()=>Ur,shiftLeftAndFillBy:()=>Dt,shiftLeftBy:()=>he,shiftRightAndFillBy:()=>O,shiftRightBy:()=>V,simpleMovingAverage:()=>d,since:()=>z,sma:()=>d,sortCompanyResults:()=>gr,sortStrategyStats:()=>Kr,sqrt:()=>ye,stoch:()=>Oe,stochStrategy:()=>rt,stochasticOscillator:()=>Oe,stochasticOscillatorStrategy:()=>rt,subtract:()=>c,subtractBy:()=>cr,tema:()=>Or,toISODateString:()=>en,toMonthAndDay:()=>nn,tr:()=>We,transpose:()=>vt,triangularMovingAverage:()=>Br,trima:()=>Br,tripleExponentialAverage:()=>Ir,tripleExponentialMovingAverage:()=>Or,trix:()=>Ir,trueRange:()=>We,typicalPrice:()=>F,typicalPriceStrategy:()=>ft,typprice:()=>F,typpriceStrategy:()=>ft,ui:()=>Tr,ulcerIndex:()=>Tr,volumePriceTrend:()=>_r,volumeWeightedAveragePrice:()=>et,volumeWeightedAveragePriceStrategy:()=>yt,volumeWeightedMovingAverage:()=>Ue,volumeWeightedMovingAverageStrategy:()=>on,vortex:()=>Ye,vortexStrategy:()=>lt,vpt:()=>_r,vwap:()=>et,vwapStrategy:()=>yt,vwma:()=>Ue,vwmaStrategy:()=>on,willRStrategy:()=>nt,williamsR:()=>Pe,williamsRStrategy:()=>nt,willr:()=>Pe});module.exports=mr(mn);function b(...e){if(e.length>0){let r=e[0].length;for(let n=1;n<e.length;n++)if(e[n].length!==r)throw new Error(`values length at ${n} not ${r}`)}}function B(e){return e.map(r=>Math.abs(r))}function A(e,r){b(e,r);let n=new Array(e.length);for(let t=0;t<n.length;t++)n[t]=e[t]+r[t];return n}function ar(e,r){b(e,r);let n=new Array(e.length);for(let t=0;t<n.length;t++)n[t]=(e[t]+r[t])/2;return n}function v(e,r){let n=new Array(r.length);for(let t=0;t<r.length;t++)n[t]=r[t]+e;return n}function l(e,r){b(e,r);let n=new Array(e.length);for(let t=0;t<n.length;t++)n[t]=e[t]/r[t];return n}function D(e,r){let n=new Array(r.length);for(let t=0;t<r.length;t++)n[t]=r[t]/e;return n}function C(e,r){b(e,r);let n=new Array(e.length);for(let t=0;t<n.length;t++)n[t]=e[t]*r[t];return n}function p(e,r){let n=new Array(r.length);for(let t=0;t<n.length;t++)n[t]=r[t]*e;return n}function c(e,r){b(e,r);let n=new Array(e.length);for(let t=0;t<n.length;t++)n[t]=e[t]-r[t];return n}function cr(e,r){let n=new Array(r.length);for(let t=0;t<r.length;t++)n[t]=r[t]-e;return n}function O(e,r,n){let t=new Array(n.length);for(let i=0;i<t.length;i++)i<e?t[i]=r:t[i]=n[i-e];return t}function V(e,r){return O(e,0,r)}function Dt(e,r,n){let t=n.length,i=Array(t).fill(r);for(let o=e;o<t;o++){let s=(o-e+t)%t;i[s]=n[o]}return i}function he(e,r){return Dt(e,0,r)}function E(e,r){return c(r,V(e,r))}function Ce(e){return e.map(r=>r>=0?1:-1)}function vt(...e){b(...e);let r=new Array(e[0].length);for(let n=0;n<r.length;n++){r[n]=new Array(e.length);for(let t=0;t<r[n].length;t++)r[n][t]=e[t][n]}return r}function U(...e){return vt(...e).map(r=>Math.max(...r))}function W(e,r){let n=Math.pow(10,e);return Math.round(r*n)/n}function fr(e,r){return r.map(n=>W(e,n))}function _(e,r,n){let t=new Array((r-e)/n);for(let i=0;i<t.length;i++)t[i]=e+n*i;return t}function Ae(e,r){return e.map(n=>Math.pow(n,r))}function ye(e){return e.map(r=>Math.sqrt(r))}var h=(t=>(t[t.SELL=-1]="SELL",t[t.HOLD=0]="HOLD",t[t.BUY=1]="BUY",t))(h||{});function lr(e){return e.map(r=>r===1?-1:r===-1?1:0)}function Se(e,r){b(e,r);let n=new Array(e.length),t=1,i=t,o=0;for(let s=0;s<n.length;s++)r[s]===1?i>0&&(o=i/e[s],i=0):r[s]===-1&&o>0&&(i=o*e[s],o=0),n[s]=(o*e[s]+i-t)/t;return n}function pr(e,r){let n=new Array(r.length);for(let t=0;t<n.length;t++){let{actions:i}=r[t].strategy(e),o=Se(e.closings,i);n[t]={info:r[t],gain:o[o.length-1],lastAction:i[i.length-1]}}return n.sort((t,i)=>i.gain-t.gain),n}var Lt=(o=>(o[o.SYMBOL=0]="SYMBOL",o[o.NAME=1]="NAME",o[o.STRATEGY=2]="STRATEGY",o[o.GAIN=3]="GAIN",o[o.ACTION=4]="ACTION",o))(Lt||{});function gr(e,r,n){let t=[];switch(r){case 0:t=e.sort((i,o)=>i.companyInfo.symbol.localeCompare(o.companyInfo.symbol));break;case 1:t=e.sort((i,o)=>i.companyInfo.name.localeCompare(o.companyInfo.name));break;case 2:t=e.sort((i,o)=>i.strategyResults[0].info.name.localeCompare(o.strategyResults[0].info.name));break;case 3:t=e.sort((i,o)=>i.strategyResults[0].gain-o.strategyResults[0].gain);break;case 4:t=e.sort((i,o)=>i.strategyResults[0].lastAction-o.strategyResults[0].lastAction);break}return n||(t=t.reverse()),t}function Re(e){return{actions:Array(e.closings.length).fill(1),result:e.closings}}var Bt={period:2};function d(e,r={}){let{period:n}={...Bt,...r},t=new Array(e.length),i=0;for(let o=0;o<e.length;o++)i+=e[o],o>=n?(i-=e[o-n],t[o]=i/n):t[o]=i/(o+1);return t}var j={fast:5,slow:34};function we(e,r,n={}){let{fast:t,slow:i}={...j,...n},o=D(2,A(r,e)),s=d(o,{period:t}),m=d(o,{period:i});return c(s,m)}function Me(e,r={}){let n={...j,...r},t=we(e.highs,e.lows,n);return{actions:t.map(o=>o>0?1:o<0?-1:0),result:t}}var K={short:9,medium:26,long:52,close:26},De=({period:e,highs:r,lows:n,projection:t=0})=>(i,o,s)=>{if(s<e-1)return[...i,0];let m=s+1-e,a=s-t+1,u=Math.max(...r.slice(m,a)),f=Math.min(...n.slice(m,a));return[...i,(u+f)/2]},dr=({highs:e,lows:r,short:n})=>e.reduce(De({period:n,highs:e,lows:r}),[]),br=({highs:e,lows:r,medium:n})=>e.reduce(De({period:n,highs:e,lows:r}),[]),xr=({tenkanSen:e,kijunSen:r,medium:n})=>{let t=new Array(r.length+n).fill(0);return r.forEach((i,o)=>{i&&(t[o+n]=(i+e[o])/2)}),t},hr=({highs:e,lows:r,long:n,medium:t})=>new Array(e.length+t).fill(0).reduce(De({period:n+t,highs:e,lows:r,projection:t}),[]);function ve(e,r,n,t={}){b(e,r,n);let{short:i,medium:o,long:s,close:m}={...K,...t},a=dr({highs:e,lows:r,short:i}),u=br({highs:e,lows:r,medium:o});return{tenkan:a,kijun:u,ssa:xr({tenkanSen:a,kijunSen:u,medium:o}),ssb:hr({highs:e,lows:r,medium:o,long:s}),laggingSpan:he(m,n)}}function Le(e,r={}){let n={...K,...r},t=ve(e.highs,e.lows,e.closings,n),i=new Array(t.kijun.length).fill(0);for(let o=1;o<i.length;o++){let s=e.closings[o],m=t.ssa[o],a=t.ssb[o],u=s>m&&s>a,f=s<m&&s<a,x=t.tenkan[o]>t.kijun[o]&&t.tenkan[o-1]<=t.kijun[o-1],R=t.tenkan[o]<t.kijun[o]&&t.tenkan[o-1]>=t.kijun[o-1];x&&u?i[o]=1:R&&f?i[o]=-1:i[o]=0}return{actions:i,result:t}}var It={period:4};function X(e,r={}){let{period:n}={...It,...r},t=new Array(e.length),i=0;for(let o=0;o<e.length;o++){let s=o+1;o<n?i+=e[o]:(i=t[o-1]*(n-1)+e[o],s=n),t[o]=i/s}return t}var Ot={period:14};function Be(e,r={}){let{period:n}={...Ot,...r},t=new Array(e.length),i=new Array(e.length);t[0]=i[0]=0;for(let u=1;u<e.length;u++){let f=e[u]-e[u-1];f>0?(t[u]=f,i[u]=0):(i[u]=-f,t[u]=0)}let o=X(t,{period:n}),s=X(i,{period:n}),m=new Array(e.length),a=new Array(e.length);m[0]=a[0]=0;for(let u=1;u<e.length;u++)a[u]=o[u]/s[u],m[u]=100-100/(1+a[u]);return m}var Pt={period:12};function g(e,r={}){let{period:n}={...Pt,...r},t=new Array(e.length);if(t.length>0){let i=2/(1+n),o=1-i;t[0]=e[0];for(let s=1;s<t.length;s++)t[s]=e[s]*i+t[s-1]*o}return t}function Ie(e,r,n,t){let i=l(c(c(n,r),c(e,n)),c(e,r)),o=C(i,t),s=new Array(o.length);for(let m=0;m<s.length;m++)s[m]=o[m],m>0&&(s[m]+=s[m-1]);return s}var Et={fast:3,slow:10};function Cr(e,r,n,t,i={}){let{fast:o,slow:s}={...Et,...i},m=Ie(e,r,n,t),a=c(g(m,{period:o}),g(m,{period:s}));return{adResult:m,cmoResult:a}}var kt={fast:12,slow:26,signal:9};function Ar(e,r={}){let{fast:n,slow:t,signal:i}={...kt,...r},o=g(e,{period:n}),s=g(e,{period:t}),m=p(100,l(c(o,s),s)),a=g(m,{period:i}),u=c(m,a);return{ppoResult:m,signal:a,histogram:u}}var Ft={fast:12,slow:26,signal:9};function yr(e,r={}){let{fast:n,slow:t,signal:i}={...Ft,...r},o=g(e,{period:n}),s=g(e,{period:t}),m=p(100,l(c(o,s),s)),a=g(m,{period:i}),u=c(m,a);return{pvoResult:m,signal:a,histogram:u}}var Tt={period:3};function Sr(e,r={}){let{period:n}={...Tt,...r},t=new Array(e.length);for(let i=0;i<e.length;i++)i<n?t[i]=0:t[i]=(e[i]/e[i-n]-1)*100;return t}var k=class e{constructor(){this.root=null}insert(r){let n={value:r,left:null,right:null};if(this.root===null){this.root=n;return}let t=this.root,i=!1;for(;!i;)n.value<=t.value?t.left===null?(t.left=n,i=!0):t=t.left:t.right===null?(t.right=n,i=!0):t=t.right}remove(r){let n={node:this.root,parent:null};for(;n.node!==null;){if(r===n.node.value)return this.removeNode(n),!0;n.parent=n.node,r<n.node.value?n.node=n.node.left:n.node=n.node.right}return!1}min(){let r=e.minNode(this.root);if(r.node===null)throw new Error("Tree empty");return r.node.value}max(){let r=e.maxNode(this.root);if(r.node===null)throw new Error("Tree empty");return r.node?.value}removeNode(r){if(r.node!==null)if(r.node.left!==null&&r.node.right!==null){let n=e.minNode(r.node.right);n.parent===null&&(n.parent=r.node),this.removeNode(n),n.node!==null&&(r.node.value=n.node.value)}else{let n=null;r.node.left!==null?n=r.node.left:n=r.node.right,r.parent===null?this.root=n:r.parent.left===r.node?r.parent.left=n:r.parent.right=n}}static minNode(r){let n={node:null,parent:null};if(r!==null)for(n.node=r;n.node.left!==null;)n.parent=n.node,n.node=n.node.left;return n}static maxNode(r){let n={node:null,parent:null};if(r!==null)for(n.node=r;n.node.right!==null;)n.parent=n.node,n.node=n.node.right;return n}};var Vt={period:4};function M(e,r={}){let{period:n}={...Vt,...r},t=new Array(e.length),i=new k;for(let o=0;o<e.length;o++)i.insert(e[o]),o>=n&&i.remove(e[o-n]),t[o]=i.min();return t}var _t={period:4};function w(e,r={}){let{period:n}={..._t,...r},t=new Array(e.length),i=new k;for(let o=0;o<e.length;o++)i.insert(e[o]),o>=n&&i.remove(e[o-n]),t[o]=i.max();return t}var J={kPeriod:14,dPeriod:3};function Oe(e,r,n,t={}){let{kPeriod:i,dPeriod:o}={...J,...t},s=w(e,{period:i}),m=M(r,{period:i}),a=p(100,l(c(n,m),c(s,m))),u=d(a,{period:o});return{k:a,d:u}}var Q={period:14};function Pe(e,r,n,t={}){let{period:i}={...Q,...t},o=w(e,{period:i}),s=M(r,{period:i});return p(-100,l(c(o,n),c(o,s)))}var $={fast:14,slow:30};function Ee(e,r={}){let{fast:n,slow:t}={...$,...r},i=g(e,{period:n}),o=g(e,{period:t});return c(i,o)}function z(e){let r=new Array(e.length);if(e.length>0){let n=null,t=0;for(let i=0;i<e.length;i++)n!==e[i]?(n=e[i],t=0):t++,r[i]=t}return r}var Z={period:25};function ke(e,r,n={}){b(e,r);let{period:t}={...Z,...n},i=z(w(e,{period:t})),o=z(M(r,{period:t})),s=p(100,D(t,v(t,p(-1,i)))),m=p(100,D(t,v(t,p(-1,o))));return{up:s,down:m}}function Fe(e,r,n,t){return l(c(t,e),c(r,n))}function Nt(e,r){b(e,r);let n=0,t=0,i=0,o=0;for(let u=0;u<e.length;u++)n+=e[u],t+=e[u]*e[u],i+=r[u],o+=e[u]*r[u];let s=e.length,m=(s*o-n*i)/(s*t-n*n),a=(i-m*n)/s;return{m,b:a}}function Y(e,r,n){b(r,n);let t=new Array(r.length),i=new Array(r.length),o=0,s=0,m=0,a=0;for(let u=0;u<r.length;u++){o+=r[u],s+=r[u]*r[u],m+=n[u],a+=r[u]*n[u];let f=u+1;u>=e&&(o-=r[u-e],s-=r[u-e]*r[u-e],m-=n[u-e],a-=r[u-e]*n[u-e],f=e),u>0?(t[u]=(f*a-o*m)/(f*s-o*o),i[u]=(m-t[u]*o)/f):(t[u]=0,i[u]=0)}return{m:t,b:i}}function Te(e,r){let n=Nt(e,r);return v(n.b,p(n.m,e))}function Ve(e,r,n){let t=Y(e,r,n);return A(C(t.m,r),t.b)}var Rr={period:4};function _e(e){let r=_(0,e.length,1),n=Te(r,e);return p(100,l(c(e,n),e))}var qt={period:4};function wr(e,r={}){let{period:n}={...qt,...r},t=_(0,e.length,1),i=Ve(n,t,e);return p(100,l(c(e,i),e))}function F(e,r,n){return D(3,A(A(e,r),n))}var Ht={period:20};function Mr(e,r,n,t={}){let{period:i}={...Ht,...t},o=F(e,r,n),s=d(o,{period:i}),m=d(B(c(o,s)),{period:i});return l(c(o,s),p(.015,m))}var Ut={period:12};function Dr(e,r={}){let{period:n}={...Ut,...r},t=g(e,{period:n}),i=g(t,{period:n});return c(p(2,t),i)}var Yt={period:4};function y(e,r={}){let{period:n}={...Yt,...r},t=new Array(e.length),i=0;for(let o=0;o<e.length;o++)i+=e[o],o>=n&&(i-=e[o-n]),t[o]=i;return t}var Gt={emaPeriod:9,miPeriod:25};function vr(e,r,n={}){let{emaPeriod:t,miPeriod:i}={...Gt,...n},o=g(c(e,r),{period:t}),s=g(o,{period:t}),m=l(o,s);return y(m,{period:i})}var ee={fast:12,slow:26,signal:9};function Ne(e,r={}){let{fast:n,slow:t,signal:i}={...ee,...r},o=g(e,{period:n}),s=g(e,{period:t}),m=c(o,s),a=g(m,{period:i});return{macdLine:m,signalLine:a}}var te=(t=>(t[t.FALLING=-1]="FALLING",t[t.STABLE=0]="STABLE",t[t.RISING=1]="RISING",t))(te||{});var re={step:.02,max:.2};function qe(e,r,n,t={}){b(e,r,n);let{step:i,max:o}={...re,...t},s=new Array(e.length),m=new Array(e.length);s[0]=-1,m[0]=e[0];let a=i,u=r[0];for(let f=1;f<m.length;f++){m[f]=m[f-1]-(m[f-1]-u)*a,s[f-1]===-1?(m[f]=Math.max(m[f],e[f-1]),f>1&&(m[f]=Math.max(m[f],e[f-2])),e[f]>=m[f]&&(m[f]=u)):(m[f]=Math.min(m[f],r[f-1]),f>1&&(m[f]=Math.min(m[f],r[f-2])),r[f]<=m[f]&&(m[f]=u));let x=u;m[f]>n[f]?(s[f]=-1,u=Math.min(u,r[f])):(s[f]=1,u=Math.max(u,e[f])),s[f]!==s[f-1]?a=i:x!==u&&a<o&&(a+=i)}return{trends:s,psarResult:m}}var Wt={period:14};function Lr(e,r,n={}){let{period:t}={...Wt,...n};return d(c(r,e),{period:t})}var ne={rPeriod:9,kPeriod:3,dPeriod:3};function He(e,r,n,t={}){let{rPeriod:i,kPeriod:o,dPeriod:s}={...ne,...t},m=w(e,{period:i}),a=M(r,{period:i}),u=p(100,l(c(n,a),c(m,a))),f=d(u,{period:o}),x=d(f,{period:s}),R=c(p(3,f),p(2,x));return{k:f,d:x,j:R}}var jt={period:4};function Br(e,r={}){let{period:n}={...jt,...r},t=0,i=0;return n%2===0?(t=n/2,i=t+1):(t=(n+1)/2,i=t),d(d(e,{period:i}),{period:t})}var Kt={period:4};function Ir(e,r={}){let{period:n}={...Kt,...r},t=g(e,{period:n}),i=g(t,{period:n}),o=g(i,{period:n}),s=O(1,o[0],o);return l(c(o,s),s)}var Xt={period:2};function Or(e,r={}){let{period:n}={...Xt,...r},t=g(e,{period:n}),i=g(t,{period:n}),o=g(i,{period:n});return A(c(p(3,t),p(3,i)),o)}var oe={period:20};function Ue(e,r,n={}){let{period:t}={...oe,...n};return l(y(C(e,r),{period:t}),y(r,{period:t}))}var ie={period:14};function Ye(e,r,n,t={}){b(e,r,n);let{period:i}={...ie,...t},o=V(1,n),s=B(c(e,V(1,r))),m=B(c(r,V(1,e))),a=y(s,{period:i}),u=y(m,{period:i}),f=U(c(e,r),B(c(e,o)),B(c(r,o))),x=y(f,{period:i}),R=l(a,x),S=l(u,x);return{plus:R,minus:S}}var se={period:20,multiplier:4};function Ge(e,r,n,t={}){b(e,r,n);let{period:i,multiplier:o}={...se,...t},s=l(c(e,r),A(e,r)),m=d(C(e,v(1,p(o,s))),{period:i}),a=d(n,{period:i}),u=d(C(r,v(1,p(-1*o,s))),{period:i});return{upper:m,middle:a,lower:u}}function We(e,r,n){b(e,r,n);let t=O(1,n[0],n);return U(c(e,r),B(c(e,t)),B(c(r,t)))}var Jt={period:14};function G(e,r,n,t={}){let{period:i}={...Jt,...t},o=We(e,r,n),s=d(o,{period:i});return{trLine:o,atrLine:s}}var Qt={period:4};function je(e,r={}){let{period:n}={...Qt,...r},t=new Array(e.length),i=d(e,{period:n});for(let o=0;o<e.length;o++)if(t[o]=0,o>=n-1){let s=0;for(let m=o-(n-1);m<=o;m++)s+=(e[m]-i[o])*(e[m]-i[o]);t[o]=Math.sqrt(s/n)}return t}var ue={period:20};function Ke(e,r={}){let{period:n}={...ue,...r},t=p(2,je(e,{period:n})),i=d(e,{period:n}),o=A(i,t),s=c(i,t);return{upper:o,middle:i,lower:s}}var $t={period:90};function Pr(e,r={}){let{period:n}={...$t,...r},t=l(c(e.upper,e.lower),e.middle),i=g(t,{period:n});return{width:t,widthEma:i}}var zt={period:22};function Er(e,r,n,t={}){let{period:i}={...zt,...t},o=G(e,r,n,{period:i}),s=p(3,o.atrLine),m=w(e,{period:i}),a=M(r,{period:i}),u=c(m,s),f=A(a,s);return{long:u,short:f}}var Zt={period:4};function kr(e,r={}){let{period:n}={...Zt,...r},t=w(e,{period:n}),i=M(e,{period:n}),o=D(2,A(t,i));return{upper:t,middle:o,lower:i}}var er={period:20};function Fr(e,r,n,t={}){let{period:i}={...er,...t},o=G(e,r,n,{period:i}),s=p(2,o.atrLine),m=g(n,{period:i}),a=A(m,s),u=c(m,s);return{middle:m,upper:a,lower:u}}var me={period:14,smooth:3};function Xe(e,r,n,t={}){let{period:i,smooth:o}={...me,...t},s=_(0,n.length,1),m=Y(i,s,e),a=Y(i,s,r),u=A(e,C(m.m,s)),f=A(r,C(a.m,s)),x=w(u,{period:i}),R=M(f,{period:i}),S=l(p(100,c(n,R)),c(x,R)),L=g(S,{period:o});return{poResult:S,spoResult:L}}var tr={period:14};function Tr(e,r={}){let{period:n}={...tr,...r},t=w(e,{period:n}),i=p(100,l(c(e,t),t)),o=d(C(i,i),{period:n});return ye(o)}var ae={period:20};function Je(e,r,n,t,i={}){let{period:o}={...ae,...i},s=l(c(c(n,r),c(e,n)),c(e,r)),m=C(s,t);return l(y(m,{period:o}),y(t,{period:o}))}var ce={period:14};function Qe(e,r,n,t={}){let{period:i}={...ce,...t},o=E(1,D(2,A(e,r))),s=l(D(1e8,n),c(e,r));return d(l(o,s),{period:i})}var fe={period:13};function $e(e,r,n={}){let{period:t}={...fe,...n};return g(C(E(1,e),r),{period:t})}var le={period:14};function ze(e,r,n,t,i={}){let{period:o}={...le,...i},s=C(F(e,r,n),t),m=Ce(E(1,s)),a=C(m,s),u=a.map(S=>S>=0?S:0),f=a.map(S=>S<0?S:0),x=l(y(u,{period:o}),y(p(-1,f),{period:o}));return v(100,p(-100,Ae(v(1,x),-1)))}var pe={start:1e3,period:255};function Ze(e,r,n={}){b(e,r);let{start:t}={...pe,...n},i=new Array(e.length);for(let o=0;o<i.length;o++)o===0?i[o]=t:r[o-1]<r[o]?i[o]=i[o-1]:i[o]=i[o-1]+(e[o]-e[o-1])/e[o-1]*i[o-1];return i}function Vr(e,r){b(e,r);let n=new Array(e.length);n[0]=0;for(let t=1;t<n.length;t++)n[t]=n[t-1],e[t]>e[t-1]?n[t]+=r[t]:e[t]<e[t-1]&&(n[t]-=r[t]);return n}function _r(e,r){let n=O(1,e[0],e),t=C(r,l(c(e,n),n));return y(t,{period:t.length})}var ge={period:14};function et(e,r,n={}){let{period:t}={...ge,...n};return l(y(C(e,r),{period:t}),y(r,{period:t}))}var de=class{constructor(){}segmentationByClose(r,n){if(r.length>1){let s=r.reduce(function(a,u){return a>u?a:u}),m=r.reduce(function(a,u){return a<u?a:u});var t=r.indexOf(m),i=r.indexOf(s);if(t!==i){let a=t<i?"upward":"downward",u=a=="upward"?[t,i+1]:[i,t+1];switch(n.init_trend||(n.init_trend=a=="upward"?1:-1),a){case"upward":var o=Math.atan2(s-m,u[1]-u[0])*180/Math.PI;n.segmentation.push({from:m,to:s,min:m,max:s,degree:o,type:a,upward_point:[],downward_point:[]}),this.trend([...r].slice(u[0],u[1]),n,a,m),r=r.slice(i),n.curr_trend=a=="upward"?1:-1;break;case"downward":var o=Math.atan2(m-s,u[1]-u[0])*180/Math.PI;n.segmentation.push({from:s,to:m,min:m,max:s,degree:o,type:a,upward_point:[],downward_point:[]}),this.trend([...r].slice(u[0],u[1]),n,a,s),r=r.slice(t),n.curr_trend=a=="upward"?1:-1;break}this.segmentationByClose(r,n)}}}trend(r,n,t,i){if(r.length>1){var o=1e3,s=r[0],m=r.length*1e3,a=r[r.length-1],u=Math.atan2(Math.abs(a-s),Math.abs(m-o))*180/Math.PI,f=null,x=0,R=0,S=0,L=0;r.forEach((T,N)=>{var Mt=(N+1)*1e3,q=T,H=Math.atan2(Math.abs(q-s),Math.abs(Mt-o))*180/Math.PI;S++,u>H&&H!=0&&(x>0?H<x&&(L=q,x=H,R=(q-i)/S,f=N):(L=q,x=H,R=(q-i)/S,f=N))}),f&&(n.segmentation[n.segmentation.length-1].avg=(n.segmentation[n.segmentation.length-1].avg+L)/2,n.segmentation[n.segmentation.length-1][t+"_point"].push({degree:x*(t==="upward"?1:-1),close:L,diff:R,date:(f+1)*1e3,seg_idx:n.segmentation.length-1}),n[t+"_point"].push({degree:x*(t==="upward"?1:-1),close:L,diff:R,date:(f+1)*1e3,seg_idx:n.segmentation.length-1}),this.trend(r.slice(f,r.length),n,t,r[f]))}}getLineIntersect(r,n,t,i){var o=0,s=0;o=(n*r.date-i*t.date+t.close-r.close)/(n-i),s=n*(o-r.date)+r.close;var m={date:o,close:s};return m}cross_point(r,n,t){let i=[];r.upward_point.forEach((u,f)=>{r.downward_point.forEach((x,R)=>{var S=this.getLineIntersect(u,u.diff/1e3,x,x.diff/1e3),L=u.date<x.date?u:x,T=L.seg_idx;S.close>=r.segmentation[T].min&&r.segmentation[T].max>=S.close&&i.push(S)})});var o=i.filter(u=>u.close>=n&&t>u.date),s=i.filter(u=>u.close<=n&&t>u.date),m=i.filter(u=>u.close>=n&&t<=u.date),a=i.filter(u=>u.close<=n&&t<=u.date);return{resist:o,support:s,future_resist:m,future_support:a}}};function Nr(e,r){let n=new de,t=e[e.length-1],i=e.length-1,{resist:o,support:s,future_resist:m,future_support:a}=n.cross_point(r,t,i);return{resist_count:o.length,support_count:s.length,future_resist_count:m.length,future_support_count:a.length,resist:o.length>0?o.map(u=>u.close).reduce((u,f)=>u+f,0)/o.length:t,support:s.length>0?s.map(u=>u.close).reduce((u,f)=>u+f,0)/s.length:t,future_resist:m.length>0?m.map(u=>u.close).reduce((u,f)=>u+f,0)/m.length:t,future_support:a.length>0?a.map(u=>u.close).reduce((u,f)=>u+f,0)/a.length:t}}function qr(e){if(e.length===0)return 0;let r=s=>{let m=0,a=0;return s.type==="upward"?(a=s.upward_point.length,a>0&&(m=s.upward_point.reduce((u,f)=>u+f.degree,0)/a)):(a=s.downward_point.length,a>0&&(m=s.downward_point.reduce((u,f)=>u+f.degree,0)/a)),(s.degree+m)/2},n=e[e.length-1],t=r(n),o=e.reduce((s,m)=>s+r(m),0)/e.length;return t-o}var Hr={cacheDisable:!1};function Ur(e){let r,n={recent_trend:[],strength:[],support:[],resist:[],future_support:[],future_resist:[],support_count:[],resist_count:[],future_support_count:[],future_resist_count:[]};for(let t=0;t<e.segs.length;t++){let i=e.segs[t];r!==void 0&&(r.curr_trend==i.curr_trend&&r.segmentation.length-i.segmentation.length>0?i.recent_trend=i.curr_trend>0?1:-1:i.recent_trend=r.recent_trend);let o=qr(i.segmentation),s=Nr(e.closings.slice(0,t+1),i);n.strength.push(o),n.support.push(s.support),n.support_count.push(s.support_count),n.resist.push(s.resist),n.resist_count.push(s.resist_count),n.future_support.push(s.future_support),n.future_support_count.push(s.future_support_count),n.future_resist.push(s.future_resist),n.future_resist_count.push(s.future_resist_count),n.recent_trend.push(i.recent_trend),r=i}return n}function tt(e,r={}){let n=Be(e.closings,{...r}),t=d(e.closings,{period:50}),i=new Array(n.length).fill(0);for(let o=2;o<i.length;o++){let[s,m,a]=[n[o-2],n[o-1],n[o]],u=e.closings[o]>t[o],f=e.closings[o]>e.closings[o-1],x=e.closings[o]<e.closings[o-1],R=a>10&&m<=10&&s<=10,S=a>m&&m>s,L=R&&S&&u&&f,T=a<90&&m>=90&&s>=90,N=a<m&&m<s;L?i[o]=1:T&&N&&!u&&x&&(i[o]=-1)}return{actions:i,result:{rsi:n,sma:t}}}function rt(e,r={}){let n={...J,...r},t=Oe(e.highs,e.lows,e.closings,n),i=new Array(t.k.length);for(let o=1;o<i.length;o++)t.k[o]>t.d[o]&&t.k[o-1]<=t.d[o-1]&&t.k[o]<20?i[o]=1:t.k[o]<t.d[o]&&t.k[o-1]>=t.d[o-1]&&t.k[o]>80?i[o]=-1:i[o]=0;return{actions:i,result:t}}function nt(e,r={}){let n={...Q,...r},t=Pe(e.highs,e.lows,e.closings,n);return{actions:t.map(o=>o<=-80?1:o>=-20?-1:0),result:t}}function ot(e,r={}){let{fast:n,slow:t}={...$,...r},i=Ee(e.closings,{fast:n,slow:t}),o=new Array(i.length);for(let s=0;s<o.length;s++)i[s]>0?o[s]=1:i[s]<0?o[s]=-1:o[s]=0;return{actions:o,result:i}}function it(e,r={}){let n={...Z,...r},t=ke(e.highs,e.lows,n),i=new Array(t.up.length);for(let o=0;o<i.length;o++)t.up[o]>t.down[o]?i[o]=1:t.down[o]>t.up[o]?i[o]=-1:i[o]=0;return{actions:i,result:t}}function st(e){let r=Fe(e.openings,e.highs,e.lows,e.closings);return{actions:r.map(t=>t>0?1:t<0?-1:0),result:r}}function ut(e){let r=_e(e.closings);return{actions:r.map(t=>t>0?1:t<0?-1:0),result:r}}function mt(e,r={}){let n={...ne,...r},t=He(e.highs,e.lows,e.closings,n),i=new Array(t.k.length);for(let o=0;o<i.length;o++)t.k[o]>t.d[o]&&t.k[o]<=20?i[o]=1:t.k[o]<t.d[o]&&t.k[o]>=80?i[o]=-1:i[o]=0;return{actions:i,result:t}}function at(e,r={}){let n={...ee,...r},t=Ne(e.closings,n),i=new Array(t.macdLine.length);for(let o=0;o<i.length;o++)o>0?t.macdLine[o]>t.signalLine[o]&&t.macdLine[o-1]<=t.signalLine[o-1]?i[o]=1:t.macdLine[o]<t.signalLine[o]&&t.macdLine[o-1]>=t.signalLine[o-1]?i[o]=-1:i[o]=0:i[o]=0;return{actions:i,result:t}}function ct(e,r={}){let n={...re,...r},t=qe(e.highs,e.lows,e.closings,n);return{actions:t.trends.map(o=>{switch(o){case-1:return-1;case 1:return 1;case 0:return 0;default:return 0}}),result:t}}function ft(e){let r=F(e.highs,e.lows,e.closings),n=new Array(r.length);n[0]=0;for(let t=1;t<n.length;t++)r[t]>r[t-1]?n[t]=1:r[t]<r[t-1]?n[t]=-1:n[t]=0;return{actions:n,result:r}}function lt(e,r={}){let n={...ie,...r},t=Ye(e.highs,e.lows,e.closings,n),i=new Array(t.plus.length);for(let o=0;o<i.length;o++)t.plus[o]>t.minus[o]?i[o]=1:t.plus[o]<t.minus[o]?i[o]=-1:i[o]=0;return{actions:i,result:t}}function pt(e,r={}){let n={...se,...r},t=Ge(e.highs,e.lows,e.closings,n),i=new Array(t.upper.length);for(let o=0;o<i.length;o++)e.closings[o]>=t.upper[o]?i[o]=1:i[o]=-1;return{actions:i,result:t}}function gt(e,r={}){let n={...ue,...r},t=Ke(e.closings,n),i=new Array(t.upper.length);for(let o=0;o<i.length;o++)e.closings[o]>t.upper[o]?i[o]=-1:e.closings[o]<t.lower[o]?i[o]=1:i[o]=0;return{actions:i,result:t}}function dt(e,r={}){let n={...me,...r},t=Xe(e.highs,e.lows,e.closings,n),i=new Array(t.poResult.length);for(let o=0;o<i.length;o++)t.poResult[o]>t.spoResult[o]?i[o]=1:t.poResult[o]<t.spoResult[o]?i[o]=-1:i[o]=0;return{actions:i,result:t}}function bt(e,r={}){let n={...ae,...r},t=Je(e.highs,e.lows,e.closings,e.volumes,n);return{actions:t.map(o=>o<0?1:o>0?-1:0),result:t}}function xt(e,r={}){let n={...ce,...r},t=Qe(e.highs,e.lows,e.volumes,n);return{actions:t.map(o=>o>0?1:o<0?-1:0),result:t}}function ht(e,r={}){let n={...fe,...r},t=$e(e.closings,e.volumes,n);return{actions:t.map(o=>o>0?1:o<0?-1:0),result:t}}function Ct(e,r={}){let n={...le,...r},t=ze(e.highs,e.lows,e.closings,e.volumes,n);return{actions:t.map(o=>o>=80?-1:o<=20?1:0),result:t}}function At(e,r={}){let n={...pe,...r},t=Ze(e.closings,e.volumes,n),i=g(t,{period:n.period}),o=new Array(t.length);for(let s=0;s<o.length;s++)t[s]<i[s]?o[s]=1:t[s]>i[s]?o[s]=-1:o[s]=0;return{actions:o,result:{nvi:t,ema:i}}}function yt(e,r={}){let n={...ge,...r},t=et(e.closings,e.volumes,n);return{actions:c(t,e.closings).map(s=>s>0?1:s<0?-1:0),result:t}}var Yr=[{name:"Buy Hold",strategy:Re},{name:"Awesome Oscillator",strategy:Me},{name:"RSI 2",strategy:tt},{name:"Ichimoku Cloud",strategy:Le},{name:"Stochastic Oscillator",strategy:rt},{name:"Williams R",strategy:nt},{name:"Absolute Price Oscillator (APO)",strategy:ot},{name:"Aroon Strategy",strategy:it},{name:"Balance of Power (BOM)",strategy:st},{name:"Chande Forecast Oscillator (CFO)",strategy:ut},{name:"KDJ Strategy",strategy:mt},{name:"MACD Strategy",strategy:at},{name:"Parabolic SAR",strategy:ct},{name:"Typical Price",strategy:ft},{name:"Vortex Strategy",strategy:lt},{name:"Acceleration Bands",strategy:pt},{name:"Bollinger Bands",strategy:gt},{name:"Projection Oscillator",strategy:dt},{name:"Chaikin Money Flow (CMF)",strategy:bt},{name:"Ease of Movement (EMV)",strategy:xt},{name:"Force Index",strategy:ht},{name:"Money Flow Index",strategy:Ct},{name:"Negative Volume Index (NVI)",strategy:At},{name:"Volume Weighted Average Price",strategy:yt}];function Gr(e){return{strategyInfo:e.info,score:1,minGain:e.gain,maxGain:e.gain,averageGain:e.gain}}function Wr(e,r){e.score++,e.minGain=Math.min(e.minGain,r.gain),e.maxGain=Math.max(e.maxGain,r.gain),e.averageGain=(e.averageGain+r.gain)/2}function jr(e){let r=new Map;for(let t of e){let i=t.strategyResults[0],o=r.get(i.info.name);o!==void 0?Wr(o,i):r.set(i.info.name,Gr(i))}let n=Array.from(r.values());return n.sort((t,i)=>i.score-t.score),n}var rr=(o=>(o[o.STRATEGY=0]="STRATEGY",o[o.SCORE=1]="SCORE",o[o.MIN=2]="MIN",o[o.MAX=3]="MAX",o[o.AVERAGE=4]="AVERAGE",o))(rr||{});function Kr(e,r,n){let t=[];switch(r){case 0:t=e.sort((i,o)=>i.strategyInfo.name.localeCompare(o.strategyInfo.name));break;case 1:t=e.sort((i,o)=>i.score-o.score);break;case 2:t=e.sort((i,o)=>i.minGain-o.minGain);break;case 3:t=e.sort((i,o)=>i.maxGain-o.maxGain);break;case 4:t=e.sort((i,o)=>i.averageGain-o.averageGain);break}return n||(t=t.reverse()),t}var I=class e{constructor(r,n){this.min=r,this.max=n}getMin(){return this.min}getMax(){return this.max}span(){return this.max-this.min}static merge(r){return r.reduce((n,t)=>new e(Math.min(n.min,t.min),Math.max(n.max,t.max)))}static from(r){return new e(Math.min(...r),Math.max(...r))}};var P=class{constructor(r,n){this.fromDelta=r.getMin(),this.toDelta=n.getMin(),this.multiplier=n.span()/r.span()}scale(r){return(r-this.fromDelta)*this.multiplier+this.toDelta}descale(r){return(r-this.toDelta)/this.multiplier+this.fromDelta}};var Xr="black",Jr=1,Qr="red",$r=1,zr=30,St=4,Zr="14px Arial",Rt=-1,be=new I(0,1),wt=class{constructor(r){let n=document.getElementById(r);if(n===null)throw new Error("Canvas element not found");if(!(n instanceof HTMLCanvasElement))throw new Error("Not a canvas element");this.canvas=n;let t=this.canvas.getContext("2d");if(t===null)throw new Error("Canvas context is null");this.context=t,this.dataSets=new Map,this.dateSetsChanged=!1,this.xScaler=new P(be,be),this.yScaler=new P(be,be),this.xFocus=Rt,this.canvas.addEventListener("mousemove",i=>this.onMouseMove(i)),this.canvas.addEventListener("mouseout",()=>this.onMouseOut())}add(r){this.dataSets.set(r.legend,r),this.dateSetsChanged=!0}remove(r){let n=this.dataSets.delete(r);return n&&(this.dateSetsChanged=!0),n}draw(){this.dateSetsChanged&&(this.updateScalers(),this.dateSetsChanged=!1),this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.drawDataSets(),this.drawFocus()}drawDataSets(){let r=this.chartHeight();for(let n of this.dataSets.values()){this.context.lineWidth=n.width??Jr;let t=0,i=0;for(let o=0;o<n.values.length;o++){let s=this.xScaler.scale(o),m=r-this.yScaler.scale(n.values[o]);o>0&&(this.context.strokeStyle=this.styleAtIndex(n,o),this.context.beginPath(),this.context.moveTo(t,i),this.context.lineTo(s,m),this.context.stroke()),t=s,i=m}}}styleAtIndex(r,n){return r.style===void 0?Xr:Array.isArray(r.style)?r.style[n]:r.style}drawFocus(){this.xFocus!==Rt&&(this.drawFocusLine(),this.drawFocusedValues())}drawFocusLine(){this.context.strokeStyle=Qr,this.context.lineWidth=$r,this.context.beginPath(),this.context.moveTo(this.xFocus,0),this.context.lineTo(this.xFocus,this.chartHeight()),this.context.stroke()}drawFocusedValues(){let r=Math.round(this.xScaler.descale(this.xFocus)),n=St;this.context.font=Zr,this.context.textBaseline="bottom";for(let t of this.dataSets.values())if(r>=0&&r<t.values.length){let i=t.legend+" "+W(2,t.values[r]).toString();this.context.fillStyle=this.styleAtIndex(t,r),this.context.fillText(i,n,this.canvas.height-St),n+=this.context.measureText(i).width+St}}chartHeight(){return this.canvas.height-zr}updateScalers(){this.dataSets.size!==0&&(this.xScaler=new P(new I(0,Math.max(...Array.from(this.dataSets.values(),r=>r.values.length))),new I(0,this.canvas.width)),this.yScaler=new P(I.merge(Array.from(this.dataSets.values(),r=>I.from(r.values))),new I(0,this.chartHeight())))}onMouseMove(r){let n=this.canvas.getBoundingClientRect();this.xFocus=r.clientX-n.left,this.draw()}onMouseOut(){this.xFocus=Rt,this.draw()}};function en(e){return e.toISOString().substring(0,10)}function tn(e){let r=new Date;return r.setDate(r.getDate()-e),r}function rn(e,r){let n=new Date(e);return n.setDate(n.getDate()+r),n}function nn(e){return(e.getMonth()+1).toString()+"/"+e.getDate().toString()}function on(e,r={}){let n={...oe,...r},t=d(e.closings,n),i=Ue(e.closings,e.volumes,n),o=new Array(i.length);for(let s=0;s<o.length;s++)i[s]>t[s]?o[s]=1:i[s]<t[s]?o[s]=-1:o[s]=0;return{actions:o,result:{sma:t,vwma:i}}}function sn(e){return{dates:new Array(e),openings:new Array(e),closings:new Array(e),highs:new Array(e),lows:new Array(e),volumes:new Array(e)}}function un(e,r){return{dates:[...e.dates,...r.dates],openings:[...e.openings,...r.openings],closings:[...e.closings,...r.closings],highs:[...e.highs,...r.highs],lows:[...e.lows,...r.lows],volumes:[...e.volumes,...r.volumes]}}0&&(module.exports={ABDefaultConfig,AODefaultConfig,APODefaultConfig,ATRDefaultConfig,Action,AroonDefaultConfig,BBDefaultConfig,BBWDefaultConfig,BinarySearchTree,CCIDefaultConfig,CEDefaultConfig,CFODefaultConfig,CMFDefaultConfig,CMODefaultConfig,Chart,CompanyResultSortBy,DCDefaultConfig,DEMADefaultConfig,EMADefaultConfig,EMVDefaultConfig,FIDefaultConfig,IchimokuCloudDefaultConfig,KCDefaultConfig,KDJDefaultConfig,MACDDefaultConfig,MCFODefaultConfig,MFIDefaultConfig,MIDefaultConfig,MMaxDefaultConfig,MMinDefaultConfig,MSTDDefaultConfig,MSumDefaultConfig,NVIDefaultConfig,NumRange,NumScaler,PODefaultConfig,PPODefaultConfig,PSARDefaultConfig,PVODefaultConfig,QstickDefaultConfig,RMADefaultConfig,ROCDefaultConfig,RSIDefaultConfig,RTSDefaultConfig,SMADefaultConfig,STRATEGY_INFOS,StochDefaultConfig,StockAnalysis,StrategyStatsSortBy,TEMADefaultConfig,TRIMADefaultConfig,TRIXDefaultConfig,Trend,UIDefaultConfig,VWAPDefaultConfig,VWMADefaultConfig,VortexDefaultConfig,WillrDefaultConfig,ab,abStrategy,abs,absolutePriceOscillator,absolutePriceOscillatorStrategy,accelerationBands,accelerationBandsStrategy,accumulationDistribution,ad,add,addBy,ao,aoStrategy,apo,apoStrategy,applyActions,aroon,aroonStrategy,atr,averageTrueRange,avg,awesomeOscillator,awesomeOscillatorStrategy,backtest,balanceOfPower,balanceOfPowerStrategy,bb,bbStrategy,bbw,bollingerBands,bollingerBandsStrategy,bollingerBandsWidth,bop,bopStrategy,buyAndHoldStrategy,cci,ce,cfo,cfoStrategy,chaikinMoneyFlow,chaikinMoneyFlowStrategy,chaikinOscillator,chandeForecastOscillator,chandeForecastOscillatorStrategy,chandelierExit,changes,checkSameLength,cmf,cmfStrategy,cmo,communityChannelIndex,computeStrategyStats,concatAssets,daysAgo,daysLaterFrom,dc,dema,divide,divideBy,donchianChannel,doubleExponentialMovingAverage,easeOfMovement,easeOfMovementStrategy,ema,emv,emvStrategy,exponentialMovingAverage,extractSigns,fi,fiStrategy,forceIndex,forceIndexStrategy,generateNumbers,ichimokuCloud,ichimokuCloudStrategy,kc,kdj,kdjStrategy,keltnerChannel,leastSquare,linearRegressionUsingLeastSquare,macd,macdStrategy,massIndex,max,mcfo,mfi,mfiStrategy,mi,mmax,mmin,moneyFlowIndex,moneyFlowIndexStrategy,movingAverageConvergenceDivergence,movingAverageConvergenceDivergenceStrategy,movingChandeForecastOscillator,movingLeastSquare,movingLinearRegressionUsingLeastSquare,movingMax,movingMin,movingStandardDeviation,movingSum,mstd,msum,multiply,multiplyBy,negativeVolumeIndex,negativeVolumeIndexStrategy,newAssetWithLength,nvi,nviStrategy,obv,onBalanceVolume,parabolicSAR,parabolicSARStrategy,percentagePriceOscillator,percentageVolumeOscillator,po,poStrategy,pow,ppo,priceRateOfChange,projectionOscillator,projectionOscillatorStrategy,psar,psarStrategy,pvo,qstick,randomIndex,recursiveTrendStrength,relativeStrengthIndex,reverseActions,rma,roc,rollingMovingAverage,roundDigits,roundDigitsAll,rsi,rsi2Strategy,rts,shiftLeftAndFillBy,shiftLeftBy,shiftRightAndFillBy,shiftRightBy,simpleMovingAverage,since,sma,sortCompanyResults,sortStrategyStats,sqrt,stoch,stochStrategy,stochasticOscillator,stochasticOscillatorStrategy,subtract,subtractBy,tema,toISODateString,toMonthAndDay,tr,transpose,triangularMovingAverage,trima,tripleExponentialAverage,tripleExponentialMovingAverage,trix,trueRange,typicalPrice,typicalPriceStrategy,typprice,typpriceStrategy,ui,ulcerIndex,volumePriceTrend,volumeWeightedAveragePrice,volumeWeightedAveragePriceStrategy,volumeWeightedMovingAverage,volumeWeightedMovingAverageStrategy,vortex,vortexStrategy,vpt,vwap,vwapStrategy,vwma,vwmaStrategy,willRStrategy,williamsR,williamsRStrategy,willr}); //# sourceMappingURL=index.js.map