UNPKG

highcharts

Version:
14 lines 5.84 kB
!/** * Highstock JS v12.6.0 (2026-04-13) * @module highcharts/indicators/keltner-channels * @requires highcharts * @requires highcharts/modules/stock * * Indicator series type for Highcharts Stock * * (c) 2010-2026 Highsoft AS * Author: Daniel Studencki * * A commercial license may be required depending on use. * See www.highcharts.com/license */function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(e._Highcharts,e._Highcharts.SeriesRegistry):"function"==typeof define&&define.amd?define("highcharts/indicators/keltner-channels",["highcharts/highcharts"],function(e){return t(e,e.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/indicators/keltner-channels"]=t(e._Highcharts,e._Highcharts.SeriesRegistry):e.Highcharts=t(e.Highcharts,e.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(e,t)=>(()=>{"use strict";var o,r={512:e=>{e.exports=t},944:t=>{t.exports=e}},i={};function n(e){var t=i[e];if(void 0!==t)return t.exports;var o=i[e]={exports:{}};return r[e](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var a={};n.d(a,{default:()=>v});var s=n(944),p=n.n(s),l=n(512),h=n.n(l);let{doc:c,win:u}=p();function f(e,t){return e>1e14?e:parseFloat(e.toPrecision(t||14))}function d(e){return y(e)&&"number"==typeof e.nodeType}function y(e,t){let o;return!!e&&"object"==typeof e&&(!t||"[object Array]"!==(o=Object.prototype.toString.call(e))&&"[object Array Iterator]"!==o)}function m(e,...t){let o,r=[e,...t],i={},n=function(e,t){return"object"!=typeof e&&(e={}),function(e,t,o){for(let o in e)Object.hasOwnProperty.call(e,o)&&t.call((0,e[o]),e[o],o,e)}(t,function(o,r){if("__proto__"!==r&&"constructor"!==r){let i;!y(o,!0)||(i=o?.constructor,y(o,!0)&&!d(o)&&i?.name&&"Object"!==i.name)||d(o)?e[r]=t[r]:e[r]=n(e[r]||{},o)}}),e};!0===e&&(i=r[1],r=Array.prototype.slice.call(r,2));let a=r.length;for(o=0;o<a;o++)i=n(i,r[o]);return i}Array.prototype.find;let{sma:{prototype:g}}=h().seriesTypes;!function(e){let t=["bottomLine"],o=["top","bottom"],r=["top"];function i(e){return"plot"+e.charAt(0).toUpperCase()+e.slice(1)}function n(e,t){let o=[];return(e.pointArrayMap||[]).forEach(e=>{e!==t&&o.push(i(e))}),o}function a(){let e=this,t=e.pointValKey,o=e.linesApiNames,r=e.areaLinesNames,a=e.points,p=e.options,l=e.graph,h={options:{gapSize:p.gapSize}},c=[],u=n(e,t),f=a.length,d;if(u.forEach((e,t)=>{for(c[t]=[];f--;)d=a[f],c[t].push({x:d.x,plotX:d.plotX,plotY:d[e],isNull:null==d[e]});f=a.length}),e.userOptions.fillColor&&r.length){let t=c[u.indexOf(i(r[0]))],o=1===r.length?a:c[u.indexOf(i(r[1]))],n=e.color;e.points=o,e.nextPoints=t,e.color=e.userOptions.fillColor,e.options=m(a,h),e.graph=e.area,e.fillGraph=!0,g.drawGraph.call(e),e.area=e.graph,delete e.nextPoints,delete e.fillGraph,e.color=n}o.forEach((t,o)=>{c[o]?(e.points=c[o],p[t]?e.options=m(p[t].styles,h):(0,s.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],g.drawGraph.call(e),e["graph"+t]=e.graph):(0,s.error)('Error: "'+t+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),e.points=a,e.options=p,e.graph=l,g.drawGraph.call(e)}function p(e){let t,o=[],r=[];if(e=e||this.points,this.fillGraph&&this.nextPoints){if((t=g.getGraphPath.call(this,this.nextPoints))&&t.length){t[0][0]="L",o=g.getGraphPath.call(this,e),r=t.slice(0,o.length);for(let e=r.length-1;e>=0;e--)o.push(r[e])}}else o=g.getGraphPath.apply(this,arguments);return o}function l(e){let t=[];return(this.pointArrayMap||[]).forEach(o=>{t.push(e[o])}),t}function h(){let e=this.pointArrayMap,t=[],o;t=n(this),g.translate.apply(this,arguments),this.points.forEach(r=>{e.forEach((e,i)=>{o=r[e],this.dataModify&&(o=this.dataModify.modifyValue(o)),null!==o&&(r[t[i]]=this.yAxis.toPixels(o,!0))})})}e.compose=function(e){let i=e.prototype;return i.linesApiNames=i.linesApiNames||t.slice(),i.pointArrayMap=i.pointArrayMap||o.slice(),i.pointValKey=i.pointValKey||"top",i.areaLinesNames=i.areaLinesNames||r.slice(),i.drawGraph=a,i.getGraphPath=p,i.toYData=l,i.translate=h,e}}(o||(o={}));let b=o,{sma:A}=h().seriesTypes;class x extends A{init(){h().seriesTypes.sma.prototype.init.apply(this,arguments),this.options=m({topLine:{styles:{lineColor:this.color}},bottomLine:{styles:{lineColor:this.color}}},this.options)}getValues(e,t){let o,r,i,n,a,s,p,l=t.period,c=t.periodATR,u=t.multiplierATR,d=t.index,y=e.yData,m=y?y.length:0,g=[],b=h().seriesTypes.ema.prototype.getValues(e,{period:l,index:d}),A=h().seriesTypes.atr.prototype.getValues(e,{period:c}),x=[],v=[];if(!(m<l)){for(p=l;p<=m;p++)a=b.values[p-l],s=A.values[p-c],n=a[0],r=f(a[1]+u*s[1]),i=f(a[1]-u*s[1]),o=a[1],g.push([n,r,o,i]),x.push(n),v.push([r,o,i]);return{values:g,xData:x,yData:v}}}}x.defaultOptions=m(A.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}),function(e,t){let o;for(o in e||(e={}),t)e[o]=t[o]}(x.prototype,{nameBase:"Keltner Channels",areaLinesNames:["top","bottom"],nameComponents:["period","periodATR","multiplierATR"],linesApiNames:["topLine","bottomLine"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"}),b.compose(x),h().registerSeriesType("keltnerchannels",x);let v=p();return a.default})());