UNPKG

highcharts

Version:
14 lines 68.7 kB
/** * Highstock JS v12.6.0 (2026-04-13) * @module highcharts/indicators/indicators-all * @requires highcharts * @requires highcharts/modules/stock * * All technical indicators for Highcharts Stock * * (c) 2010-2026 Highsoft AS * Author: Paweł Fus * * A commercial license may be required depending on use. * See www.highcharts.com/license */import*as e from"../highcharts.js";import*as t from"../modules/datagrouping.js";var s,a={};a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var s in t)a.o(t,s)&&!a.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let o=e.default;var i=a.n(o);let n=e.default.Chart;var r=a.n(n);let l=e.default.SeriesRegistry;var p=a.n(l);let{doc:u,win:h}=i();function d(e,t,s,a={}){let o="function"==typeof e&&e.prototype||e;Object.hasOwnProperty.call(o,"hcEvents")||(o.hcEvents={});let n=o.hcEvents;i().Point&&e instanceof i().Point&&e.series&&e.series.chart&&(e.series.chart.runTrackerClick=!0);let r=e.addEventListener;r&&r.call(e,t,s,!!i().supportsPassiveEvents&&{passive:void 0===a.passive?-1!==t.indexOf("touch"):a.passive,capture:!1}),n[t]||(n[t]=[]);let l={fn:s,order:"number"==typeof a.order?a.order:1/0};return n[t].push(l),n[t].sort((e,t)=>e.order-t.order),function(){!function(e,t,s){function a(t,s){let a=e.removeEventListener;a&&a.call(e,t,s,!1)}function o(s){let o,i;e.nodeName&&(t?(o={})[t]=!0:o=s,b(o,function(e,t){if(s[t])for(i=s[t].length;i--;)a(t,s[t][i].fn)}))}let i="function"==typeof e&&e.prototype||e;if(Object.hasOwnProperty.call(i,"hcEvents")){let e=i.hcEvents;if(t){let i=e[t]||[];s?(e[t]=i.filter(function(e){return s!==e.fn}),a(t,s)):(o(e),e[t]=[])}else o(e),delete i.hcEvents}}(e,t,s)}}function c(e){let t=e.length,s=e[0];for(;t--;)e[t]>s&&(s=e[t]);return s}function m(e,t){return e>1e14?e:parseFloat(e.toPrecision(t||14))}function g(e){return null!=e}function y(e,t){let s;for(s in e||(e={}),t)e[s]=t[s];return e}function f(e){return D(e)&&"number"==typeof e.nodeType}function x(e){return"number"==typeof e&&!isNaN(e)&&e<1/0&&e>-1/0}function v(e){let t=Object.prototype.toString.call(e);return"[object Array]"===t||"[object Array Iterator]"===t}function D(e,t){return!!e&&"object"==typeof e&&(!t||!v(e))}function S(e,...t){let s,a=[e,...t],o={},i=function(e,t){return"object"!=typeof e&&(e={}),b(t,function(s,a){if("__proto__"!==a&&"constructor"!==a){let o;!D(s,!0)||(o=s?.constructor,D(s,!0)&&!f(s)&&o?.name&&"Object"!==o.name)||f(s)?e[a]=t[a]:e[a]=i(e[a]||{},s)}}),e};!0===e&&(o=a[1],a=Array.prototype.slice.call(a,2));let n=a.length;for(s=0;s<n;s++)o=i(o,a[s]);return o}function b(e,t,s){for(let a in e)Object.hasOwnProperty.call(e,a)&&t.call(s||e[a],e[a],a,e)}function T(){let e=arguments,t=e.length;for(let s=0;s<t;s++){let t=e[s];if(null!=t)return t}}Array.prototype.find;let{line:C}=p().seriesTypes,A=(e,t)=>{let s=[],a=e.pointArrayMap,o=t&&e.dataTable.getModified()||e.dataTable;if(!a)return e.getColumn("y",t);let i=a.map(s=>e.getColumn(s,t));for(let e=0;e<o.rowCount;e++){let t=a.map((t,s)=>i[s]?.[e]||0);s.push(t)}return s};class P extends C{destroy(){this.dataEventsToUnbind.forEach(function(e){e()}),super.destroy.apply(this,arguments)}getName(){let e=[],t=this.name;return t||((this.nameComponents||[]).forEach(function(t,s){e.push(this.options.params[t]+T(this.nameSuffixes[s],""))},this),t=(this.nameBase||this.type.toUpperCase())+(this.nameComponents?" ("+e.join(", ")+")":"")),t}getValues(e,t){let s=t.period,a=e.xData||[],o=e.yData,i=o.length,n=[],r=[],l=[],p,u=-1,h=0,d,c=0;if(!(a.length<s)){for(v(o[0])&&(u=t.index?t.index:0);h<s-1;)c+=u<0?o[h]:o[h][u],h++;for(p=h;p<i;p++)c+=u<0?o[p]:o[p][u],d=[a[p],c/s],n.push(d),r.push(d[0]),l.push(d[1]),c-=u<0?o[p-h]:o[p-h][u];return{values:n,xData:r,yData:l}}}init(e,t){let s=this;super.init.call(s,e,t);let a=d(r(),"afterLinkSeries",function({isUpdating:t}){if(t)return;let a=!!s.dataEventsToUnbind.length;if(!s.linkedParent)return(0,o.error)("Series "+s.options.linkedTo+" not found! Check `linkedTo`.",!1,e);if(!a&&(s.dataEventsToUnbind.push(d(s.linkedParent,"updatedData",function(){s.recalculateValues()})),s.calculateOn.xAxis&&s.dataEventsToUnbind.push(d(s.linkedParent.xAxis,s.calculateOn.xAxis,function(){s.recalculateValues()}))),"init"===s.calculateOn.chart)s.closestPointRange||s.recalculateValues();else if(!a){let e=d(s.chart,s.calculateOn.chart,function(){s.recalculateValues(),e()})}},{order:0});s.dataEventsToUnbind=[],s.eventsToUnbind.push(a)}recalculateValues(){let e=[],t=this.dataTable,s=this.points||[],a=this.dataTable.rowCount,o=!0,n,r,l,p,h=this.linkedParent.yData,d=this.linkedParent.processedYData;this.linkedParent.xData=this.linkedParent.getColumn("x"),this.linkedParent.yData=A(this.linkedParent),this.linkedParent.processedYData=A(this.linkedParent,!0);let c=this.linkedParent.options&&this.linkedParent.dataTable.rowCount&&this.getValues(this.linkedParent,this.options.params)||{values:[],xData:[],yData:[]};delete this.linkedParent.xData,this.linkedParent.yData=h,this.linkedParent.processedYData=d;let m=this.pointArrayMap||["y"],g={};if(c.yData.forEach(e=>{m.forEach((t,s)=>{let a=g[t]||[];a.push(v(e)?e[s]:e),g[t]||(g[t]=a)})}),a&&!this.hasGroupedData&&this.visible&&this.points)if(this.cropped){this.xAxis&&(l=this.xAxis.min,p=this.xAxis.max);let a=this.cropData(t,l,p),o=["x",...this.pointArrayMap||["y"]];for(let t=0;t<(a.modified?.rowCount||0);t++){let s=o.map(e=>this.getColumn(e)[t]||0);e.push(s)}let i=this.getColumn("x");n=c.xData.indexOf(i[0]),r=c.xData.indexOf(i[i.length-1]),-1===n&&r===c.xData.length-2&&e[0][0]===s[0].x&&e.shift(),this.updateData(e)}else(this.updateAllPoints||c.xData.length!==a-1&&c.xData.length!==a+1)&&(o=!1,this.updateData(c.values));o&&(t.setColumns({...g,x:c.xData}),this.options.data=c.values),this.calculateOn.xAxis&&this.getColumn("x",!0).length&&(this.isDirty=!0,this.redraw()),this.isDirtyData=!!this.linkedSeries.length,function(e,t,s,a){if(s=s||{},u?.createEvent&&(e.dispatchEvent||e.fireEvent&&e!==i())){let a=u.createEvent("Events");a.initEvent(t,!0,!0),s=y(a,s),e.dispatchEvent?e.dispatchEvent(s):e.fireEvent(t,s)}else if(e.hcEvents){s.target||y(s,{preventDefault:function(){s.defaultPrevented=!0},target:e,type:t});let a=[],o=e,i=!1;for(;o.hcEvents;)Object.hasOwnProperty.call(o,"hcEvents")&&o.hcEvents[t]&&(a.length&&(i=!0),a.unshift.apply(a,o.hcEvents[t])),o=Object.getPrototypeOf(o);i&&a.sort((e,t)=>e.order-t.order),a.forEach(t=>{!1===t.fn.call(e,s,e)&&s.preventDefault()})}}(this,"updatedData")}processData(){let e=this.options.compareToMain,t=this.linkedParent;super.processData.apply(this,arguments),this.dataModify&&t&&t.dataModify&&t.dataModify.compareValue&&e&&(this.dataModify.compareValue=t.dataModify.compareValue)}}P.defaultOptions=S(C.defaultOptions,{name:void 0,tooltip:{valueDecimals:4},linkedTo:void 0,compareToMain:!1,params:{index:3,period:14}}),y(P.prototype,{calculateOn:{chart:"init"},hasDerivedData:!0,nameComponents:["period"],nameSuffixes:[],useCommonDataGrouping:!0}),p().registerSeriesType("sma",P);let{sma:M}=p().seriesTypes;class O extends M{accumulatePeriodPoints(e,t,s){let a=0,o=0;for(;o<e;)a+=t<0?s[o]:s[o][t],o++;return a}calculateEma(e,t,s,a,o,i,n){let r=e[s-1],l=i<0?t[s-1]:t[s-1][i];return[r,void 0===o?n:m(l*a+o*(1-a))]}getValues(e,t){let s=t.period,a=e.xData,o=e.yData,i=o?o.length:0,n=2/(s+1),r=[],l=[],p=[],u,h,d,c=-1,m=0;if(!(i<s)){for(v(o[0])&&(c=t.index?t.index:0),m=this.accumulatePeriodPoints(s,c,o)/s,d=s;d<i+1;d++)h=this.calculateEma(a,o,d,n,u,c,m),r.push(h),l.push(h[0]),p.push(h[1]),u=h[1];return{values:r,xData:l,yData:p}}}}O.defaultOptions=S(M.defaultOptions,{params:{index:3,period:9}}),p().registerSeriesType("ema",O);let{sma:V}=p().seriesTypes;class L extends V{static populateAverage(e,t,s,a,o){let i=t[a][1],n=t[a][2],r=t[a][3],l=s[a],p=r===i&&r===n||i===n?0:(2*r-n-i)/(i-n)*l;return[e[a],p]}getValues(e,t){let s,a,i,n=t.period,r=e.xData,l=e.yData,p=t.volumeSeriesID,u=e.chart.get(p),h=u?.getColumn("y"),d=l?l.length:0,c=[],m=[],g=[];if(!(r.length<=n)||!d||4===l[0].length){if(!u)return void(0,o.error)("Series "+p+" not found! Check `volumeSeriesID`.",!0,e.chart);for(a=n;a<d;a++)s=c.length,i=L.populateAverage(r,l,h,a,n),s>0&&(i[1]+=c[s-1][1]),c.push(i),m.push(i[0]),g.push(i[1]);return{values:c,xData:m,yData:g}}}}L.defaultOptions=S(V.defaultOptions,{params:{index:void 0,volumeSeriesID:"volume"}}),y(L.prototype,{nameComponents:!1,nameBase:"Accumulation/Distribution"}),p().registerSeriesType("ad",L);let{noop:k}=i(),{column:{prototype:E},sma:w}=p().seriesTypes;class I extends w{drawGraph(){let e,t=this.options,s=this.points,a=this.userOptions.color,o=t.greaterBarColor,i=t.lowerBarColor,n=s[0];if(!a&&n)for(e=1,n.color=o;e<s.length;e++)s[e].y>s[e-1].y?s[e].color=o:s[e].y<s[e-1].y?s[e].color=i:s[e].color=s[e-1].color}getValues(e){let t=e.xData||[],s=e.yData||[],a=s.length,o=[],i=[],n=[],r,l,p,u,h,d,c=0,g=0;if(!(t.length<=34)&&v(s[0])&&4===s[0].length){for(h=0;h<33;h++)u=(s[h][1]+s[h][2])/2,h>=29&&(g=m(g+u)),c=m(c+u);for(d=33;d<a;d++)g=m(g+(u=(s[d][1]+s[d][2])/2)),c=m(c+u),r=m(g/5-c/34),o.push([t[d],r]),i.push(t[d]),n.push(r),l=d+1-5,p=d+1-34,g=m(g-(s[l][1]+s[l][2])/2),c=m(c-(s[p][1]+s[p][2])/2);return{values:o,xData:i,yData:n}}}}I.defaultOptions=S(w.defaultOptions,{params:{index:void 0,period:void 0},greaterBarColor:"#06b535",lowerBarColor:"#f21313",threshold:0,groupPadding:.2,pointPadding:.2,crisp:!1,states:{hover:{halo:{size:0}}}}),y(I.prototype,{nameBase:"AO",nameComponents:void 0,markerAttribs:k,getColumnMetrics:E.getColumnMetrics,crispCol:E.crispCol,translate:E.translate,drawPoints:E.drawPoints}),p().registerSeriesType("ao",I);let{sma:{prototype:N}}=p().seriesTypes;!function(e){let t=["bottomLine"],s=["top","bottom"],a=["top"];function i(e){return"plot"+e.charAt(0).toUpperCase()+e.slice(1)}function n(e,t){let s=[];return(e.pointArrayMap||[]).forEach(e=>{e!==t&&s.push(i(e))}),s}function r(){let e=this,t=e.pointValKey,s=e.linesApiNames,a=e.areaLinesNames,r=e.points,l=e.options,p=e.graph,u={options:{gapSize:l.gapSize}},h=[],d=n(e,t),c=r.length,m;if(d.forEach((e,t)=>{for(h[t]=[];c--;)m=r[c],h[t].push({x:m.x,plotX:m.plotX,plotY:m[e],isNull:!g(m[e])});c=r.length}),e.userOptions.fillColor&&a.length){let t=h[d.indexOf(i(a[0]))],s=1===a.length?r:h[d.indexOf(i(a[1]))],o=e.color;e.points=s,e.nextPoints=t,e.color=e.userOptions.fillColor,e.options=S(r,u),e.graph=e.area,e.fillGraph=!0,N.drawGraph.call(e),e.area=e.graph,delete e.nextPoints,delete e.fillGraph,e.color=o}s.forEach((t,s)=>{h[s]?(e.points=h[s],l[t]?e.options=S(l[t].styles,u):(0,o.error)('Error: "There is no '+t+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names."'),e.graph=e["graph"+t],N.drawGraph.call(e),e["graph"+t]=e.graph):(0,o.error)('Error: "'+t+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),e.points=r,e.options=l,e.graph=p,N.drawGraph.call(e)}function l(e){let t,s=[],a=[];if(e=e||this.points,this.fillGraph&&this.nextPoints){if((t=N.getGraphPath.call(this,this.nextPoints))&&t.length){t[0][0]="L",s=N.getGraphPath.call(this,e),a=t.slice(0,s.length);for(let e=a.length-1;e>=0;e--)s.push(a[e])}}else s=N.getGraphPath.apply(this,arguments);return s}function p(e){let t=[];return(this.pointArrayMap||[]).forEach(s=>{t.push(e[s])}),t}function u(){let e=this.pointArrayMap,t=[],s;t=n(this),N.translate.apply(this,arguments),this.points.forEach(a=>{e.forEach((e,o)=>{s=a[e],this.dataModify&&(s=this.dataModify.modifyValue(s)),null!==s&&(a[t[o]]=this.yAxis.toPixels(s,!0))})})}e.compose=function(e){let o=e.prototype;return o.linesApiNames=o.linesApiNames||t.slice(),o.pointArrayMap=o.pointArrayMap||s.slice(),o.pointValKey=o.pointValKey||"top",o.areaLinesNames=o.areaLinesNames||a.slice(),o.drawGraph=r,o.getGraphPath=l,o.toYData=p,o.translate=u,e}}(s||(s={}));let B=s,{sma:G}=p().seriesTypes;function W(e,t){let s=e[0],a=0,o;for(o=1;o<e.length;o++)("max"===t&&e[o]>=s||"min"===t&&e[o]<=s)&&(s=e[o],a=o);return a}class z extends G{getValues(e,t){let s,a,o,i,n,r=t.period,l=e.xData,p=e.yData,u=p?p.length:0,h=[],d=[],c=[];for(i=r-1;i<u;i++)o=W((n=p.slice(i-r+1,i+2)).map(function(e){return T(e[2],e)}),"min"),s=W(n.map(function(e){return T(e[1],e)}),"max")/r*100,a=o/r*100,l[i+1]&&(h.push([l[i+1],s,a]),d.push(l[i+1]),c.push([s,a]));return{values:h,xData:d,yData:c}}}z.defaultOptions=S(G.defaultOptions,{params:{index:void 0,period:25},marker:{enabled:!1},tooltip:{pointFormat:'<span style="color:{point.color}">●</span><b> {series.name}</b><br/>Aroon Up: {point.y}<br/>Aroon Down: {point.aroonDown}<br/>'},aroonDown:{styles:{lineWidth:1,lineColor:void 0}},dataGrouping:{approximation:"averages"}}),y(z.prototype,{areaLinesNames:[],linesApiNames:["aroonDown"],nameBase:"Aroon",pointArrayMap:["y","aroonDown"],pointValKey:"y"}),B.compose(z),p().registerSeriesType("aroon",z);let{aroon:Y}=p().seriesTypes;class X extends Y{getValues(e,t){let s,a,o=[],i=[],n=[],r=super.getValues.call(this,e,t);for(a=0;a<r.yData.length;a++)s=r.yData[a][0]-r.yData[a][1],o.push([r.xData[a],s]),i.push(r.xData[a]),n.push(s);return{values:o,xData:i,yData:n}}}X.defaultOptions=S(Y.defaultOptions,{tooltip:{pointFormat:'<span style="color:{point.color}">●</span><b> {series.name}</b>: {point.y}'}}),y(X.prototype,{nameBase:"Aroon Oscillator",linesApiNames:[],pointArrayMap:["y"],pointValKey:"y"}),B.compose(Y),p().registerSeriesType("aroonoscillator",X);let{sma:F}=p().seriesTypes;function R(e,t){return Math.max(e[1]-e[2],void 0===t?0:Math.abs(e[1]-t[3]),void 0===t?0:Math.abs(e[2]-t[3]))}class K extends F{getValues(e,t){let s=t.period,a=e.xData,o=e.yData,i=o?o.length:0,n=[[a[0],o[0]]],r=[],l=[],p=[],u,h,d=0,c=1,m=0;if(!(a.length<=s)&&v(o[0])&&4===o[0].length){for(h=1;h<=i;h++){var g,y,f,x,D;!function(e,t,s,a){let o=t[a],i=s[a];e.push([o,i])}(n,a,o,h),s<c?(d=(g=a,y=o,f=h,x=s,D=d,u=[g[f-1],(D*(x-1)+R(y[f-1],y[f-2]))/x])[1],r.push(u),l.push(u[0]),p.push(u[1])):(s===c?(d=m/(h-1),r.push([a[h-1],d]),l.push(a[h-1]),p.push(d)):m+=R(o[h-1],o[h-2]),c++)}return{values:r,xData:l,yData:p}}}}K.defaultOptions=S(F.defaultOptions,{params:{index:void 0}}),p().registerSeriesType("atr",K);let{sma:j}=p().seriesTypes;class U extends j{init(){p().seriesTypes.sma.prototype.init.apply(this,arguments),this.options=S({topLine:{styles:{lineColor:this.color}},bottomLine:{styles:{lineColor:this.color}}},this.options)}getValues(e,t){let s,a,o,i,n,r,l,u,h,d=t.period,c=t.standardDeviation,m=[],g=[],y=e.xData,f=e.yData,x=f?f.length:0,D=[];if(y.length<d)return;let S=v(f[0]);for(h=d;h<=x;h++)n=y.slice(h-d,h),r=f.slice(h-d,h),i=(u=p().seriesTypes.sma.prototype.getValues.call(this,{xData:n,yData:r},t)).xData[0],s=u.yData[0],l=function(e,t,s,a){let o=e.length,i=0,n,r=0;for(;i<o;i++)r+=(n=(s?e[i][t]:e[i])-a)*n;return Math.sqrt(r/=o-1)}(r,t.index,S,s),a=s+c*l,o=s-c*l,D.push([i,a,s,o]),m.push(i),g.push([a,s,o]);return{values:D,xData:m,yData:g}}}U.defaultOptions=S(j.defaultOptions,{params:{period:20,standardDeviation:2,index:3},bottomLine:{styles:{lineWidth:1,lineColor:void 0}},topLine:{styles:{lineWidth:1,lineColor:void 0}},tooltip:{pointFormat:'<span style="color:{point.color}">●</span><b> {series.name}</b><br/>Top: {point.top}<br/>Middle: {point.middle}<br/>Bottom: {point.bottom}<br/>'},marker:{enabled:!1},dataGrouping:{approximation:"averages"}}),y(U.prototype,{areaLinesNames:["top","bottom"],linesApiNames:["topLine","bottomLine"],nameComponents:["period","standardDeviation"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"}),B.compose(U),p().registerSeriesType("bb",U);let{sma:Z}=p().seriesTypes;class _ extends Z{getValues(e,t){let s=t.period,a=e.xData,o=e.yData,i=o?o.length:0,n=[],r=[],l=[],p=[],u,h,d=[],c,m=1,g,y,f,x;if(!(a.length<=s)&&v(o[0])&&4===o[0].length){for(;m<s;)h=o[m-1],n.push((h[1]+h[2]+h[3])/3),m++;for(x=s;x<=i;x++)y=((h=o[x-1])[1]+h[2]+h[3])/3,c=n.push(y),g=(d=n.slice(c-s)).reduce(function(e,t){return e+t},0)/s,f=function(e,t){let s=e.length,a=0,o;for(o=0;o<s;o++)a+=Math.abs(t-e[o]);return a}(d,g)/s,u=(y-g)/(.015*f),r.push([a[x-1],u]),l.push(a[x-1]),p.push(u);return{values:r,xData:l,yData:p}}}}_.defaultOptions=S(Z.defaultOptions,{params:{index:void 0}}),p().registerSeriesType("cci",_);let{sma:q}=p().seriesTypes;class H extends q{constructor(){super(...arguments),this.nameBase="Chaikin Money Flow"}isValid(){let e=this.chart,t=this.options,s=this.linkedParent,a=this.volumeSeries||(this.volumeSeries=e.get(t.params.volumeSeriesID)),o=s?.pointArrayMap?.length===4;function i(e){return e.dataTable.rowCount>=t.params.period}return!!(s&&a&&i(s)&&i(a)&&o)}getValues(e,t){if(this.isValid())return this.getMoneyFlow(e.xData,e.yData,this.volumeSeries.getColumn("y"),t.period)}getMoneyFlow(e,t,s,a){let o=t.length,i=[],n=[],r=[],l=[],p,u,h=-1,d=0,c=0;function m(e,t){let s=e[1],a=e[2],o=e[3];return null!==t&&null!==s&&null!==a&&null!==o&&s!==a?(o-a-(s-o))/(s-a)*t:(h=p,null)}if(a>0&&a<=o){for(p=0;p<a;p++)i[p]=m(t[p],s[p]),d+=s[p],c+=i[p];for(n.push(e[p-1]),r.push(p-h>=a&&0!==d?c/d:null),l.push([n[0],r[0]]);p<o;p++)i[p]=m(t[p],s[p]),d-=s[p-a],d+=s[p],c-=i[p-a],c+=i[p],u=[e[p],p-h>=a?c/d:null],n.push(u[0]),r.push(u[1]),l.push([u[0],u[1]])}return{values:l,xData:n,yData:r}}}H.defaultOptions=S(q.defaultOptions,{params:{index:void 0,volumeSeriesID:"volume"}}),p().registerSeriesType("cmf",H);let{sma:$}=p().seriesTypes;class J extends ${calculateDM(e,t,s){let a=e[t][1],o=e[t][2],i=e[t-1][1],n=e[t-1][2];return m(a-i>n-o?s?Math.max(a-i,0):0:s?0:Math.max(n-o,0))}calculateDI(e,t){return e/t*100}calculateDX(e,t){return m(Math.abs(e-t)/Math.abs(e+t)*100)}smoothValues(e,t,s){return m(e-e/s+t)}getTR(e,t){return m(Math.max(e[1]-e[2],t?Math.abs(e[1]-t[3]):0,t?Math.abs(e[2]-t[3]):0))}getValues(e,t){let s=t.period,a=e.xData,o=e.yData,i=o?o.length:0,n=[],r=[],l=[];if(a.length<=s||!v(o[0])||4!==o[0].length)return;let p=0,u=0,h=0,d;for(d=1;d<i;d++){let e,t,i,c,m,g,y,f,x;d<=s?(c=this.calculateDM(o,d,!0),m=this.calculateDM(o,d),g=this.getTR(o[d],o[d-1]),p+=c,u+=m,h+=g,d===s&&(y=this.calculateDI(p,h),f=this.calculateDI(u,h),x=this.calculateDX(p,u),n.push([a[d],x,y,f]),r.push(a[d]),l.push([x,y,f]))):(c=this.calculateDM(o,d,!0),m=this.calculateDM(o,d),g=this.getTR(o[d],o[d-1]),e=this.smoothValues(p,c,s),t=this.smoothValues(u,m,s),i=this.smoothValues(h,g,s),p=e,u=t,h=i,y=this.calculateDI(p,h),f=this.calculateDI(u,h),x=this.calculateDX(p,u),n.push([a[d],x,y,f]),r.push(a[d]),l.push([x,y,f]))}return{values:n,xData:r,yData:l}}}J.defaultOptions=S($.defaultOptions,{params:{index:void 0},marker:{enabled:!1},tooltip:{pointFormat:'<span style="color: {point.color}">●</span><b> {series.name}</b><br/><span style="color: {point.color}">DX</span>: {point.y}<br/><span style="color: {point.series.options.plusDILine.styles.lineColor}">+DI</span>: {point.plusDI}<br/><span style="color: {point.series.options.minusDILine.styles.lineColor}">-DI</span>: {point.minusDI}<br/>'},plusDILine:{styles:{lineWidth:1,lineColor:"#06b535"}},minusDILine:{styles:{lineWidth:1,lineColor:"#f21313"}},dataGrouping:{approximation:"averages"}}),y(J.prototype,{areaLinesNames:[],nameBase:"DMI",linesApiNames:["plusDILine","minusDILine"],pointArrayMap:["y","plusDI","minusDI"],parallelArrays:["x","y","plusDI","minusDI"],pointValKey:"y"}),B.compose(J),p().registerSeriesType("dmi",J);let{sma:Q}=p().seriesTypes;function ee(e,t,s,a,o){let i=T(t[s][a],t[s]);return o?m(e-i):m(e+i)}class et extends Q{getValues(e,t){let s=t.period,a=t.index,o=Math.floor(s/2+1),i=s+o,n=e.xData||[],r=e.yData||[],l=r.length,p=[],u=[],h=[],d,c,m,g,y,f=0;if(!(n.length<=i)){for(g=0;g<s-1;g++)f=ee(f,r,g,a);for(y=0;y<=l-i;y++)c=y+s-1,m=y+i-1,f=ee(f,r,c,a),d=T(r[m][a],r[m])-f/s,f=ee(f,r,y,a,!0),p.push([n[m],d]),u.push(n[m]),h.push(d);return{values:p,xData:u,yData:h}}}}et.defaultOptions=S(Q.defaultOptions,{params:{index:0,period:21}}),y(et.prototype,{nameBase:"DPO"}),p().registerSeriesType("dpo",et);let{ema:es}=p().seriesTypes;class ea extends es{getValues(e,t){let s,a,i=t.periods,n=t.period,r=[],l=[],p=[];if(2!==i.length||i[1]<=i[0])return void(0,o.error)('Error: "Chaikin requires two periods. Notice, first period should be lower than the second one."');let u=L.prototype.getValues.call(this,e,{volumeSeriesID:t.volumeSeriesID,period:n});if(!u)return;let h=super.getValues.call(this,u,{period:i[0]}),d=super.getValues.call(this,u,{period:i[1]});if(!h||!d)return;let c=i[1]-i[0];for(a=0;a<d.yData.length;a++)s=m(h.yData[a+c]-d.yData[a]),r.push([d.xData[a],s]),l.push(d.xData[a]),p.push(s);return{values:r,xData:l,yData:p}}}ea.defaultOptions=S(es.defaultOptions,{params:{index:void 0,volumeSeriesID:"volume",period:9,periods:[3,10]}}),y(ea.prototype,{nameBase:"Chaikin Osc",nameComponents:["periods"]}),p().registerSeriesType("chaikin",ea);let{sma:eo}=p().seriesTypes;class ei extends eo{getValues(e,t){let s=t.period,a=e.xData,o=e.yData,i=o?o.length:0,n=[],r=[],l=[],p,u=t.index,h;if(a.length<s)return;x(o[0])?h=o:(u=Math.min(u,o[0].length-1),h=o.map(e=>e[u]));let d=0,c=0,m=0,g;for(let e=s;e>0;e--)h[e]>h[e-1]?c+=h[e]-h[e-1]:h[e]<h[e-1]&&(m+=h[e-1]-h[e]);for(g=c+m>0?100*(c-m)/(c+m):0,r.push(a[s]),l.push(g),n.push([a[s],g]),p=s+1;p<i;p++)d=Math.abs(h[p-s-1]-h[p-s]),h[p]>h[p-1]?c+=h[p]-h[p-1]:h[p]<h[p-1]&&(m+=h[p-1]-h[p]),h[p-s]>h[p-s-1]?c-=d:m-=d,g=c+m>0?100*(c-m)/(c+m):0,r.push(a[p]),l.push(g),n.push([a[p],g]);return{values:n,xData:r,yData:l}}}ei.defaultOptions=S(eo.defaultOptions,{params:{period:20,index:3}}),p().registerSeriesType("cmo",ei);let{ema:en}=p().seriesTypes;class er extends en{getEMA(e,t,s,a,o,i){return super.calculateEma(i||[],e,void 0===o?1:o,this.EMApercent,t,void 0===a?-1:a,s)}getValues(e,t){let s=t.period,a=[],o=2*s,i=e.xData,n=e.yData,r=n?n.length:0,l=[],p=[],u=[],h=0,d=0,c,g,y,f,x=-1,D,S=0;if(this.EMApercent=2/(s+1),!(r<2*s-1)){for(v(n[0])&&(x=t.index?t.index:0),S=(h=super.accumulatePeriodPoints(s,x,n))/s,h=0,f=s;f<r+2;f++)f<r+1&&(d=this.getEMA(n,g,S,x,f)[1],a.push(d)),g=d,f<o?h+=d:(f===o&&(S=h/s),d=a[f-s-1],c=this.getEMA([d],y,S)[1],D=[i[f-2],m(2*d-c)],l.push(D),p.push(D[0]),u.push(D[1]),y=c);return{values:l,xData:p,yData:u}}}}er.defaultOptions=S(en.defaultOptions),p().registerSeriesType("dema",er);let{ema:el}=p().seriesTypes;class ep extends el{getEMA(e,t,s,a,o,i){return super.calculateEma(i||[],e,void 0===o?1:o,this.EMApercent,t,void 0===a?-1:a,s)}getTemaPoint(e,t,s,a){return[e[a-3],m(3*s.level1-3*s.level2+s.level3)]}getValues(e,t){let s=t.period,a=2*s,o=3*s,i=e.xData,n=e.yData,r=n?n.length:0,l=[],p=[],u=[],h=[],d=[],c={},m=-1,g=0,y=0,f,x,D,S;if(this.EMApercent=2/(s+1),!(r<3*s-2)){for(v(n[0])&&(m=t.index?t.index:0),y=(g=super.accumulatePeriodPoints(s,m,n))/s,g=0,D=s;D<r+3;D++)D<r+1&&(c.level1=this.getEMA(n,f,y,m,D)[1],h.push(c.level1)),f=c.level1,D<a?g+=c.level1:(D===a&&(y=g/s,g=0),c.level1=h[D-s-1],c.level2=this.getEMA([c.level1],x,y)[1],d.push(c.level2),x=c.level2,D<o?g+=c.level2:(D===o&&(y=g/s),D===r+1&&(c.level1=h[D-s-1],c.level2=this.getEMA([c.level1],x,y)[1],d.push(c.level2)),c.level1=h[D-s-2],c.level2=d[D-2*s-1],c.level3=this.getEMA([c.level2],c.prevLevel3,y)[1],(S=this.getTemaPoint(i,o,c,D))&&(l.push(S),p.push(S[0]),u.push(S[1])),c.prevLevel3=c.level3));return{values:l,xData:p,yData:u}}}}ep.defaultOptions=S(el.defaultOptions),p().registerSeriesType("tema",ep);let{tema:eu}=p().seriesTypes;class eh extends eu{getTemaPoint(e,t,s,a){if(a>t)return[e[a-3],0!==s.prevLevel3?m(s.level3-s.prevLevel3)/s.prevLevel3*100:null]}}eh.defaultOptions=S(eu.defaultOptions),p().registerSeriesType("trix",eh);let{ema:ed}=p().seriesTypes;class ec extends ed{getValues(e,t){let s,a,i=t.periods,n=t.index,r=[],l=[],p=[];if(2!==i.length||i[1]<=i[0])return void(0,o.error)('Error: "APO requires two periods. Notice, first period should be lower than the second one."');let u=super.getValues.call(this,e,{index:n,period:i[0]}),h=super.getValues.call(this,e,{index:n,period:i[1]});if(!u||!h)return;let d=i[1]-i[0];for(a=0;a<h.yData.length;a++)s=u.yData[a+d]-h.yData[a],r.push([h.xData[a],s]),l.push(h.xData[a]),p.push(s);return{values:r,xData:l,yData:p}}}ec.defaultOptions=S(ed.defaultOptions,{params:{period:void 0,periods:[10,20]}}),y(ec.prototype,{nameBase:"APO",nameComponents:["periods"]}),p().registerSeriesType("apo",ec);let em=t.default.dataGrouping.approximations;var eg=a.n(em);let ey=e.default.Color,{parse:ef}=a.n(ey)(),{sma:ex}=p().seriesTypes;function ev(e){return{high:e.reduce(function(e,t){return Math.max(e,t[1])},-1/0),low:e.reduce(function(e,t){return Math.min(e,t[2])},1/0)}}function eD(e){let t=e.indicator;t.points=e.points,t.nextPoints=e.nextPoints,t.color=e.color,t.options=S(e.options.senkouSpan.styles,e.gap),t.graph=e.graph,t.fillGraph=!0,p().seriesTypes.sma.prototype.drawGraph.call(t)}class eS extends ex{constructor(){super(...arguments),this.data=[],this.options={},this.points=[],this.graphCollection=[]}init(){super.init.apply(this,arguments),this.options=S({tenkanLine:{styles:{lineColor:this.color}},kijunLine:{styles:{lineColor:this.color}},chikouLine:{styles:{lineColor:this.color}},senkouSpanA:{styles:{lineColor:this.color,fill:ef(this.color).setOpacity(.5).get()}},senkouSpanB:{styles:{lineColor:this.color,fill:ef(this.color).setOpacity(.5).get()}},senkouSpan:{styles:{fill:ef(this.color).setOpacity(.2).get()}}},this.options)}toYData(e){return[e.tenkanSen,e.kijunSen,e.chikouSpan,e.senkouSpanA,e.senkouSpanB]}translate(){for(let e of(p().seriesTypes.sma.prototype.translate.apply(this),this.points))for(let t of this.pointArrayMap){let s=e[t];x(s)&&(e["plot"+t]=this.yAxis.toPixels(s,!0),e.plotY=e["plot"+t],e.tooltipPos=[e.plotX,e["plot"+t]],e.isNull=!1)}}drawGraph(){let e=this,t=e.points,s=e.options,a=e.graph,o=e.color,i={options:{gapSize:s.gapSize}},n=e.pointArrayMap.length,r=[[],[],[],[],[],[]],l={tenkanLine:r[0],kijunLine:r[1],chikouLine:r[2],senkouSpanA:r[3],senkouSpanB:r[4],senkouSpan:r[5]},u=[],h=e.options.senkouSpan,d=h.color||h.styles.fill,c=h.negativeColor,m=[[],[]],y=[[],[]],f=t.length,x=0,v,D,T,C,A,P,M,O,V,L,k,E,w;for(e.ikhMap=l;f--;){for(T=0,D=t[f];T<n;T++)g(D[v=e.pointArrayMap[T]])&&r[T].push({plotX:D.plotX,plotY:D["plot"+v],isNull:!1});if(c&&f!==t.length-1){let e=l.senkouSpanB.length-1,t=function(e,t,s,a){if(e&&t&&s&&a){let o=t.plotX-e.plotX,i=t.plotY-e.plotY,n=a.plotX-s.plotX,r=a.plotY-s.plotY,l=e.plotX-s.plotX,p=e.plotY-s.plotY,u=(-i*l+o*p)/(-n*i+o*r),h=(n*p-r*l)/(-n*i+o*r);if(u>=0&&u<=1&&h>=0&&h<=1)return{plotX:e.plotX+h*o,plotY:e.plotY+h*i}}}(l.senkouSpanA[e-1],l.senkouSpanA[e],l.senkouSpanB[e-1],l.senkouSpanB[e]);if(t){let s={plotX:t.plotX,plotY:t.plotY,isNull:!1,intersectPoint:!0};l.senkouSpanA.splice(e,0,s),l.senkouSpanB.splice(e,0,s),u.push(e)}}}if(b(l,(t,a)=>{s[a]&&"senkouSpan"!==a&&(e.points=r[x],e.options=S(s[a].styles,i),e.graph=e["graph"+a],e.fillGraph=!1,e.color=o,p().seriesTypes.sma.prototype.drawGraph.call(e),e["graph"+a]=e.graph),x++}),e.graphCollection)for(let t of e.graphCollection)e[t].destroy(),delete e[t];if(e.graphCollection=[],c&&l.senkouSpanA[0]&&l.senkouSpanB[0]){for(u.unshift(0),u.push(l.senkouSpanA.length-1),E=0;E<u.length-1;E++)if(C=u[E],A=u[E+1],P=l.senkouSpanB.slice(C,A+1),M=l.senkouSpanA.slice(C,A+1),Math.floor(P.length/2)>=1){let e=Math.floor(P.length/2);if(P[e].plotY===M[e].plotY){for(w=0,O=0,V=0;w<P.length;w++)O+=P[w].plotY,V+=M[w].plotY;m[k=O>V?0:1]=m[k].concat(P),y[k]=y[k].concat(M)}else m[k=P[e].plotY>M[e].plotY?0:1]=m[k].concat(P),y[k]=y[k].concat(M)}else m[k=P[0].plotY>M[0].plotY?0:1]=m[k].concat(P),y[k]=y[k].concat(M);["graphsenkouSpanColor","graphsenkouSpanNegativeColor"].forEach(function(t,a){m[a].length&&y[a].length&&(L=0===a?d:c,eD({indicator:e,points:m[a],nextPoints:y[a],color:L,options:s,gap:i,graph:e[t]}),e[t]=e.graph,e.graphCollection.push(t))})}else eD({indicator:e,points:l.senkouSpanB,nextPoints:l.senkouSpanA,color:d,options:s,gap:i,graph:e.graphsenkouSpan}),e.graphsenkouSpan=e.graph;delete e.nextPoints,delete e.fillGraph,e.points=t,e.options=s,e.graph=a,e.color=o}getGraphPath(e){let t=[],s,a=[];if(e=e||this.points,this.fillGraph&&this.nextPoints){if((s=p().seriesTypes.sma.prototype.getGraphPath.call(this,this.nextPoints))&&s.length){s[0][0]="L",t=p().seriesTypes.sma.prototype.getGraphPath.call(this,e),a=s.slice(0,t.length);for(let e=a.length-1;e>=0;e--)t.push(a[e])}}else t=p().seriesTypes.sma.prototype.getGraphPath.apply(this,arguments);return t}getValues(e,t){var s,a;let o,i,n,r,l,p,u,h,d,c,m,g,y,f,x,D=t.period,S=t.periodTenkan,b=t.periodSenkouSpanB,T=e.xData,C=e.yData,A=e.xAxis,P=C&&C.length||0,M=(s=A.series.map(e=>e.getColumn("x")),x=!a,s.forEach(e=>{if(e.length>1)for(f=g=e.length-1;f>0;f--)(y=e[f]-e[f-1])<0&&!x?(a?.(),a=void 0):y&&(void 0===m||y<m)&&(m=y)}),m),O=[],V=[];if(T.length<=D||!v(C[0])||4!==C[0].length)return;let L=T[0]-D*M;for(l=0;l<D;l++)V.push(L+l*M);for(l=0;l<P;l++)l>=S&&(p=((i=ev(C.slice(l-S,l))).high+i.low)/2),l>=D&&(d=(p+(u=((n=ev(C.slice(l-D,l))).high+n.low)/2))/2),l>=b&&(c=((r=ev(C.slice(l-b,l))).high+r.low)/2),h=C[l][3],o=T[l],void 0===O[l]&&(O[l]=[]),void 0===O[l+D-1]&&(O[l+D-1]=[]),O[l+D-1][0]=p,O[l+D-1][1]=u,O[l+D-1][2]=void 0,void 0===O[l+1]&&(O[l+1]=[]),O[l+1][2]=h,l<=D&&(O[l+D-1][3]=void 0,O[l+D-1][4]=void 0),void 0===O[l+2*D-2]&&(O[l+2*D-2]=[]),O[l+2*D-2][3]=d,O[l+2*D-2][4]=c,V.push(o);for(l=1;l<=D;l++)V.push(o+l*M);return{values:O,xData:V,yData:O}}}eS.defaultOptions=S(ex.defaultOptions,{params:{index:void 0,period:26,periodTenkan:9,periodSenkouSpanB:52},marker:{enabled:!1},tooltip:{pointFormat:'<span style="color:{point.color}">●</span> <b> {series.name}</b><br/>TENKAN SEN: {point.tenkanSen:.3f}<br/>KIJUN SEN: {point.kijunSen:.3f}<br/>CHIKOU SPAN: {point.chikouSpan:.3f}<br/>SENKOU SPAN A: {point.senkouSpanA:.3f}<br/>SENKOU SPAN B: {point.senkouSpanB:.3f}<br/>'},tenkanLine:{styles:{lineWidth:1,lineColor:void 0}},kijunLine:{styles:{lineWidth:1,lineColor:void 0}},chikouLine:{styles:{lineWidth:1,lineColor:void 0}},senkouSpanA:{styles:{lineWidth:1,lineColor:void 0}},senkouSpanB:{styles:{lineWidth:1,lineColor:void 0}},senkouSpan:{styles:{fill:"rgba(255, 0, 0, 0.5)"}},dataGrouping:{approximation:"ichimoku-averages"}}),y(eS.prototype,{pointArrayMap:["tenkanSen","kijunSen","chikouSpan","senkouSpanA","senkouSpanB"],pointValKey:"tenkanSen",nameComponents:["periodSenkouSpanB","period","periodTenkan"]}),eg()["ichimoku-averages"]=function(){let e,t=[];return[].forEach.call(arguments,function(s,a){t.push(eg().average(s)),e=!e&&void 0===t[a]}),e?void 0:t},p().registerSeriesType("ikh",eS);let{sma:eb}=p().seriesTypes;class eT extends eb{init(){p().seriesTypes.sma.prototype.init.apply(this,arguments),this.options=S({topLine:{styles:{lineColor:this.color}},bottomLine:{styles:{lineColor:this.color}}},this.options)}getValues(e,t){let s,a,o,i,n,r,l,u=t.period,h=t.periodATR,d=t.multiplierATR,c=t.index,g=e.yData,y=g?g.length:0,f=[],x=p().seriesTypes.ema.prototype.getValues(e,{period:u,index:c}),v=p().seriesTypes.atr.prototype.getValues(e,{period:h}),D=[],S=[];if(!(y<u)){for(l=u;l<=y;l++)n=x.values[l-u],r=v.values[l-h],i=n[0],a=m(n[1]+d*r[1]),o=m(n[1]-d*r[1]),s=n[1],f.push([i,a,s,o]),D.push(i),S.push([a,s,o]);return{values:f,xData:D,yData:S}}}}eT.defaultOptions=S(eb.defaultOptions,{params:{index:0,period:20,periodATR:10,multiplierATR:2},bottomLine:{styles:{lineWidth:1,lineColor:void 0}},topLine:{styles:{lineWidth:1,lineColor:void 0}},tooltip:{pointFormat:'<span style="color:{point.color}">●</span><b> {series.name}</b><br/>Upper Channel: {point.top}<br/>EMA({series.options.params.period}): {point.middle}<br/>Lower Channel: {point.bottom}<br/>'},marker:{enabled:!1},dataGrouping:{approximation:"averages"},lineWidth:1}),y(eT.prototype,{nameBase:"Keltner Channels",areaLinesNames:["top","bottom"],nameComponents:["period","periodATR","multiplierATR"],linesApiNames:["topLine","bottomLine"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"}),B.compose(eT),p().registerSeriesType("keltnerchannels",eT);let{ema:eC,sma:eA}=p().seriesTypes;class eP extends eA{calculateTrend(e,t){return e[t][1]+e[t][2]+e[t][3]>e[t-1][1]+e[t-1][2]+e[t-1][3]?1:-1}isValidData(e){let t=this.chart,s=this.options,a=this.linkedParent,i=v(e)&&4===e.length,n=this.volumeSeries||(this.volumeSeries=t.get(s.params.volumeSeriesID));return n||(0,o.error)("Series "+s.params.volumeSeriesID+" not found! Check `volumeSeriesID`.",!0,a.chart),!!([a,n].every(function(e){return e&&e.dataTable.rowCount>=s.params.slowAvgPeriod})&&i)}getCM(e,t,s,a,o){return m(t+(s===a?e:o))}getDM(e,t){return m(e-t)}getVolumeForce(e){let t=[],s=0,a,o=1,i=0,n=e[0][1]-e[0][2],r=0,l;for(;o<e.length;o++)l=this.calculateTrend(e,o),a=this.getDM(e[o][1],e[o][2]),s=this.getCM(i,a,l,r,n),t.push([this.volumeSeries.getColumn("y")[o]*l*Math.abs(2*(a/s-1))*100]),r=l,i=s,n=a;return t}getEMA(e,t,s,a,o,i,n){return eC.prototype.calculateEma(n||[],e,void 0===i?1:i,a,t,void 0===o?-1:o,s)}getSMA(e,t,s){return eC.prototype.accumulatePeriodPoints(e,t,s)/e}getValues(e,t){let s=[],a=e.xData,o=e.yData,i=[],n=[],r=[],l,p=0,u=0,h,d,c,g=null;if(!this.isValidData(o[0]))return;let y=this.getVolumeForce(o),f=this.getSMA(t.fastAvgPeriod,0,y),x=this.getSMA(t.slowAvgPeriod,0,y),v=2/(t.fastAvgPeriod+1),D=2/(t.slowAvgPeriod+1);for(;p<o.length;p++)p>=t.fastAvgPeriod&&(d=u=this.getEMA(y,d,f,v,0,p,a)[1]),p>=t.slowAvgPeriod&&(c=h=this.getEMA(y,c,x,D,0,p,a)[1],r.push(l=m(u-h)),r.length>=t.signalPeriod&&(g=r.slice(-t.signalPeriod).reduce((e,t)=>e+t)/t.signalPeriod),s.push([a[p],l,g]),i.push(a[p]),n.push([l,g]));return{values:s,xData:i,yData:n}}}eP.defaultOptions=S(eA.defaultOptions,{params:{fastAvgPeriod:34,slowAvgPeriod:55,signalPeriod:13,volumeSeriesID:"volume"},signalLine:{styles:{lineWidth:1,lineColor:"#ff0000"}},dataGrouping:{approximation:"averages"},tooltip:{pointFormat:'<span style="color: {point.color}">●</span><b> {series.name}</b><br/><span style="color: {point.color}">Klinger</span>: {point.y}<br/><span style="color: {point.series.options.signalLine.styles.lineColor}">Signal</span>: {point.signal}<br/>'}}),y(eP.prototype,{areaLinesNames:[],linesApiNames:["signalLine"],nameBase:"Klinger",nameComponents:["fastAvgPeriod","slowAvgPeriod"],pointArrayMap:["y","signal"],parallelArrays:["x","y","signal"],pointValKey:"y"}),B.compose(eP),p().registerSeriesType("klinger",eP);let{noop:eM}=i(),{sma:eO}=p().seriesTypes;class eV extends eO{init(){p().seriesTypes.sma.prototype.init.apply(this,arguments);let e=this.color,t=this.colorIndex;this.options&&(g(this.colorIndex)&&(this.options.signalLine?.styles&&!this.options.signalLine.styles.lineColor&&(this.options.colorIndex=this.colorIndex+1,this.getCyclic("color",void 0,this.chart.options.colors),this.options.signalLine.styles.lineColor=this.color),this.options.macdLine?.styles&&!this.options.macdLine.styles.lineColor&&(this.options.colorIndex=this.colorIndex+1,this.getCyclic("color",void 0,this.chart.options.colors),this.options.macdLine.styles.lineColor=this.color)),this.macdZones={zones:this.options.macdLine?.zones,startIndex:0},this.signalZones={zones:this.macdZones.zones?.concat(this.options.signalLine.zones),startIndex:this.macdZones.zones?.length}),this.color=e,this.colorIndex=t}toYData(e){return[e.y,e.signal,e.MACD]}translate(){let e=this,t=["plotSignal","plotMACD"];i().seriesTypes.column.prototype.translate.apply(e),e.points.forEach(function(s){[s.signal,s.MACD].forEach(function(a,o){null!==a&&(s[t[o]]=e.yAxis.toPixels(a,!0))})})}destroy(){this.graph=null,this.graphmacd=this.graphmacd&&this.graphmacd.destroy(),this.graphsignal=this.graphsignal&&this.graphsignal.destroy(),p().seriesTypes.sma.prototype.destroy.apply(this,arguments)}drawGraph(){let e=this,t=e.points,s=e.options,a=e.zones,o={options:{gapSize:s.gapSize}},i=[[],[]],n,r=t.length;for(;r--;)g((n=t[r]).plotMACD)&&i[0].push({plotX:n.plotX,plotY:n.plotMACD,isNull:!g(n.plotMACD)}),g(n.plotSignal)&&i[1].push({plotX:n.plotX,plotY:n.plotSignal,isNull:!g(n.plotMACD)});["macd","signal"].forEach((t,a)=>{e.points=i[a],e.options=S(s[`${t}Line`]?.styles||{},o),e.graph=e[`graph${t}`],e.zones=(e[`${t}Zones`].zones||[]).slice(e[`${t}Zones`].startIndex||0),p().seriesTypes.sma.prototype.drawGraph.call(e),e[`graph${t}`]=e.graph}),e.points=t,e.options=s,e.zones=a}applyZones(){let e=this.zones;this.zones=this.signalZones.zones,p().seriesTypes.sma.prototype.applyZones.call(this),this.graphmacd&&this.options.macdLine.zones.length&&this.graphmacd.hide(),this.zones=e}getValues(e,t){let s=t.longPeriod-t.shortPeriod,a=[],o=[],i=[],n,r,l,u=0,h=[];if(!(e.xData.length<t.longPeriod+t.signalPeriod)){for(l=0,n=p().seriesTypes.ema.prototype.getValues(e,{period:t.shortPeriod,index:t.index}),r=p().seriesTypes.ema.prototype.getValues(e,{period:t.longPeriod,index:t.index}),n=n.values,r=r.values;l<=n.length;l++)g(r[l])&&g(r[l][1])&&g(n[l+s])&&g(n[l+s][0])&&a.push([n[l+s][0],0,null,n[l+s][1]-r[l][1]]);for(l=0;l<a.length;l++)o.push(a[l][0]),i.push([0,null,a[l][3]]);for(l=0,h=(h=p().seriesTypes.ema.prototype.getValues({xData:o,yData:i},{period:t.signalPeriod,index:2})).values;l<a.length;l++)a[l][0]>=h[0][0]&&(a[l][2]=h[u][1],i[l]=[0,h[u][1],a[l][3]],null===a[l][3]?(a[l][1]=0,i[l][0]=0):(a[l][1]=m(a[l][3]-h[u][1]),i[l][0]=m(a[l][3]-h[u][1])),u++);return{values:a,xData:o,yData:i}}}}eV.defaultOptions=S(eO.defaultOptions,{params:{shortPeriod:12,longPeriod:26,signalPeriod:9,period:26},signalLine:{zones:[],styles:{lineWidth:1,lineColor:void 0}},macdLine:{zones:[],styles:{lineWidth:1,lineColor:void 0}},threshold:0,groupPadding:.1,pointPadding:.1,crisp:!1,states:{hover:{halo:{size:0}}},tooltip:{pointFormat:'<span style="color:{point.color}">●</span> <b> {series.name}</b><br/>Value: {point.MACD}<br/>Signal: {point.signal}<br/>Histogram: {point.y}<br/>'},dataGrouping:{approximation:"averages"},minPointLength:0}),y(eV.prototype,{nameComponents:["longPeriod","shortPeriod","signalPeriod"],pointArrayMap:["y","signal","MACD"],parallelArrays:["x","y","signal","MACD"],pointValKey:"y",markerAttribs:eM,getColumnMetrics:i().seriesTypes.column.prototype.getColumnMetrics,crispCol:i().seriesTypes.column.prototype.crispCol,drawPoints:i().seriesTypes.column.prototype.drawPoints}),p().registerSeriesType("macd",eV);let{sma:eL}=p().seriesTypes;function ek(e){return e.reduce(function(e,t){return e+t})}function eE(e){return(e[1]+e[2]+e[3])/3}class ew extends eL{getValues(e,t){let s=t.period,a=e.xData,i=e.yData,n=i?i.length:0,r=t.decimals,l=e.chart.get(t.volumeSeriesID),p=l?.getColumn("y")||[],u=[],h=[],d=[],c=[],m=[],g,y,f,x,D,S,b=!1,T=1;if(!l)return void(0,o.error)("Series "+t.volumeSeriesID+" not found! Check `volumeSeriesID`.",!0,e.chart);if(!(a.length<=s)&&v(i[0])&&4===i[0].length&&p){for(g=eE(i[T]);T<s+1;)y=g,b=(g=eE(i[T]))>=y,f=g*p[T],c.push(b?f:0),m.push(b?0:f),T++;for(S=T-1;S<n;S++){var C;S>T-1&&(c.shift(),m.shift(),y=g,b=(g=eE(i[S]))>y,f=g*p[S],c.push(b?f:0),m.push(b?0:f)),x=ek(m),C=100-100/(1+ek(c)/x),D=parseFloat(C.toFixed(r)),u.push([a[S],D]),h.push(a[S]),d.push(D)}return{values:u,xData:h,yData:d}}}}ew.defaultOptions=S(eL.defaultOptions,{params:{index:void 0,volumeSeriesID:"volume",decimals:4}}),y(ew.prototype,{nameBase:"Money Flow Index"}),p().registerSeriesType("mfi",ew);let{sma:eI}=p().seriesTypes;function eN(e,t,s,a,o){let i=t[s-1][o]-t[s-a-1][o];return[e[s-1],i]}class eB extends eI{getValues(e,t){let s,a,o=t.period,i=t.index,n=e.xData,r=e.yData,l=r?r.length:0,p=[],u=[],h=[];if(!(n.length<=o)&&v(r[0])){for(s=o+1;s<l;s++)a=eN(n,r,s,o,i),p.push(a),u.push(a[0]),h.push(a[1]);return a=eN(n,r,s,o,i),p.push(a),u.push(a[0]),h.push(a[1]),{values:p,xData:u,yData:h}}}}eB.defaultOptions=S(eI.defaultOptions,{params:{index:3}}),y(eB.prototype,{nameBase:"Momentum"}),p().registerSeriesType("momentum",eB);let{atr:eG}=p().seriesTypes;class eW extends eG{getValues(e,t){let s=super.getValues.apply(this,arguments),a=s.values.length,o=e.yData,i=0,n=t.period-1;if(s){for(;i<a;i++)s.yData[i]=s.values[i][1]/o[n][3]*100,s.values[i][1]=s.yData[i],n++;return s}}}eW.defaultOptions=S(eG.defaultOptions,{tooltip:{valueSuffix:"%"}}),p().registerSeriesType("natr",eW);let{sma:ez}=p().seriesTypes;class eY extends ez{getValues(e,t){let s=e.chart.get(t.volumeSeriesID),a=e.xData,i=e.yData,n=[],r=[],l=[],p=!x(i[0]),u=[],h=1,d=0,c=0,m=0,g=0,y;if(!s)return void(0,o.error)("Series "+t.volumeSeriesID+" not found! Check `volumeSeriesID`.",!0,e.chart);for(y=s.getColumn("y"),u=[a[0],d],m=p?i[0][3]:i[0],n.push(u),r.push(a[0]),l.push(u[1]);h<i.length;h++)c=(g=p?i[h][3]:i[h])>m?d+y[h]:g===m?d:d-y[h],u=[a[h],c],d=c,m=g,n.push(u),r.push(a[h]),l.push(u[1]);return{values:n,xData:r,yData:l}}}eY.defaultOptions=S(ez.defaultOptions,{marker:{enabled:!1},params:{index:void 0,period:void 0,volumeSeriesID:"volume"},tooltip:{valueDecimals:0}}),y(eY.prototype,{nameComponents:void 0}),p().registerSeriesType("obv",eY);let eX=p().seriesTypes.sma.prototype.pointClass;function eF(e,t){let s=e.series.pointArrayMap,a,o=s.length;for(p().seriesTypes.sma.prototype.pointClass.prototype[t].call(e);o--;)e[a="dataLabel"+s[o]]&&e[a].element&&e[a].destroy(),e[a]=null}let{sma:eR}=p().seriesTypes;class eK extends eR{toYData(e){return[e.P]}translate(){let e=this;super.translate.apply(e),e.points.forEach(function(t){e.pointArrayMap.forEach(function(s){g(t[s])&&(t["plot"+s]=e.yAxis.toPixels(t[s],!0))})}),e.plotEndPoint=e.xAxis.toPixels(e.endPoint,!0)}getGraphPath(e){let t=this,s=[[],[],[],[],[],[],[],[],[]],a=t.pointArrayMap.length,o=t.plotEndPoint,i=[],n,r,l=e.length,p;for(;l--;){for(p=0,r=e[l];p<a;p++)g(r[n=t.pointArrayMap[p]])&&s[p].push({plotX:r.plotX,plotY:r["plot"+n],isNull:!1},{plotX:o,plotY:r["plot"+n],isNull:!1},{plotX:o,plotY:null,isNull:!0});o=r.plotX}return s.forEach(e=>{i=i.concat(super.getGraphPath.call(t,e))}),i}drawDataLabels(){let e,t,s,a,o=this,i=o.pointArrayMap;o.options.dataLabels.enabled&&(t=o.points.length,i.concat([!1]).forEach((n,r)=>{for(a=t;a--;)s=o.points[a],n?(s.y=s[n],s.pivotLine=n,s.plotY=s["plot"+n],e=s["dataLabel"+n],r&&(s["dataLabel"+i[r-1]]=s.dataLabel),s.dataLabels||(s.dataLabels=[]),s.dataLabels[0]=s.dataLabel=e=e&&e.element?e:null):s["dataLabel"+i[r-1]]=s.dataLabel;super.drawDataLabels.call(o)}))}getValues(e,t){let s,a,o,i,n,r,l,p=t.period,u=e.xData,h=e.yData,d=h?h.length:0,c=this[t.algorithm+"Placement"],m=[],g=[],y=[];if(!(u.length<p)&&v(h[0])&&4===h[0].length){for(l=p+1;l<=d+p;l+=p)o=u.slice(l-p-1,l),i=h.slice(l-p-1,l),a=o.length,s=o[a-1],r=c(this.getPivotAndHLC(i)),n=m.push([s].concat(r)),g.push(s),y.push(m[n-1].slice(1));return this.endPoint=o[0]+(s-o[0])/a*p,{values:m,xData:g,yData:y}}}getPivotAndHLC(e){let t=e[e.length-1][3],s=-1/0,a=1/0;return e.forEach(function(e){s=Math.max(s,e[1]),a=Math.min(a,e[2])}),[(s+a+t)/3,s,a,t]}standardPlacement(e){let t=e[1]-e[2];return[null,null,e[0]+t,2*e[0]-e[2],e[0],2*e[0]-e[1],e[0]-t,null,null]}camarillaPlacement(e){let t=e[1]-e[2];return[e[3]+1.5*t,e[3]+1.25*t,e[3]+1.1666*t,e[3]+1.0833*t,e[0],e[3]-1.0833*t,e[3]-1.1666*t,e[3]-1.25*t,e[3]-1.5*t]}fibonacciPlacement(e){let t=e[1]-e[2];return[null,e[0]+t,e[0]+.618*t,e[0]+.382*t,e[0],e[0]-.382*t,e[0]-.618*t,e[0]-t,null]}}eK.defaultOptions=S(eR.defaultOptions,{params:{index:void 0,period:28,algorithm:"standard"},marker:{enabled:!1},enableMouseTracking:!1,dataLabels:{enabled:!0,format:"{point.pivotLine}"},dataGrouping:{approximation:"averages"}}),y(eK.prototype,{nameBase:"Pivot Points",pointArrayMap:["R4","R3","R2","R1","P","S1","S2","S3","S4"],pointValKey:"P",pointClass:class extends eX{destroyElements(){eF(this,"destroyElements")}destroy(){eF(this,"destroyElements")}}}),p().registerSeriesType("pivotpoints",eK);let{ema:ej}=p().seriesTypes;class eU extends ej{getValues(e,t){let s,a,i=t.periods,n=t.index,r=[],l=[],p=[];if(2!==i.length||i[1]<=i[0])return void(0,o.error)('Error: "PPO requires two periods. Notice, first period should be lower than the second one."');let u=super.getValues.call(this,e,{index:n,period:i[0]}),h=super.getValues.call(this,e,{index:n,period:i[1]});if(!u||!h)return;let d=i[1]-i[0];for(a=0;a<h.yData.length;a++)s=m((u.yData[a+d]-h.yData[a])/h.yData[a]*100),r.push([h.xData[a],s]),l.push(h.xData[a]),p.push(s);return{values:r,xData:l,yData:p}}}eU.defaultOptions=S(ej.defaultOptions,{params:{period:void 0,periods:[12,26]}}),y(eU.prototype,{nameBase:"PPO",nameComponents:["periods"]}),p().registerSeriesType("ppo",eU);let eZ=function(e,t,s){return e.reduce((e,a)=>[Math.min(e[0],a[t]),Math.max(e[1],a[s])],[Number.MAX_VALUE,-Number.MAX_VALUE])},{sma:e_}=p().seriesTypes;class eq extends e_{getValues(e,t){let s,a,o,i,n,r,l=t.period,p=e.xData,u=e.yData,h=u?u.length:0,d=[],c=[],m=[];if(!(h<l)){for(r=l;r<=h;r++)i=p[r-1],s=((a=(n=eZ(u.slice(r-l,r),2,1))[1])+(o=n[0]))/2,d.push([i,a,s,o]),c.push(i),m.push([a,s,o]);return{values:d,xData:c,yData:m}}}}eq.defaultOptions=S(e_.defaultOptions,{params:{index:void 0,period:20},lineWidth:1,topLine:{styles:{lineColor:"#00e272",lineWidth:1}},bottomLine:{styles:{lineColor:"#feb56a",lineWidth:1}},dataGrouping:{approximation:"averages"}}),y(eq.prototype,{areaLinesNames:["top","bottom"],nameBase:"Price Channel",nameComponents:["period"],linesApiNames:["topLine","bottomLine"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"}),B.compose(eq),p().registerSeriesType("pc",eq);let{sma:eH}=p().seriesTypes;class e$ extends eH{init(){super.init.apply(this,arguments),this.options=S({topLine:{styles:{lineColor:this.color}},bottomLine:{styles:{lineColor:this.color}}},this.options)}getValues(e,t){let s,a,o,i,n,r,l,p,u=t.period,h=t.topBand,d=t.bottomBand,c=e.xData,m=e.yData,g=m?m.length:0,y=[],f=[],x=[];if(!(c.length<u)&&v(m[0])&&4===m[0].length){for(p=u;p<=g;p++)n=c.slice(p-u,p),r=m.slice(p-u,p),i=(l=super.getValues({xData:n,yData:r},t)).xData[0],a=(s=l.yData[0])*(1+h),o=s*(1-d),y.push([i,a,s,o]),f.push(i),x.push([a,s,o]);return{values:y,xData:f,yData:x}}}}e$.defaultOptions=S(eH.defaultOptions,{marker:{enabled:!1},tooltip:{pointFormat:'<span style="color:{point.color}">●</span><b> {series.name}</b><br/>Top: {point.top}<br/>Middle: {point.middle}<br/>Bottom: {point.bottom}<br/>'},params:{period:20,topBand:.1,bottomBand:.1},bottomLine:{styles:{lineWidth:1,lineColor:void 0}},topLine:{styles:{lineWidth:1}},dataGrouping:{approximation:"averages"}}),y(e$.prototype,{areaLinesNames:["top","bottom"],linesApiNames:["topLine","bottomLine"],nameComponents:["period","topBand","bottomBand"],nameBase:"Price envelopes",pointArrayMap:["top","middle","bottom"],parallelArrays:["x","y","top","bottom"],pointValKey:"middle"}),B.compose(e$),p().registerSeriesType("priceenvelopes",e$);let{sma:eJ}=p().seriesTypes;function eQ(e,t){return parseFloat(e.toFixed(t))}class e0 extends eJ{constructor(){super(...arguments),this.nameComponents=void 0}getValues(e,t){let s=e.xData,a=e.yData,o=t.maxAccelerationFactor,i=t.increment,n=t.initialAccelerationFactor,r=t.decimals,l=t.index,p=[],u=[],h=[],d=t.initialAccelerationFactor,c,m=a[0][1],g,y,f,x=1,v,D,S,b,T=a[0][2],C,A,P,M;if(!(l>=a.length)){for(M=0;M<l;M++)m=Math.max(a[M][1],m),T=Math.min(a[M][2],eQ(T,r));for(c=a[M][1]>T?1:-1,g=m-T,y=(d=t.initialAccelerationFactor)*g,p.push([s[l],T]),u.push(s[l]),h.push(eQ(T,r)),M=l+1;M<a.length;M++)if(v=a[M-1][2],D=a[M-2][2],S=a[M-1][1],b=a[M-2][1],A=a[M][1],P=a[M][2],null!==D&&null!==b&&null!==v&&null!==S&&null!==A&&null!==P){var O,V,L,k,E,w,I,N,B,G,W,z,Y,X,F,R,K,j,U,Z,_;E=c,w=x,I=T,N=y,B=D,G=v,W=S,z=b,Y=m,T=E===w?1===E?I+N<Math.min(B,G)?I+N:Math.min(B,G):I+N>Math.max(z,W)?I+N:Math.max(z,W):Y,O=c,V=m,C=1===O?A>V?A:V:P<V?P:V,L=x,k=T,X=f=1===L&&P>k||-1===L&&A>k?1:-1,F=c,R=C,K=m,j=d,U=i,Z=o,_=n,y=(d=X===F?1===X&&R>K||-1===X&&R<K?j===Z?Z:eQ(j+U,2):j:_)*(g=C-T),p.push([s[M],eQ(T,r)]),u.push(s[M]),h.push(eQ(T,r)),x=c,c=f,m=C}return{values:p,xData:u,yData:h}}}}e0.defaultOptions=S(eJ.defaultOptions,{lineWidth:0,marker:{enabled:!0},states:{hover:{lineWidthPlus:0}},params:{period:void 0,initialAccelerationFactor:.02,maxAccelerationFactor:.2,increment:.02,index:2,decimals:4}}),p().registerSeriesType("psar",e0);let{sma:e1}=p().seriesTypes;class e2 extends e1{getValues(e,t){let s=t.period,a=e.xData,o=e.yData,i=o?o.length:0,n=[],r=[],l=[],p,u=-1,h;if(!(a.length<=s)){for(v(o[0])&&(u=t.index),p=s;p<i;p++)h=function(e,t,s,a,o){let i,n;return n=o<0?(i=t[s-a])?(t[s]-i)/i*100:null:(i=t[s-a][o])?(t[s][o]-i)/i*100:null,[e[s],n]}(a,o,p,s,u),n.push(h),r.push(h[0]),l.push(h[1]);return{values:n,xData:r,yData:l}}}}e2.defaultOptions=S(e1.defaultOptions,{params:{index:3,period:9}}),y(e2.prototype,{nameBase:"Rate of Change"}),p().registerSeriesType("roc",e2);let{sma:e3}=p().seriesTypes;function e4(e,t){return parseFloat(e.toFixed(t))}class e5 extends e3{getValues(e,t){let s=t.period,a=e.xData,o=e.yData,i=o?o.length:0,n=t.decimals,r=[],l=[],p=[],u=0,h=0,d=t.index,c=1,m,g,y,f,v,D;if(!(a.length<s)){for(x(o[0])?D=o:(d=Math.min(d,o[0].length-1),D=o.map(e=>e[d]));c<s;)(g=e4(D[c]-D[c-1],n))>0?u+=g:h+=Math.abs(g),c++;for(y=e4(u/(s-1),n),f=e4(h/(s-1),n),v=c;v<i;v++)(g=e4(D[v]-D[v-1],n))>0?(u=g,h=0):(u=0,h=Math.abs(g)),y=e4((y*(s-1)+u)/s,n),m=0===(f=e4((f*(s-1)+h)/s,n))?100:0===y?0:e4(100-100/(1+y/f),n),r.push([a[v],m]),l.push(a[v]),p.push(m);return{values:r,xData:l,yData:p}}}}e5.defaultOptions=S(e3.defaultOptions,{params:{decimals:4,index:3}}),p().registerSeriesType("rsi",e5);let{sma:e6}=p().seriesTypes;class e9 extends e6{init(){super.init.apply(this,arguments),this.options=S({smoothedLine:{styles:{lineColor:this.color}}},this.options)}getValues(e,t){let s=t.periods[0],a=t.periods[1],o=e.xData,i=e.yData,n=i?i.length:0,r=[],l=[],p=[],u,h,d=null,c,m;if(n<s||!v(i[0])||4!==i[0].length)return;let g=!0,y=0;for(m=s-1;m<n;m++){if(u=(c=eZ(i.slice(m-s+1,m+1),2,1))[0],isNaN(h=(i[m][3]-u)/(c[1]-u)*100)&&g){y++;continue}g&&!isNaN(h)&&(g=!1);let e=l.push(o[m]);isNaN(h)?p.push([p[e-2]&&"number"==typeof p[e-2][0]?p[e-2][0]:null,null]):p.push([h,null]),m>=y+(s-1)+(a-1)&&(d=super.getValues({xData:l.slice(-a),yData:p.slice(-a)},{period:a}).yData[0]),r.push([o[m],h,d]),p[e-1][1]=d}return{values:r,xData:l,yData:p}}}e9.defaultOptions=S(e6.defaultOptions,{params:{index:void 0,period:void 0,periods:[14,3]},marker:{enabled:!1},tooltip:{pointFormat:'<span style="color:{point.color}">●</span><b> {series.name}</b><br/>%K: {point.y}<br/>%D: {point.smoothed}<br/>'},smoothedLine:{styles:{lineWidth:1,lineColor:void 0}},dataGrouping:{approximation:"averages"}}),y(e9.prototype,{areaLinesNames:[],nameComponents: