highcharts
Version:
JavaScript charting framework
21 lines (18 loc) • 5.62 kB
JavaScript
/*
Highstock JS v10.0.0 (2022-03-07)
Indicator series type for Highcharts Stock
(c) 2010-2021 Daniel Studencki
License: www.highcharts.com/license
*/
(function(a){"object"===typeof module&&module.exports?(a["default"]=a,module.exports=a):"function"===typeof define&&define.amd?define("highcharts/indicators/keltner-channels",["highcharts","highcharts/modules/stock"],function(k){a(k);a.Highcharts=k;return a}):a("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(a){function k(a,e,f,k){a.hasOwnProperty(e)||(a[e]=k.apply(null,f),"function"===typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:e,
module:a[e]}})))}a=a?a._modules:{};k(a,"Stock/Indicators/MultipleLinesComposition.js",[a["Core/Series/SeriesRegistry.js"],a["Core/Utilities.js"]],function(a,e){var f=a.seriesTypes.sma,k=e.defined,n=e.error,q=e.merge,h;(function(e){function m(b){var c,a=[];b=b||this.points;if(this.fillGraph&&this.nextPoints){if((c=f.prototype.getGraphPath.call(this,this.nextPoints))&&c.length){c[0][0]="L";a=f.prototype.getGraphPath.call(this,b);c=c.slice(0,a.length);for(var g=c.length-1;0<=g;g--)a.push(c[g])}}else a=
f.prototype.getGraphPath.apply(this,arguments);return a}function p(){var b=this,c=b.linesApiNames,d=b.areaLinesNames,g=b.points,e=b.options,p=b.graph,w={options:{gapSize:e.gapSize}},m=[],h=b.getTranslatedLinesNames(b.pointValKey),u=g.length,l;h.forEach(function(b,c){for(m[c]=[];u--;)l=g[u],m[c].push({x:l.x,plotX:l.plotX,plotY:l[b],isNull:!k(l[b])});u=g.length});if(this.userOptions.fillColor&&d.length){var v=h.indexOf(x(d[0]));v=m[v];d=1===d.length?g:m[h.indexOf(x(d[1]))];h=b.color;b.points=d;b.nextPoints=
v;b.color=this.userOptions.fillColor;b.options=q(g,w);b.graph=b.area;b.fillGraph=!0;a.seriesTypes.sma.prototype.drawGraph.call(b);b.area=b.graph;delete b.nextPoints;delete b.fillGraph;b.color=h}c.forEach(function(c,a){m[a]?(b.points=m[a],e[c]?b.options=q(e[c].styles,w):n('Error: "There is no '+c+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names." at mixin/multiple-line.js:34'),b.graph=b["graph"+c],f.prototype.drawGraph.call(b),b["graph"+c]=b.graph):n('Error: "'+
c+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")});b.points=g;b.options=e;b.graph=p;f.prototype.drawGraph.call(b)}function d(b){var c=[];(this.pointArrayMap||[]).forEach(function(a){a!==b&&c.push(x(a))});return c}function x(b){return"plot"+b.charAt(0).toUpperCase()+b.slice(1)}function w(b){var c=[];(this.pointArrayMap||[]).forEach(function(a){c.push(b[a])});return c}function u(){var b=this,c=b.pointArrayMap,a=[],d;a=b.getTranslatedLinesNames();
f.prototype.translate.apply(b,arguments);b.points.forEach(function(e){c.forEach(function(c,g){d=e[c];b.dataModify&&(d=b.dataModify.modifyValue(d));null!==d&&(e[a[g]]=b.yAxis.toPixels(d,!0))})})}var h=[],l=["bottomLine"],v=["top","bottom"],z=["top"];e.compose=function(b){if(-1===h.indexOf(b)){h.push(b);var c=b.prototype;c.linesApiNames=c.linesApiNames||l.slice();c.pointArrayMap=c.pointArrayMap||v.slice();c.pointValKey=c.pointValKey||"top";c.areaLinesNames=c.areaLinesNames||z.slice();c.drawGraph=p;
c.getGraphPath=m;c.toYData=w;c.translate=u;c.getTranslatedLinesNames=d}return b}})(h||(h={}));return h});k(a,"Stock/Indicators/KeltnerChannels/KeltnerChannelsIndicator.js",[a["Stock/Indicators/MultipleLinesComposition.js"],a["Core/Series/SeriesRegistry.js"],a["Core/Utilities.js"]],function(a,e,f){var k=this&&this.__extends||function(){var a=function(e,d){a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,d){a.__proto__=d}||function(a,d){for(var e in d)d.hasOwnProperty(e)&&(a[e]=d[e])};
return a(e,d)};return function(e,d){function f(){this.constructor=e}a(e,d);e.prototype=null===d?Object.create(d):(f.prototype=d.prototype,new f)}}(),n=e.seriesTypes.sma,q=f.correctFloat,h=f.extend,y=f.merge;f=function(a){function f(){var d=null!==a&&a.apply(this,arguments)||this;d.data=void 0;d.options=void 0;d.points=void 0;return d}k(f,a);f.prototype.init=function(){e.seriesTypes.sma.prototype.init.apply(this,arguments);this.options=y({topLine:{styles:{lineColor:this.color}},bottomLine:{styles:{lineColor:this.color}}},
this.options)};f.prototype.getValues=function(a,f){var d=f.period,h=f.periodATR,k=f.multiplierATR,l=a.yData;l=l?l.length:0;var m=[];f=e.seriesTypes.ema.prototype.getValues(a,{period:d,index:f.index});var n=e.seriesTypes.atr.prototype.getValues(a,{period:h}),b=[],c=[],r;if(!(l<d)){for(r=d;r<=l;r++){var g=f.values[r-d];var t=n.values[r-h];var p=g[0];a=q(g[1]+k*t[1]);t=q(g[1]-k*t[1]);g=g[1];m.push([p,a,g,t]);b.push(p);c.push([a,g,t])}return{values:m,xData:b,yData:c}}};f.defaultOptions=y(n.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}">\u25cf</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});return f}(n);h(f.prototype,{nameBase:"Keltner Channels",
areaLinesNames:["top","bottom"],nameComponents:["period","periodATR","multiplierATR"],linesApiNames:["topLine","bottomLine"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"});a.compose(f);e.registerSeriesType("keltnerchannels",f);"";return f});k(a,"masters/indicators/keltner-channels.src.js",[],function(){})});
//# sourceMappingURL=keltner-channels.js.map