/*
 Highstock JS v8.0.4 (2020-03-10)

 Indicator series type for Highstock

 (c) 2010-2019 Sebastian Bochan

 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/macd",["highcharts","highcharts/modules/stock"],function(g){b(g);b.Highcharts=g;return b}):b("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(b){function g(b,e,g,k){b.hasOwnProperty(e)||(b[e]=k.apply(null,g))}b=b?b._modules:{};g(b,"indicators/macd.btx.js",[b["parts/Globals.js"],b["parts/Utilities.js"]],function(b,e){var g=e.correctFloat,
k=e.defined,q=e.merge;e=e.seriesType;var m=b.seriesTypes.sma,n=b.seriesTypes.ema;e("macd","sma",{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,states:{hover:{halo:{size:0}}},tooltip:{pointFormat:'<span style="color:{point.color}">\u25cf</span> <b> {series.name}</b><br/>Value: {point.MACD}<br/>Signal: {point.signal}<br/>Histogram: {point.y}<br/>'},
dataGrouping:{approximation:"averages"},minPointLength:0},{nameComponents:["longPeriod","shortPeriod","signalPeriod"],requiredIndicators:["ema"],pointArrayMap:["y","signal","MACD"],parallelArrays:["x","y","signal","MACD"],pointValKey:"y",markerAttribs:b.noop,getColumnMetrics:b.seriesTypes.column.prototype.getColumnMetrics,crispCol:b.seriesTypes.column.prototype.crispCol,init:function(){m.prototype.init.apply(this,arguments);this.options&&(this.options=q({signalLine:{styles:{lineColor:this.color}},
macdLine:{styles:{color:this.color}}},this.options),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.resetZones=!0)},toYData:function(a){return[a.y,a.signal,a.MACD]},translate:function(){var a=this,p=["plotSignal","plotMACD"];b.seriesTypes.column.prototype.translate.apply(a);a.points.forEach(function(b){[b.signal,b.MACD].forEach(function(c,d){null!==c&&(b[p[d]]=
a.yAxis.toPixels(c,!0))})})},destroy:function(){this.graph=null;this.graphmacd=this.graphmacd&&this.graphmacd.destroy();this.graphsignal=this.graphsignal&&this.graphsignal.destroy();m.prototype.destroy.apply(this,arguments)},drawPoints:b.seriesTypes.column.prototype.drawPoints,drawGraph:function(){for(var a=this,b=a.points,d=b.length,c=a.options,g=a.zones,e={options:{gapSize:c.gapSize}},h=[[],[]],f;d--;)f=b[d],k(f.plotMACD)&&h[0].push({plotX:f.plotX,plotY:f.plotMACD,isNull:!k(f.plotMACD)}),k(f.plotSignal)&&
h[1].push({plotX:f.plotX,plotY:f.plotSignal,isNull:!k(f.plotMACD)});["macd","signal"].forEach(function(b,p){a.points=h[p];a.options=q(c[b+"Line"].styles,e);a.graph=a["graph"+b];a.currentLineZone=b+"Zones";a.zones=a[a.currentLineZone].zones;m.prototype.drawGraph.call(a);a["graph"+b]=a.graph});a.points=b;a.options=c;a.zones=g;a.currentLineZone=null},getZonesGraphs:function(a){var b=m.prototype.getZonesGraphs.call(this,a),d=b;this.currentLineZone&&(d=b.splice(this[this.currentLineZone].startIndex+1),
d.length?d.splice(0,0,a[0]):d=[a[0]]);return d},applyZones:function(){var a=this.zones;this.zones=this.signalZones.zones;m.prototype.applyZones.call(this);this.graphmacd&&this.options.macdLine.zones.length&&this.graphmacd.hide();this.zones=a},getValues:function(a,b){var d=0,c=[],e=[],l=[];if(!(a.xData.length<b.longPeriod+b.signalPeriod)){var h=n.prototype.getValues(a,{period:b.shortPeriod});var f=n.prototype.getValues(a,{period:b.longPeriod});h=h.values;f=f.values;for(a=1;a<=h.length;a++)k(f[a-1])&&
k(f[a-1][1])&&k(h[a+b.shortPeriod+1])&&k(h[a+b.shortPeriod+1][0])&&c.push([h[a+b.shortPeriod+1][0],0,null,h[a+b.shortPeriod+1][1]-f[a-1][1]]);for(a=0;a<c.length;a++)e.push(c[a][0]),l.push([0,null,c[a][3]]);b=n.prototype.getValues({xData:e,yData:l},{period:b.signalPeriod,index:2});b=b.values;for(a=0;a<c.length;a++)c[a][0]>=b[0][0]&&(c[a][2]=b[d][1],l[a]=[0,b[d][1],c[a][3]],null===c[a][3]?(c[a][1]=0,l[a][0]=0):(c[a][1]=g(c[a][3]-b[d][1]),l[a][0]=g(c[a][3]-b[d][1])),d++);return{values:c,xData:e,yData:l}}}});
""});g(b,"masters/indicators/macd.btx.js",[],function(){})});
//# sourceMappingURL=macd.js.map