UNPKG

highcharts

Version:
17 lines (14 loc) 3.71 kB
/* Highstock JS v10.0.0 (2022-03-07) Indicator series type for Highcharts Stock (c) 2010-2021 Wojciech Chmiel License: www.highcharts.com/license */ (function(b){"object"===typeof module&&module.exports?(b["default"]=b,module.exports=b):"function"===typeof define&&define.amd?define("highcharts/indicators/chaikin",["highcharts","highcharts/modules/stock"],function(f){b(f);b.Highcharts=f;return b}):b("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(b){function f(b,a,f,h){b.hasOwnProperty(a)||(b[a]=h.apply(null,f),"function"===typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:a,module:b[a]}})))} b=b?b._modules:{};f(b,"Stock/Indicators/AD/ADIndicator.js",[b["Core/Series/SeriesRegistry.js"],b["Core/Utilities.js"]],function(b,a){var f=this&&this.__extends||function(){var b=function(a,d){b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,c){e.__proto__=c}||function(e,c){for(var g in c)c.hasOwnProperty(g)&&(e[g]=c[g])};return b(a,d)};return function(a,d){function e(){this.constructor=a}b(a,d);a.prototype=null===d?Object.create(d):(e.prototype=d.prototype,new e)}}(),h=b.seriesTypes.sma, n=a.error,l=a.extend,p=a.merge;a=function(b){function a(){var a=null!==b&&b.apply(this,arguments)||this;a.data=void 0;a.options=void 0;a.points=void 0;return a}f(a,b);a.populateAverage=function(a,b,c,g,k){k=b[g][1];var d=b[g][2];b=b[g][3];c=c[g];return[a[g],b===k&&b===d||k===d?0:(2*b-d-k)/(k-d)*c]};a.prototype.getValues=function(b,e){var c=e.period,g=b.xData,k=b.yData,d=e.volumeSeriesID,m=b.chart.get(d);e=m&&m.yData;var f=k?k.length:0,h=[],q=[],l=[];if(!(g.length<=c&&f&&4!==k[0].length)){if(m){for(d= c;d<f;d++)b=h.length,m=a.populateAverage(g,k,e,d,c),0<b&&(m[1]+=h[b-1][1]),h.push(m),q.push(m[0]),l.push(m[1]);return{values:h,xData:q,yData:l}}n("Series "+d+" not found! Check `volumeSeriesID`.",!0,b.chart)}};a.defaultOptions=p(h.defaultOptions,{params:{index:void 0,volumeSeriesID:"volume"}});return a}(h);l(a.prototype,{nameComponents:!1,nameBase:"Accumulation/Distribution"});b.registerSeriesType("ad",a);"";return a});f(b,"Stock/Indicators/Chaikin/ChaikinIndicator.js",[b["Core/Series/SeriesRegistry.js"], b["Core/Utilities.js"]],function(b,a){var f=this&&this.__extends||function(){var b=function(a,c){b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,a){b.__proto__=a}||function(b,a){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c])};return b(a,c)};return function(a,c){function g(){this.constructor=a}b(a,c);a.prototype=null===c?Object.create(c):(g.prototype=c.prototype,new g)}}(),h=b.seriesTypes,n=h.ad,l=h.ema,p=a.correctFloat;h=a.extend;var t=a.merge,r=a.error;a=function(b){function a(){var a= null!==b&&b.apply(this,arguments)||this;a.data=void 0;a.options=void 0;a.points=void 0;return a}f(a,b);a.prototype.getValues=function(b,a){var c=a.periods,d=a.period,f=[],g=[],h=[],e;if(2!==c.length||c[1]<=c[0])r('Error: "Chaikin requires two periods. Notice, first period should be lower than the second one."');else if(a=n.prototype.getValues.call(this,b,{volumeSeriesID:a.volumeSeriesID,period:d}))if(b=l.prototype.getValues.call(this,a,{period:c[0]}),a=l.prototype.getValues.call(this,a,{period:c[1]}), b&&a){c=c[1]-c[0];for(e=0;e<a.yData.length;e++)d=p(b.yData[e+c]-a.yData[e]),f.push([a.xData[e],d]),g.push(a.xData[e]),h.push(d);return{values:f,xData:g,yData:h}}};a.defaultOptions=t(l.defaultOptions,{params:{index:void 0,volumeSeriesID:"volume",period:9,periods:[3,10]}});return a}(l);h(a.prototype,{nameBase:"Chaikin Osc",nameComponents:["periods"]});b.registerSeriesType("chaikin",a);"";return a});f(b,"masters/indicators/chaikin.src.js",[],function(){})}); //# sourceMappingURL=chaikin.js.map