UNPKG

highcharts

Version:
12 lines 3.09 kB
!/** * Highstock JS v12.6.0 (2026-04-13) * @module highcharts/indicators/cmf * @requires highcharts * @requires highcharts/modules/stock * * (c) 2010-2026 Highsoft AS * Author: Sebastian Domas * * 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/cmf",["highcharts/highcharts"],function(e){return t(e,e.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/indicators/cmf"]=t(e._Highcharts,e._Highcharts.SeriesRegistry):e.Highcharts=t(e.Highcharts,e.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(e,t)=>(()=>{"use strict";var r={512:e=>{e.exports=t},944:t=>{t.exports=e}},o={};function n(e){var t=o[e];if(void 0!==t)return t.exports;var i=o[e]={exports:{}};return r[e](i,i.exports,n),i.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 r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var i={};n.d(i,{default:()=>g});var s=n(944),a=n.n(s),l=n(512),u=n.n(l);let{doc:c,win:p}=a();function h(e){return f(e)&&"number"==typeof e.nodeType}function f(e,t){let r;return!!e&&"object"==typeof e&&(!t||"[object Array]"!==(r=Object.prototype.toString.call(e))&&"[object Array Iterator]"!==r)}Array.prototype.find;let{sma:y}=u().seriesTypes;class d extends y{constructor(){super(...arguments),this.nameBase="Chaikin Money Flow"}isValid(){let e=this.chart,t=this.options,r=this.linkedParent,o=this.volumeSeries||(this.volumeSeries=e.get(t.params.volumeSeriesID)),n=r?.pointArrayMap?.length===4;function i(e){return e.dataTable.rowCount>=t.params.period}return!!(r&&o&&i(r)&&i(o)&&n)}getValues(e,t){if(this.isValid())return this.getMoneyFlow(e.xData,e.yData,this.volumeSeries.getColumn("y"),t.period)}getMoneyFlow(e,t,r,o){let n=t.length,i=[],s=[],a=[],l=[],u,c,p=-1,h=0,f=0;function y(e,t){let r=e[1],o=e[2],n=e[3];return null!==t&&null!==r&&null!==o&&null!==n&&r!==o?(n-o-(r-n))/(r-o)*t:(p=u,null)}if(o>0&&o<=n){for(u=0;u<o;u++)i[u]=y(t[u],r[u]),h+=r[u],f+=i[u];for(s.push(e[u-1]),a.push(u-p>=o&&0!==h?f/h:null),l.push([s[0],a[0]]);u<n;u++)i[u]=y(t[u],r[u]),h-=r[u-o],h+=r[u],f-=i[u-o],f+=i[u],c=[e[u],u-p>=o?f/h:null],s.push(c[0]),a.push(c[1]),l.push([c[0],c[1]])}return{values:l,xData:s,yData:a}}}d.defaultOptions=function(e,...t){let r,o=[e,...t],n={},i=function(e,t){return"object"!=typeof e&&(e={}),function(e,t,r){for(let r in e)Object.hasOwnProperty.call(e,r)&&t.call((0,e[r]),e[r],r,e)}(t,function(r,o){if("__proto__"!==o&&"constructor"!==o){let n;!f(r,!0)||(n=r?.constructor,f(r,!0)&&!h(r)&&n?.name&&"Object"!==n.name)||h(r)?e[o]=t[o]:e[o]=i(e[o]||{},r)}}),e};!0===e&&(n=o[1],o=Array.prototype.slice.call(o,2));let s=o.length;for(r=0;r<s;r++)n=i(n,o[r]);return n}(y.defaultOptions,{params:{index:void 0,volumeSeriesID:"volume"}}),u().registerSeriesType("cmf",d);let g=a();return i.default})());