19 lines
56 KiB
JavaScript
19 lines
56 KiB
JavaScript
"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[7539],{52973:(e,t,s)=>{s.r(t),s.d(t,{Sessions:()=>_});var i=s(50151),r=s(19844),l=s(19136),o=s(45530),a=s(67563),n=s(66786),h=s(37103),c=s(40472),u=s(72972);const d=new a.PriceFormatter;class _ extends n.CustomSourceBase{constructor(e,t,s,i){super(e,t),this._studySource=null,this._paneViews=[],this._metaInfo=null,this._destroyed=!1,this._isStarted=!1,this._loadedGraphics=null,this._doubleClickHandler=i,this._properties=s,this._properties.subscribe(this,this._onPropertiesChanged),this._requestAndProcessMetaInfo(),t.timeScale().onReset().subscribe(this,this._clearData),t.timeScale().logicalRangeChanged().subscribe(this,this.updateAllViews.bind(this,(0,c.viewportChangeEvent)())),t.mainSeries().properties().childs().interval.subscribe(this,this._processHibernate)}start(){this._isStarted=!0,this._processHibernate()}restart(){this._clearData(),h.enabled("stop_study_on_restart")&&this.stop(),this.start()}isStarted(){return this._isStarted}stop(){this._isStarted=!1,null!==this._studySource&&this._studySource.stop()}isHoveredEnabled(){return!1}paneViews(e){return this._paneViews}updateAllViews(e){this._paneViews.forEach((t=>t.update(e)))}updateViewsForPane(e,t){this.updateAllViews(t)}destroy(){this._destroyed=!0,null!==this._studySource&&(this._studySource.dataCleared().unsubscribeAll(this),this._studySource.dataUpdated().unsubscribeAll(this),this._studySource.destroy(),this._studySource=null),this._model.timeScale().logicalRangeChanged().unsubscribeAll(this),this._model.timeScale().onReset().unsubscribeAll(this),this._model.mainSeries().properties().childs().interval.unsubscribeAll(this),this._properties.unsubscribeAll(this)}series(){return this._model.mainSeries()}priceScale(){return this.series().priceScale()}graphics(){return this._loadedGraphics||(0,i.ensureNotNull)(this._studySource).graphics()}valueAt(e,t){return null}properties(){return this._properties}graphicsInfo(){return(0,i.ensureNotNull)(this._metaInfo).graphics}firstValue(e){return this._model.mainSeries().firstValue()}formatter(){return d}stateData(){return null!==this._metaInfo?{graphics:(0,o.saveStudyGraphics)(this.graphics(),this._model.timeScale().visibleBarsStrictRange()),metaInfo:this._metaInfo.state()}:null}restoreStateData(e){void 0!==e&&(this._loadStudyGraphics(e.graphics),this._setMetaInfo(new r.StudyMetaInfo(e.metaInfo)),this._createPaneViews())}metaInfo(){return(0,i.ensureNotNull)(this._metaInfo)}async _requestAndProcessMetaInfo(){if(this._model.isSnapshot())return;const e=await(0,u.studyMetaInfoRepository)().findById({type:"java",studyId:"Sessions@tv-basicstudies"});this._destroyed||null===this._loadedGraphics&&(this._setMetaInfo(e),null!==this._metaInfo&&(this._studySource=new l.StudyDataSource(this._model.chartApi(),this._model.mainSeries().seriesSource(),"sessions_",this._metaInfo),this._createPaneViews(),this._studySource.dataCleared().subscribe(this,this.updateAllViews.bind(this,(0,c.sourceChangeEvent)(this.id()))),
|
|
this._studySource.dataUpdated().subscribe(this,this.updateAllViews.bind(this,(0,c.sourceChangeEvent)(this.id()))),this._studySource.setInputs({}),this._processHibernate()))}_loadStudyGraphics(e){const t=e.backgrounds;if(void 0!==t){const e=t.findIndex((e=>"inSession"===e.styleId));-1!==e&&t.splice(e,1)}this._loadedGraphics=(0,o.loadStudyGraphics)(e)}_setMetaInfo(e){const t=e.graphics.backgrounds;void 0!==t&&void 0!==t.inSession&&delete t.inSession,this._metaInfo=e}_clearData(){null!==this._studySource&&this._studySource.clearData()}_createPaneViews(){const e={doubleClickHandler:this._doubleClickHandler};(0,o.createGraphicsPaneViews)(this,this._model,e).then((e=>{this._paneViews=e.regularPaneViews,this._model.lightUpdate()}))}_onPropertiesChanged(){this._processHibernate(),this.updateAllViews((0,c.sourceChangeEvent)(this.id()))}_processHibernate(){if(null!==this._studySource){const e=this._canBeHibernated(),t=this._isHibernated(),s=this._studySource.isStarted();!t&&e&&s?this._studySource.stop():!t||e||s||this._studySource.start()}}_canBeHibernated(){if(this._model.mainSeries().isDWM())return!0;const e=this._properties.childs().sessionHighlight.childs(),{preMarket:t,postMarket:s,electronic:i,outOfSession:r}=e.backgrounds.childs(),{sessBreaks:l}=e.vertlines.childs(),o=t.childs().available.value()&&t.childs().visible.value()||s.childs().available.value()&&s.childs().visible.value()||i.childs().available.value()&&i.childs().visible.value()||r.childs().available.value()&&r.childs().visible.value(),a=l.childs().available.value()&&l.childs().visible.value();return!o&&!a}_isHibernated(){return this._isStarted&&(null===this._studySource||!this._studySource.isStarted())}}},96664:(e,t,s)=>{s.r(t),s.d(t,{study_PivotPointsStandard:()=>B});var i=s(50151),r=s(11485);class l extends r.Study{isLinkedToSeries(){return!0}clearData(){this._customData=null,this._indexes=null}restoreData(e,t,s){super.restoreData(e),this._customData=t,this._indexes=s}state(e){const t=super.state(e);return e&&(t.nonSeriesData=this._customData,t.indexes=this._indexes),t}customData(){return this._customData}_setPaneViews(e){this._paneViews=e,this.model().lightUpdate()}_onDataUpdated(e,t,s){null!==t&&(t.indexes_replace?((0,i.assert)("nochange"!==s),this._indexes=s):(this._customData=t.data,"nochange"!==s&&(this._indexes=s))),super._onDataUpdated(e,t,s)}}var o=s(27714),a=s(33350);class n{constructor(e,t,s,i){this._priceAxisFontSize=11,this._prices=[],this._labelWidth=0,this._pixelRatioParams=e,this._recreateCanvasAndContext((0,o.size)({width:0,height:0})),this.reset({font:t,fontSize:s,backColors:i})}destroy(){delete this._canvas,delete this._cache}canvas(){return this._canvas}reset(e){this._renderParams=e,this._prices=[],this._cache.font=e.fontSize+"px "+e.font,this._labelWidth=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5","/"].reduce(((e,t)=>{const s=this._cache.measureText(t).width;return Math.max(s,e)}),0)}rowHeight(){return this._priceAxisFontSize+4}labelRectByIndex(e){return{left:0,top:Math.round(this._topByIndex(e)),
|
|
width:Math.round(this._labelWidth+4),height:Math.round(this._renderParams.fontSize+8)}}setPrices(e){let t=!1;const s=(e,t)=>{const s=void 0===e,r=void 0===t;return(!s&&!r||s===r)&&(0,i.ensureDefined)(e).formatted===(0,i.ensureDefined)(t).formatted};if(e.length!==this._prices.length)t=!0;else for(let i=0;i<this._prices.length;i++)if(!s(this._prices[i],e[i])){t=!0;break}if(t){const t=this._labelWidth+6,s=this._renderParams.fontSize,i=Math.max(e.length,22)*(s+8);this._recreateCanvasAndContext((0,o.size)({width:t,height:i})),this._prices=e,this._cache.save(),(0,a.drawScaled)(this._cache,this._pixelRatioParams.horizontalPixelRatio,this._pixelRatioParams.verticalPixelRatio,(()=>{this._cache.translate(.5,.5),this._cache.font=this._renderParams.fontSize+"px "+this._renderParams.font,this._cache.textBaseline="middle";for(let e=0;e<this._prices.length;e++){if(!this._prices[e])continue;const t=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"][e];this._cache.fillStyle=this._renderParams.backColors[e],this._cache.fillText(t,0,this._centerByIndex(e)),this._cache.fillText("/",0,this._centerByIndex(e+11))}})),this._cache.restore(),this._prices=e}}_recreateCanvasAndContext(e){this._canvas=document.createElement("canvas"),this._canvas.width=e.width*this._pixelRatioParams.horizontalPixelRatio,this._canvas.height=e.height*this._pixelRatioParams.verticalPixelRatio,this._cache=(0,i.ensureNotNull)(this._canvas.getContext("2d"))}_centerByIndex(e){return Math.round((e+.5)*(this._renderParams.fontSize+8))}_topByIndex(e){return Math.round(e*(this._renderParams.fontSize+8))}}var h=s(84617),c=s(36281),u=s(52859);const d=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"];class _ extends c.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t;const s=t.name;this._completeName="P"===s.toUpperCase()?"P":`S${s[1]}/R${s[1]}`}_updateRendererData(e,t,s){e.visible=!1,t.visible=!1;const i=this._source.properties().childs();if(!i.visible.value())return;const r=this._completeName,l=i.levelsStyle.childs().visibility.childs();if(!l[r]||!l[r].value())return;const o=this._source.model().timeScale(),a=this._source.priceScale();if(o.isEmpty()||null===o.visibleBarsStrictRange()||null!==a&&a.isEmpty())return;const n=this._source.customData();if(!n||!n.pivots)return;const h=this._source.pricesView().prices()[d.indexOf(this._data.name.toUpperCase())];if(!h)return;s.background=(0,u.resetTransparency)(h.color),s.textColor=this.generateTextColor(s.background),s.coordinate=h.coordinate,s.floatCoordinate=h.coordinate;const c=this._source.model().properties().childs().scalesProperties.childs();c.showStudyLastValue.value()&&(e.text=h.formatted,e.visible=!0),c.showStudyPlotLabels.value()&&(t.text=this._source.priceLabelText(this._data.name),t.visible=!0)}}var p=s(69555),v=s(13212),y=s(80671),m=s(5471);const b=["p","s1","r1","s2","r2","s3","r3","s4","r4","s5","r5"],S={P:"P",S1:"S1/R1",S2:"S2/R2",S3:"S3/R3",S4:"S4/R4",S5:"S5/R5",R1:"S1/R1",R2:"S2/R2",R3:"S3/R3",R4:"S4/R4",R5:"S5/R5"};class g{constructor(e){this._visiblePivots=new Set,this._invidated=!0,
|
|
this._prices=[],this._source=e}visiblePivots(){return this._visiblePivots}update(){this._invidated=!0}prices(){return this._invidated&&(this._updateImpl(),this._invidated=!1),this._prices}_updateImpl(){this._visiblePivots.clear();const e=this._source.model(),t=this._source.priceScale();if(null===t)return;if(e.timeScale().isEmpty()||t.isEmpty())return;const s=e.timeScale().visibleBarsStrictRange();if(null===s)return;if(!this._source.customData()||!this._source.customData().pivots)return;const i=e.mainSeries().bars().search(s.lastBar(),m.PlotRowSearchMode.NearestLeft);if(null===i)return;const r=this._source.indexes();if(!r)return;const l=i.index,o=this._source.customData().pivots,a=this._source.properties().childs(),n=this._source.firstValue();for(let e=0;e<o.length;e++){if(!o[e])continue;const s=r[o[e].startIndex],i=r[o[e].endIndex],h=a.inputs.childs().showHistoricalPivots.value();if(s<=l&&(i>=l||h)){this._visiblePivots.add(o[e]),this._prices=[];for(let s=0;s<b.length;s++){const i=b[s],r=o[e][i];if(void 0===r||null===n)continue;const l=t.priceToCoordinate(r,n),h=i.toUpperCase(),c=S[h],u=a.levelsStyle.childs().colors.childs()[c].value();this._prices.push({formatted:t.formatPrice(r,n),price:r,coordinate:l,color:u})}}}}}var f=s(10555),w=s(69558),P=s(94602),C=s(94119),x=s(2383),V=s(10307);class I extends V.BitmapCoordinatesPaneRenderer{constructor(e,t,s){super(),this._drawRects=[],this._cacheProvider=e,this._point=t,this._label=s}hitTest(e){for(const t of this._drawRects)if(e.x>=t.left&&e.x<=t.left+t.width&&e.y>=t.top&&e.y<=t.top+t.height)return new x.HitTestResult(x.HitTarget.Regular);return null}_drawImpl(e){const t=this._cacheProvider(e),{horizontalPixelRatio:s,verticalPixelRatio:i,context:r}=e;this._drawRects=[];const l=e=>{const l=t.labelRectByIndex(e),o={left:Math.round(this._point.x-l.width+a),top:Math.round(this._point.y-l.height/2),width:l.width,height:l.height};return r.drawImage(t.canvas(),Math.round(l.left*s),Math.round(l.top*i),l.width*s,l.height*i,Math.round(o.left*s),Math.round(o.top*i),o.width*s,o.height*i),this._drawRects.push(o),l.width},o=this._label.split("/");let a=0;for(let e=0;e<o.length;e++){const t=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"].indexOf(o[e]);e>0&&(a+=l(t+11)/2),a+=l(t)/2}}}function R(e){return"P"===e?e:"S"+e[1]+"/R"+e[1]}function T(e,t,s){const i=t;void 0===e[i]?e[i]={text:s,ids:[R(s)]}:(e[i].text+="/"+s,e[i].ids.push(R(s)))}class A{constructor(e,t){this._pivots=[],this._invalidated=!0,this._renderer=new P.CompositeRenderer,this._model=e,this._source=t,this._cacheProvider=this._source.getCache.bind(this._source)}update(e){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}_updateImpl(){this._renderer.clear();const e=this._source.ownerSource();if(null===e)return;this._source.pricesView().prices(),this._pivots=[];const t=this._source.customData();if(!t||!t.pivots)return;const s=this._source.properties().childs();if(!s.visible.value())return
|
|
;const r=t.pivots,l=this._source.indexes(),o=this._model.timeScale(),a=this._source.priceScale(),n=e.firstValue();if(!a||a.isEmpty()||o.isEmpty()||!r||!l||null===n)return;const h=(0,i.ensureNotNull)(o.visibleBarsStrictRange()),c=h.firstBar(),u=h.lastBar();for(let e=0;e<r.length;e++){if(!r[e])continue;const t=l[r[e].startIndex],i=l[r[e].endIndex];if(i<c||t>u)continue;const h={},d=s.levelsStyle.childs().visibility.childs();d.P.value()&&T(h,r[e].p,"P"),d["S1/R1"].value()&&(T(h,r[e].s1,"S1"),T(h,r[e].r1,"R1")),d["S2/R2"].value()&&(T(h,r[e].s2,"S2"),T(h,r[e].r2,"R2")),d["S3/R3"].value()&&(T(h,r[e].s3,"S3"),T(h,r[e].r3,"R3")),d["S4/R4"].value()&&(T(h,r[e].s4,"S4"),T(h,r[e].r4,"R4")),d["S5/R5"].value()&&(T(h,r[e].s5,"S5"),T(h,r[e].r5,"R5"));const _=o.indexToCoordinate(t),p=o.indexToCoordinate(i);for(const t of Object.keys(h)){const s=parseFloat(t),i=a.priceToCoordinate(s,n);this._pivots.push({x1:_,x2:p,y:i,label:h[t].text,labelIds:h[t].ids,src:r[e]})}}const d=s.levelsStyle.childs().colors,_=s.levelsStyle.childs().widths,p=this._source.visiblePivots();for(let e=0;e<this._pivots.length;e++){const t=this._pivots[e];if(!p.has(t.src))continue;const i={color:d.childs()[t.labelIds[0]].value(),linewidth:_.childs()[t.labelIds[0]].value(),linestyle:w.LINESTYLE_SOLID,y:t.y,left:t.x1,right:t.x2},r=new C.HorizontalLineRenderer;r.setData(i),r.setHitTest(new x.HitTestResult(x.HitTarget.Regular)),this._renderer.append(r),s.levelsStyle.childs().showLabels.value()&&this._renderer.append(new I(this._cacheProvider,new f.Point(t.x1,t.y),t.label))}}}var L=s(24062);class B extends l{constructor(e,t,s,i,r,l){super(e,t,s,i,r,l),this._cache=null,this._cachedPixelRatioParams=null;const o=["P","S1/R1","S2/R2","S3/R3","S4/R4","S5/R5"],a=this.properties().childs().levelsStyle.childs().visibility;for(let e=0;e<o.length;e++)a.childs()[o[e]].subscribe(this,(()=>this.processHibernate()))}pricesView(){return this._pricesView}indexes(){return this._indexes}properties(){return this._properties}getCache(e){if(null===this._cache||null==this._cachedPixelRatioParams||(t=e,s=this._cachedPixelRatioParams,t.horizontalPixelRatio!==s.horizontalPixelRatio||t.verticalPixelRatio!==s.verticalPixelRatio)){this._cache&&this._cache.destroy();const t=this._getActualCacheParams(),s={horizontalPixelRatio:e.horizontalPixelRatio,verticalPixelRatio:e.verticalPixelRatio};this._cache=new n(s,t.font,t.fontSize,t.backColors),this._cache.setPrices((0,i.ensureNotNull)(this._pricesView).prices()),this._cachedPixelRatioParams=s,this._cache.reset(t)}var t,s;return this._cache}priceLabelText(e){return this._metaInfo.value().shortDescription+":"+e.toUpperCase()}updateAllViews(e){super.updateAllViews(e),this._pricesView.update()}visiblePivots(){return this._pricesView.visiblePivots()}isVisible(){if(!this.properties().childs().visible.value()||!this.isActualInterval())return!1;const e=["P","S1/R1","S2/R2","S3/R3","S4/R4","S5/R5"],t=this.properties().childs().levelsStyle.childs().visibility;for(let s=0;s<e.length;s++)if(t.childs()[e[s]].value())return!0;return!1}stop(){super.stop(),
|
|
this._cache&&(this._cache.destroy(),this._cache=null)}priceRange(e,t,s){if(s.targetPriceScale!==this.priceScale())return null;const i=this.customData()?.pivots;if(!i||!this._indexes)return null;if(!this.priceScale())return null;const r=i,l=this._indexes;let o=null;for(let s=0;s<r.length;s++){if(!r[s])continue;const i=l[r[s].startIndex];if(l[r[s].endIndex]<e||i>t)continue;const a=[],n=this.properties().childs().levelsStyle.childs().visibility.childs();n.P.value()&&a.push(r[s].p),n["S1/R1"].value()&&a.push(r[s].s1,r[s].r1),n["S2/R2"].value()&&a.push(r[s].s2,r[s].r2),n["S3/R3"].value()&&a.push(r[s].s3,r[s].r3),n["S4/R4"].value()&&a.push(r[s].s4,r[s].r4),n["S5/R5"].value()&&a.push(r[s].s5,r[s].r5);for(let e=0;e<a.length;e++)a[e]&&(null===o?o=new L.PriceRange(a[e],a[e]):o.apply(a[e],a[e]))}const a=this.priceScale();return a&&a.isLog()&&o?new L.PriceRange(a.priceToLogical(o.minValue()),a.priceToLogical(o.maxValue())):o}_createViews(){this._cache&&(this._cache.destroy(),this._cache=null),this._priceAxisViews=[];const e=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"];this._paneViews.length=0,this._labelPaneViews=[];const t=new A(this._model,this);this._paneViews.push(t);for(let t=0;t<e.length;t++){const s=new _(this,{name:e[t]});this._priceAxisViews.push(s),this._labelPaneViews.push(new p.PanePriceAxisView(s,this,this._model))}this._dataWindowView||(this._dataWindowView=new v.StudyDataWindowView(this,this._model)),this._statusView||(this._statusView=new y.StudyStatusView(this)),this._legendView=null,this._pricesView=new g(this)}_postProcessGraphics(){}_getActualCacheParams(){const e=this.properties().childs(),t=e.levelsStyle.childs().colors.childs();return{font:h.CHART_FONT_FAMILY,fontSize:e.fontsize.value(),backColors:[t.P.value(),t["S1/R1"].value(),t["S1/R1"].value(),t["S2/R2"].value(),t["S2/R2"].value(),t["S3/R3"].value(),t["S3/R3"].value(),t["S4/R4"].value(),t["S4/R4"].value(),t["S5/R5"].value(),t["S5/R5"].value()]}}}},75848:(e,t,s)=>{s.r(t),s.d(t,{study_ScriptWithDataOffset:()=>n});var i=s(50151),r=s(4148),l=s(72187),o=s(11485),a=s(64717);class n extends o.Study{constructor(e,t,s,i,r,o){super(e,t,s,i,r,o),this._underlyingData=new l.PlotList((0,a.studyPlotFunctionMap)(i),a.studyEmptyPlotValuePredicate)}clearData(){super.clearData(),this._underlyingData.clear()}_mergeData(e){this._invalidateLastNonEmptyPlotRowCache();const t=this._underlyingData.firstIndex();this._underlyingData.merge(e),t!==this._underlyingData.firstIndex()&&(this._data=new l.PlotList((0,a.studyPlotFunctionMap)(this._metaInfo.value()),a.studyEmptyPlotValuePredicate));let s=null;const i=this._data.lastIndex()??this._underlyingData.firstIndex(),o=this._underlyingData.lastIndex();if(null!==i&&null!==o)for(const e of this._underlyingData.rangeIterator(i,o))null===s&&(s=e),this._data.add(e.index,(0,r.clone)(e.value));for(const e of this._plotsForStrategyProcessing()){new h(e.strategyIndex,e.targetIndex,i).rebuildData(this._data)}return s}_plotsForStrategyProcessing(){const e=this._metaInfo.value(),t=[];return e.plots.forEach(((s,r)=>{
|
|
if("dataoffset"!==s.type)return;const l=e.plots.findIndex((e=>e.id===s.target));(0,i.assert)(l>=0,`target plot not found for strategy plot ${s.id}`),t.push({strategyIndex:r,targetIndex:l})})),t}}class h{constructor(e,t,s){this._strategyPlotIndex=e,this._targetPlotIndex=t,this._startIndex=s}rebuildData(e){const t=this._targetPlotIndex+1,s=this._strategyPlotIndex+1;let i=null,r=null;const l=this._startIndex??e.firstIndex(),o=e.lastIndex();if(null!==l&&null!==o)for(const{index:a,value:n}of e.rangeIterator(l,o)){const l=n[t],o=n[s]?Math.round(n[s]):null;if(n[t]=null,n[s]=null,!o||o>0)continue;const h=a+o,c={pointIndex:h,value:l};if(r){if(r.pointIndex!==c.pointIndex){if(h>=0){const s=e.valueAt(h);s&&(s[t]=l)}let s=!1;if(i&&r&&(s=i.value<=r.value&&r.value<=l||i.value>=r.value&&r.value>=l),s){if(r.pointIndex>=0){const s=e.valueAt(r.pointIndex);s&&(s[t]=null)}}else i=r;r=c}}else r=c}}}},10635:(e,t,s)=>{s.r(t),s.d(t,{VbPVisibleWrapper:()=>v,VolumeProfileBaseStudy:()=>d,VolumeProfileStudyWithThemedColors:()=>_,VolumeProfileWithPriceRangeStudy:()=>p});var i=s(50151),r=s(22613),l=s(24062);var o=s(36281),a=s(52859);class n extends o.PriceAxisView{constructor(e,t){super(),this._source=e,this._styleId=t}_updateRendererData(e,t,s){e.visible=!1;const i=this._source.priceScale(),r=this._source.properties().childs();if(!i||i.isEmpty()||!r.visible.value())return;const l=this._source.properties().childs().graphics.childs().horizlines?.childs()[this._styleId].childs();if(!(l&&l.visible&&l.visible.value()&&this._isLabelVisibleAccordinglyToProperties()))return;const o=this._source.model().timeScale().logicalRange(),n=this._source.firstValue();if(null===n||null===o)return;const h={price:NaN,time:-1/0},c=this._source.graphics().horizlines().get(this._styleId);if(void 0===c)return;for(const e of c){if(void 0===e.level)continue;const t=o.contains(e.startIndex,!0);t===o.contains(e.endIndex,!0)&&0!==t||h.time<e.endIndex&&(h.time=e.endIndex,h.price=e.level)}if(isNaN(h.price))return;const u=(0,a.resetTransparency)(l.color.value());s.background=u,s.textColor=this.generateTextColor(u),s.coordinate=i.priceToCoordinate(h.price,n),e.text=i.formatPrice(h.price,n,{signPositive:i.isPercentage()}),e.visible=!0}_isLabelVisibleAccordinglyToProperties(){return!!this._source.model().properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()}}var h=s(11485),c=s(96025),u=s(85082);class d extends h.Study{preferredZOrder(){return 0}async _createGraphicsPaneViews(){const e=this.metaInfo().graphics,t=this.model(),i={regularPaneViews:[],forceOverlayPaneViews:[]},r=this._needExtendToBarsEnding();if(e.hhists){const{HHistPaneView:e}=await s.e(507).then(s.bind(s,70588)),l=this.properties().childs().graphics.childs().polygons?.childs();i.regularPaneViews.push(new e(this,t,void 0,l?.histBoxBg,r))}if(e.horizlines){const{HorizLinePaneView:e}=await s.e(507).then(s.bind(s,65212));i.regularPaneViews.push(new e(this,t,void 0,r))}return i}_createGraphicsPriceAxisViews(){
|
|
return Object.keys(this.metaInfo().graphics.horizlines??{}).map((e=>new n(this,e)))}_createStudyPlotPaneView(e){return new c.StudyPlotPaneView(this,this._series,this._model,e,this._needExtendToBarsEnding())}_apiInputs(){return{...super._apiInputs(),mapRightBoundaryToBarStartTime:!!this._needExtendToBarsEnding()||void 0}}_needExtendToBarsEnding(){return void 0!==this.metaInfo().defaults.inputs?.mapRightBoundaryToBarStartTime}}class _ extends d{constructor(e,t,s,i,r,l){t.setThemedColors((0,u.volumeProfileThemedColors)(t.childs().graphics.childs().polygons?.hasChild("histBoxBg"))),super(e,t,s,i,r,l)}}class p extends _{priceRange(e,t,s){if(s.targetPriceScale!==this.priceScale())return null;let r=!1;this.graphics().hhists().forEach(((e,t)=>{r=r||(0,i.ensureDefined)(this.properties().childs().graphics.childs().hhists?.childs()[t]).value()}));const o=function(e,t,s,i){let r=null;return e.forEach((e=>{e.forEach((e=>{const i=e.firstBarTime;null!==i&&i<=s&&e.lastBarTime>=t&&(null===r?r={low:{l:e.priceLow,h:e.priceHigh},high:{h:e.priceHigh}}:(e.priceLow<r.low.l&&(r.low.l=e.priceLow,r.low.h=e.priceHigh),r.high.h=Math.max(r.high.h,e.priceHigh)))}))})),null===r?null:i?new l.PriceRange(r.low.l-.8*(r.low.h-r.low.l),r.high.h):new l.PriceRange(r.low.l,r.high.h)}(this.graphics().hhists(),e,t,r);if(null===o)return null;const a=(0,i.ensureNotNull)(this.priceScale());return a.isLog()?new l.PriceRange(a.priceToLogical(o.minValue()),a.priceToLogical(o.maxValue())):o}}class v extends p{alertCreationAvailable(){return new r.WatchedValue(!1).readonly()}_needExtendToBarsEnding(){return!1}}},85082:(e,t,s)=>{s.d(t,{volumeProfileThemedColors:()=>_});var i=s(49156);const{colorColdGray200:r,colorColdGray900:l,colorBerryPink400Alpha50:o,colorBerryPink400Alpha75:a,colorSkyBlue400Alpha50:n,colorSkyBlue400Alpha5:h,colorSkyBlue400Alpha75:c,colorSkyBlue500:u}=i.colors,d={val:[l,r],poc:[l,r],vah:[l,r],developingPoc:[l,r],developingVA:[u,u],valuesColor:[l,r],volumeColorUp:[n,n],volumeColorDown:[o,o],valueAreaColorUp:[c,c],valueAreaColorDown:[a,a],histogramBoxColor:[h,h]};function _(e){const t="graphics.horizlines",s="graphics.hhists",i=[{path:`${t}.pocLines.color`,colors:d.poc},{path:`${t}.vahLines.color`,colors:d.vah},{path:`${t}.valLines.color`,colors:d.val},{path:`${s}.histBars2.colors.0`,colors:d.volumeColorUp},{path:`${s}.histBars2.colors.1`,colors:d.volumeColorDown},{path:`${s}.histBars2.valuesColor`,colors:d.valuesColor},{path:`${s}.histBarsVA.colors.0`,colors:d.valueAreaColorUp},{path:`${s}.histBarsVA.colors.1`,colors:d.valueAreaColorDown},{path:`${s}.histBarsVA.valuesColor`,colors:d.valuesColor},{path:"styles.developingPoc.color",colors:d.developingPoc},{path:"styles.developingVAHigh.color",colors:d.developingVA},{path:"styles.developingVALow.color",colors:d.developingVA}];return e&&i.push({path:"graphics.polygons.histBoxBg.color",colors:d.histogramBoxColor}),i}},51106:(e,t,s)=>{s.r(t),s.d(t,{VolumeStudy:()=>l});var i=s(11485),r=s(11542);class l extends i.Study{base(){return 1}destroy(){super.destroy()}showOnTopOnHovering(){return!1}
|
|
chartFloatingTooltipView(){return this._model.paneForSource(this)===this._model.mainPane()?null:super.chartFloatingTooltipView()}_titleInParts(e,t,s,i,r,l){const o=super._titleInParts(e,t,s,i,r),a=this._getVolumeUnit();return a&&!l&&(o[0]+=` · ${a}`),o}_skippedTitleInputs(){return super._skippedTitleInputs()}_getVolumeUnit(){const e=this.symbolSource().symbolInfo();return e?function(e){switch(e.volume_type){case"base":return e.base_currency||void 0;case"quote":return e.currency||void 0;case"tick":return r.t(null,void 0,s(24821))}}({...e,currency:e.original_currency_code||e.currency_code}):void 0}}},34771:(e,t,s)=>{s.r(t),s.d(t,{study_Overlay:()=>He});var i=s(50151),r=s(87465),l=s(2072),o=s(49483),a=s(9343),n=s(11485),h=s(17776),c=s(91106),u=s(52746),d=s(95059),_=s(92211),p=s(43337),v=s(60911),y=s(37103),m=s(57025),b=s(36597),S=s(77380),g=s(72187),f=s(5471),w=s(24062),P=s(35727),C=s(80671),x=s(64651),V=s(36281),I=s(97902),R=s(52945),T=s(52859);const A=y.enabled("force_exchange_as_title");class L extends V.PriceAxisView{constructor(e){super(),this._source=e}_updateRendererData(e,t,s){e.visible=!1,t.visible=!1;const r=this._source.lastValueData("close",!1);if(r.noData)return;const l=this._source.model(),o=this._source.priceScale();if(null===o)return;if(!l.isPriceScaleVisible(o))return;const a=l.timeScale().visibleBarsStrictRange(),n=l.mainSeries().bars().lastIndex();if(null===a||null===n)return;if(n<=a.lastBar())s.background=(0,T.resetTransparency)(r.color),s.textColor=this.generateTextColor(r.color),e.borderVisible=!1,t.borderVisible=!1;else{const o=l.backgroundColorAtYPercentFromTop(r.coordinate/(0,i.ensureNotNull)(l.paneForSource(this._source)).height());s.background=o,s.textColor=(0,T.resetTransparency)(r.color),s.borderColor=s.textColor,e.borderVisible=!0,t.borderVisible=!0}s.coordinate=r.coordinate,s.floatCoordinate=r.floatCoordinate;const h=this._source.model().properties().childs().scalesProperties.childs();h.showSeriesLastValue.value()&&(e.text=(0,R.getCurrentModePriceText)(o,r),h.seriesLastValueMode.value()!==I.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,R.getOppositeModePriceText)(o,r),e.visible=!0),t.text="",h.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._source.aliasSymbolInfo();return A?e=(0,d.displayedSymbolExchange)(t):this._source.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,d.displayedSymbolName)(t)),e}}var B=s(30693);class D extends B.PriceLineAxisView{constructor(e){super(),this._study=e}_value(){return this._study.lastValueData("",!0)}_priceLineColor(e){return e}_lineWidth(){return 1}_isVisible(){const e=this._study.model().properties().childs().scalesProperties.childs().showSeriesLastValue.value();return this._study.properties().childs().showPriceLine.value()&&e}}var k=s(69558),F=s(94119);class N{constructor(e){this._lineRenderer=new F.HorizontalLineRenderer,this._visible=!1,this._source=e}update(){if(this._visible=!1,
|
|
!this._source.properties().childs().showPriceLine.value())return;const e=this._source.lastValueData("",!0);e.noData||(this._visible=!0,this._lineRenderer.setData({y:e.coordinate,color:e.color,linewidth:1,linestyle:k.LINESTYLE_DOTTED,visible:this._visible}))}renderer(){return this._visible?this._lineRenderer:null}}var E=s(11946),M=s(78861),O=s(36313),H=s(50335),W=s(11542),U=s(24640),z=s(56265),$=s(3885),G=s(17161),q=s(70859),j=s(63903),Q=s(53660);const Y=G.lastDayChangeAvailable||G.alwaysShowLastPriceAndLastDayChange,K=o.CheckMobile.any(),Z=(0,z.getPercentageFormatter)();var J;!function(e){e[e.Open=0]="Open",e[e.High=1]="High",e[e.Low=2]="Low",e[e.Close=3]="Close",e[e.Source=4]="Source",e[e.LastPrice=5]="LastPrice",e[e.Change=6]="Change",e[e.LastDayChange=7]="LastDayChange"}(J||(J={}));const X=Q.notAvailable,ee=`${X} (${X}%)`;class te{constructor(e,t,i=!0){this._study=e,this._model=t,this._searchNearestLeftValue=i,this._emptyValues=[{title:W.t(null,void 0,s(16610)),visible:!1,value:"",index:0,orderIndex:0,id:"open"},{title:W.t(null,void 0,s(78254)),visible:!1,value:"",index:1,orderIndex:1,id:"high"},{title:W.t(null,void 0,s(65318)),visible:!1,value:"",index:2,orderIndex:2,id:"low"},{title:W.t(null,{context:"input"},s(51408)),visible:!1,value:"",index:3,orderIndex:3,id:"close"},{title:"",visible:!1,value:"",index:4,orderIndex:4,id:"source"},{title:"",visible:!1,value:"",index:5,orderIndex:5,id:"lastPrice"},{title:W.t(null,void 0,s(37276)),visible:!1,value:"",index:6,orderIndex:6,id:"change"},{title:W.t(null,void 0,s(63815)),visible:!1,value:"",index:7,orderIndex:7,id:"lastDayChange"}]}getItems(){return this._emptyValues}getValues(e){const t=this._emptyValues.map((e=>({...e})));if(this._model.timeScale().isEmpty())return t;const s=this._study.data(),i=s.lastIndex();if(0===s.size()||null===i)return t;const r=this._searchNearestLeftValue?f.PlotRowSearchMode.NearestLeft:f.PlotRowSearchMode.Exact,l=s.search(i,r,1);if(null===l)return t;const o=this._showLastPriceAndChangeOnly();if((0,H.isNumber)(e)||(o?e=i:(e=this._model.crosshairSource().appliedIndex(),(0,H.isNumber)(e)||(e=i))),null===e||!(0,H.isNumber)(e))return t;t[0].value=X,t[1].value=X,t[2].value=X,t[3].value=X,t[7].value=ee,t[6].value=ee;const a=s.search(e,r,1),n=this._model.backgroundTopColor().value();if(null===a)return t;const h=a.index,c=a.value,u=c[1],d=c[2],_=c[3],p=c[4];for(const e of t)e.visible=!o;const v=t[4];v.visible=!1;const{barChange:m,lastDayChange:b}=(0,$.changesData)(s,this._study.quotes(),a.value,a.index,l.value),S=(0,j.getPriceValueFormatterForSource)(this._study);if((0,j.shouldBeFormattedAsPercent)(this._study)||(0,j.shouldBeFormattedAsIndexedTo100)(this._study))t[7].value="",t[6].value="";else{const e=this._study.formatter(),s={signPositive:!0};if(void 0!==m){const{currentPrice:i,prevPrice:r,change:l}=m,o=e.formatChange?.(i,r,s)??e.format(l,s);t[6].value=(0,U.forceLTRStr)(`${o} (${Z.format(m.percentChange,s)})`)}if(void 0!==b){const{currentPrice:i,prevPrice:r,change:l,percentChange:o}=b,a=e.formatChange?.(i,r,s)??e.format(l,s);t[7].value=(0,
|
|
U.forceLTRStr)(`${a} (${Z.format(o,s)})`)}}let g=null;if(o)t[5].value=null==p?X:S(p),t[5].visible=!0,g=this._getChangeColor(m?.change),t[6].visible=void 0!==m,t[7].visible=void 0!==b||Y;else{t[0].value=null==u?X:S(u),t[1].value=null==d?X:S(d),t[2].value=null==_?X:S(_),t[3].value=null==p?X:S(p),v.value=S(this._study.barFunction()(c)),t[5].visible=!1;const e=this._model.mainSeries().intervalObj().value().is1Tick(),s=21!==this._study.properties().childs().style.value();t[0].visible=!e&&s,t[1].visible=!e,t[2].visible=!e,t[7].visible=void 0!==b||Y,t[6].visible=void 0!==m;const i=this._study.barColorer().barStyle(h,!1),r=i.barBorderColor??i.barColor;g=(0,$.calculateColor)(n,r)}g=(0,T.resetTransparency)((0,$.calculateColor)(n,g));for(const e of t)e.color||(e.color=g);{const e=this._model.properties().childs().paneProperties.childs().legendProperties.childs();t[6].visible&&y.enabled("legend_bar_change_colors_based_on_value")&&e.useBarChangeCustomColors&&(t[6].color=(0,T.resetTransparency)((0,$.calculateColor)(n,this._getChangeColor(m?.change))))}return t[7].visible&&(t[7].color=(0,T.resetTransparency)((0,$.calculateColor)(n,this._getChangeColor(b?.change)))),t}_mobileNonTrackingMode(){return K&&(null===this._model.crosshairSource().pane||(0,E.isLineToolName)(M.tool.value())||null!==this._model.lineBeingEdited())}_showLastPriceAndChangeOnly(){return G.alwaysShowLastPriceAndLastDayChange||this._mobileNonTrackingMode()}_getChangeColor(e){const t=void 0===e||e>=0?q.SeriesBarColorer.upColor(this._study.properties()):q.SeriesBarColorer.downColor(this._study.properties());{const t=this._model.properties().childs().paneProperties.childs().legendProperties.childs();if(y.enabled("legend_bar_change_colors_based_on_value")&&t&&t.useBarChangeCustomColors&&t.useBarChangeCustomColors.value()){const s=void 0===e||e>=0?t.barChangeUpColor&&t.barChangeUpColor.value():t.barChangeDownColor&&t.barChangeDownColor.value();if(s)return s}}return t.barBorderColor??t.barColor}}var se=s(13212);const ie=o.CheckMobile.any();class re extends se.StudyDataWindowView{_updateImpl(){this._header=this._study.title(O.TitleDisplayTarget.DataWindow);let e;this._showLastPriceAndChangeOnly()?e=this._study.data().lastIndex():(e=this._model.crosshairSource().appliedIndex(),(null===e||isNaN(e))&&(e=this._study.data().lastIndex(),y.enabled("use_last_visible_bar_value_in_legend")&&(e=this._model.timeScale().visibleBarsStrictRange()?.lastBar()??NaN)));const t=this._valueProvider.getValues(e);for(let e=0;e<t.length;++e){const s=t[e],i=this._items[e];i.setValue(s.value),i.setVisible(s.visible),i.setColor(s.color)}}_showLastPriceAndChangeOnly(){return ie&&(null===this._model.crosshairSource().pane||(0,E.isLineToolName)(M.tool.value())||null!==this._model.lineBeingEdited())}_createValuesProvider(e,t){return new te(e,t)}}var le=s(40472);class oe extends te{constructor(e,t){super(e,t);const s=t.properties().childs().paneProperties.childs().legendProperties.childs();this._showBarChangeProp=s.showBarChange,this._showLastDayChangeProp=s.showLastDayChange,
|
|
this._showSeriesOHLCProp=s.showSeriesOHLC}getValues(e){const t=super.getValues(e),s=this._study.properties().childs(),i=s.style.value(),r=12!==i,l=this._showSeriesOHLC(),o=r&&this._showBarChangeProp.value(),a=r&&this._showLastDayChangeProp.value();if(this._showLastPriceAndChangeOnly())return t[6].visible&&=o,t[7].visible=!1,t;const n=(0,d.isPriceSourceStyle)(i),h=12!==i&&16!==i&&21!==i,c=12!==i,u=this._model.mainSeries().intervalObj().value().is1Tick(),_=l&&!n,p=l&&n;if(t[0].visible=_&&h&&!u,t[1].visible=_&&!u,t[2].visible=_&&!u,t[3].visible=_&&c,t[7].visible&&=a,t[6].visible&&=o,t[4].visible=p,16===i){const e=s.hlcAreaStyle.childs();t[1].color=e.highLineColor.value(),t[2].color=e.lowLineColor.value(),t[3].color=e.closeLineColor.value()}return t}_showSeriesOHLC(){return this._showSeriesOHLCProp.value()}}var ae=s(67455);class ne extends re{constructor(e,t){super(e,t),this._additional=null,this._studyOverlay=e,this._backgroundColorSpawn=t.backgroundTopColor().spawn(),this._backgroundColorSpawn.subscribe(this.update.bind(this,(0,le.sourceChangeEvent)(e.id())));const s=t.properties().childs().paneProperties.childs().legendProperties.childs();this._visibilityProperty=(0,ae.combineProperty)(((e,t)=>e||t),s.showBarChange.weakReference(),s.showSeriesOHLC.weakReference()),this._visibilityProperty.subscribe(this,this.update.bind(this,(0,le.sourceChangeEvent)(e.id())))}areValuesVisible(){return this._visibilityProperty.value()}additional(){return this._additional}destroy(){this._backgroundColorSpawn.destroy(),this._visibilityProperty.destroy()}_updateImpl(){super._updateImpl()}_createValuesProvider(e,t){return new oe(e,t)}}var he=s(69555),ce=s(62802),ue=s(27808),de=s(32399),_e=s(4249),pe=s(46340),ve=s(43501),ye=s(54405),me=s(85630),be=s(88732),Se=s(54370),ge=s(12965);class fe extends ge.StudyStatusProvider{getSplitTitle(){return this._source.titleInParts(O.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(O.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}: ${this.sourceStatusText()}`:`${this._source.title(O.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)} ${this.sourceStatusText()}`:this._source.title(O.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}}var we=s(55803),Pe=s(27909);class Ce extends oe{_showSeriesOHLC(){return!0}}var xe=s(28334),Ve=s(11768);class Ie{constructor(e,t){this._study=e,this._model=t,this._valuesProvider=new te(e,t,!1)}getItems(){const e=this._valuesProvider.getItems(),t=this._study.style();return(0,Ve.fillSymbolSourceValuesProviderItemsVisibility)(e,this._study.priceSource(),t,this._model),e[7].visible=!1,e}getValues(e){const t=this._study.data().lastIndex(),s=this._study.data().firstIndex();return null===t||null===s||e>t||e<s?null:this._valuesProvider.getValues(e)}}var Re=s(48943)
|
|
;const Te=y.enabled("show_symbol_logos")&&y.enabled("show_symbol_logo_in_legend")&&y.enabled("show_symbol_logo_for_compare_studies"),Ae=y.enabled("legend_last_day_change"),Le=(o.CheckMobile.any()||Te||Ae)&&!1,Be=y.enabled("study_overlay_compare_legend_option"),De=y.enabled("secondary_series_extend_time_scale"),ke=y.enabled("hide_unresolved_symbols_in_legend"),Fe=!y.enabled("hide_study_overlay_legend_item"),Ne=y.enabled("symbol_info_price_source"),Ee=(0,a.getLogger)("Chart.StudyOverlay");var Me;function Oe(e,t){return null==e[t]}!function(e){e.SnapShotSymbolInfoKey="___snapshot"}(Me||(Me={}));class He extends n.Study{constructor(e,t,s,i,r,o){super(e,function(e){e.hasChild("currencyId")||e.addChild("currencyId",new p.Property(null)),e.hasChild("unitId")||e.addChild("unitId",new p.Property(null)),(0,Se.allChartStyles)().includes(e.childs().style.value())||e.childs().style.setValueSilently(2);const t=e.childs();if(t.lineStyle.hasChild("styleType")){const e=t.lineStyle.childs(),s=e.styleType.value();let i,r;0===s&&(r=14,i=t.lineWithMarkersStyle.childs()),1===s&&(r=15,i=t.steplineStyle.childs()),i&&(i.color.setValueSilently(e.color.value()),i.linestyle.setValueSilently(e.linestyle.value()),i.linewidth.setValueSilently(e.linewidth.value()),i.priceSource.setValueSilently(e.priceSource.value())),void 0!==r&&2===t.style.value()&&t.style.setValueSilently(r),t.lineStyle.removeProperty("styleType")}return e.addExcludedKey("currencyId",1),e.addExcludedKey("unitId",1),e}(t),s,i,r,o),this._symbolResolvingActive=new l.WatchedValue(!1),this._symbolHibernated=new l.WatchedValue(!1),this._styleToRecover=null,this._isActingAsSymbolSource=new l.WatchedValue(!0),this._realignToolsLastParams=null,this._precomputedBarStyles=new WeakMap,this._lastResolvedSymbolSource="",this._data=new g.PlotList((0,u.seriesPlotFunctionMap)(),Oe),this._quotesProvider=new m.QuotesProvider(void 0,e.collapsed().spawnOwnership()),Le&&this._quotesProvider.quotesUpdate().subscribe(this,this._onQuotesUpdate);const a=this.properties().childs();a.currencyId.subscribe(this,this._onCurrencyChanged),a.unitId.subscribe(this,this._onUnitChanged),a.allowExtendTimeScale.subscribe(this,this._onAllowExtendTimeScaleChanged),this._onAllowExtendTimeScaleChanged(),a.style.subscribe(this,this._onChartStyleChanged),a.lineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),a.lineWithMarkersStyle.childs().priceSource.subscribe(this,this._updateBarFunction),a.steplineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),a.areaStyle.childs().priceSource.subscribe(this,this._updateBarFunction),a.baselineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),a.columnStyle.childs().priceSource.subscribe(this,this._updateBarFunction),this._updateBarFunction(),a.minTick.subscribe(this,this._onMinTickChanged),this._formatter=null,this._defaultFormatter=null,e.mainSeries().onIntervalChanged().subscribe(this,(()=>e.realignLineTools(this))),e.mainSeries().onIntervalChanged().subscribe(this,(()=>this._checkStyle())),
|
|
this._conflatedChunksBuilder=new we.ConflatedChunksBuilder(this._data,(e=>u.barFunctions[e])),this._symbolInfoWV=(0,ae.createWVFromGetterAndSubscriptions)((()=>this.symbolInfo()),[this.symbolResolved(),this.onStatusChanged()]),(this._aliasSymbolInfoWV||this._symbolInfoWV).subscribe((()=>this._recreatePriceFormattingDependencies())),this._overlayValuesProvider=new te(this,e),this._overlayLegendValuesProvider=new oe(this,e),this._overlayTableViewValuesProvider=new Ie(this,e),this._overlayChartFloatingTooltipValuesProvider=new Ce(this,e),this._symbolSourceWV=(0,Re.combine)((e=>e?this:super.symbolSource()),this._isActingAsSymbolSource.weakReference())}destroy(){this._model.mainSeries().onIntervalChanged().unsubscribeAll(this),this._quotesProvider.destroy(),this._symbolInfoWV.destroy(),this._symbolSourceWV.destroy(),this._aliasSymbolInfoWV?.release(),super.destroy()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}precomputedBarStyle(e){return this._precomputedBarStyles.get(e)}setPrecomputedBarStyle(e,t){this._precomputedBarStyles.set(e,t)}properties(){return this._properties}barColorer(){return new q.SeriesBarColorer({data:()=>this.data(),bars:()=>this.data(),nsBars:()=>new g.PlotList,priceScale:()=>(0,i.ensureNotNull)(this.priceScale()),properties:()=>this.properties(),firstValue:()=>this.firstValue(),barFunction:()=>this.barFunction(),lineColorAtYPercentFromTop:e=>this.lineColorAtYPercentFromTop(e)})}symbolParams(){return(0,b.symbolParams)(this)}compareSymbolParams(e){return(0,b.compareSymbolParams)(this,e,this._model.unitConversionEnabled())}async setSymbolParams(e){this._setSymbolParamsInternal(e)}symbol(){return this.properties().childs().inputs.childs().symbol.value()}symbolOrAlias(){const e=this.symbol(),t=this._model.symbolAliasService()?.getAliasByProName(e);return t?.aliasName??e}symbolChanged(){return this.properties().childs().inputs.childs().symbol}onSymbolIntervalChanged(){return this.symbolChanged()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this._properties.childs().inputs.childs().symbol.value();if(!e)return null;let t;return t=this._resolvedSymbols[this._getSymbolForResolve(e)]||null,t}symbolInfoWV(){return this._symbolInfoWV.readonly()}aliasSymbolInfo(){return(this._aliasSymbolInfoWV??this._symbolInfoWV??new l.WatchedValue(null)).value()}supportsConflatedChunks(){return!0}conflatedChunks(e,t){return this._conflatedChunksBuilder.conflatedChunks(e,t)}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,b.symbolSameAsCurrent)(e,this.symbolInfo())}symbolSameAsResolved(e){return(0,S.symbolSameAsResolved)(e,this._lastResolvedSymbolSource,this.symbol())}priceSource(){const e=this.properties().childs();switch(e.style.value()){case 2:return e.lineStyle.childs().priceSource.value();case 14:
|
|
return e.lineWithMarkersStyle.childs().priceSource.value();case 15:return e.steplineStyle.childs().priceSource.value();case 3:return e.areaStyle.childs().priceSource.value();case 10:return e.baselineStyle.childs().priceSource.value();case 13:return e.columnStyle.childs().priceSource.value()}return null}barFunction(){return this._barFunction}quotesProvider(){return this._quotesProvider}quotes(){return this._quotesProvider.quotes()}currency(){return this.properties().childs().currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,d.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this.properties().childs().unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,d.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}style(){return this.properties().childs().style.value()}setStyle(e){this.setSymbolParams({style:e})}interval(){return this._model.mainSeries().interval()}setInterval(e){}valueAt(e,t){return this.data().search(e)?.value[t]??null}symbolSource(){return this}symbolSourceWV(){return this._symbolSourceWV}barsProvider(){return this}state(e,t){const s=super.state(e,t);this._model.unitConversionEnabled()||delete s.state.unitId;const r=this.symbol();return s.state.inputs.symbol=(0,d.symbolToSaveInState)(this.symbolInfo()??this._model.chartApi().lastSymbolResolveInfo(r),r),e&&((0,i.ensureDefined)(s.data).symbols={___snapshot:this.symbolInfo()||void 0}),s}symbolTitle(e,t,s){return this.title(e,!0,{},!1,t)}title(e,t,s,i,r){const l=this._titleInParts(e,t,s,i,r);return[l[0],...l[1]??[]].join(` ${d.symbolTitleSeparator} `)}titleInParts(e,t,s,i,r){return[this.title(e,t,s,i,r)]}firstValue(){const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return null;const t=e.firstBar();if(0===this.data().size())return this._ownFirstValue;const s=this.data().search(t,f.PlotRowSearchMode.NearestRight,1);return this._ownFirstValue=null!==s?this._barFunction(s.value,0):null,this._ownFirstValue}lineColorAtYPercentFromTop(e){switch(this.style()){case 2:return this.properties().childs().lineStyle.childs().color.value();case 14:return this.properties().childs().lineWithMarkersStyle.childs().color.value();case 15:return this.properties().childs().steplineStyle.childs().color.value()}return null}lastValueData(e,t,s){const i={noData:!0},l=this.priceScale();if(this._model.timeScale().isEmpty()||null===l||l.isEmpty()||this.data().isEmpty())return i;const o=this._model.timeScale().visibleBarsStrictRange();if(null===o)return i;const a=this.properties().childs();if(!a.visible.value())return i;const n=this.nearestIndex(o.lastBar(),f.PlotRowSearchMode.NearestLeft,1);if(void 0===n)return i;const h=this.firstValue();if(null===h)return i;const c=this._lastNonEmptyPlotRow(4),u=null!==c&&o.contains(c.index),d=null!==c?c.value:null,_=t||u?d:this.data().valueAt(n);if(null===_)return i;const p=this._barFunction(_,2);if(!(0,r.isNumber)(p))return i;const v=l.priceToCoordinate(p,h);let y;switch(a.style.value()){
|
|
case 0:y=_[1]<=_[4]?a.barStyle.childs().upColor.value():a.barStyle.childs().downColor.value();break;case 1:y=_[1]<=_[4]?a.candleStyle.childs().upColor.value():a.candleStyle.childs().downColor.value();break;case 9:y=_[1]<=_[4]?a.hollowCandleStyle.childs().upColor.value():a.hollowCandleStyle.childs().downColor.value();break;case 13:y=_[1]<=_[4]?a.columnStyle.childs().upColor.value():a.columnStyle.childs().downColor.value();break;case 2:y=a.lineStyle.childs().color.value();break;case 14:y=a.lineWithMarkersStyle.childs().color.value();break;case 15:y=a.steplineStyle.childs().color.value();break;case 3:y=a.areaStyle.childs().linecolor.value();break;case 16:y=a.hlcAreaStyle.childs().closeLineColor.value();break;case 10:{const e=a.baselineStyle.childs();y=v<Math.round(l.height()*(Math.abs(100-e.baseLevelPercentage.value())/100))?e.topLineColor.value():e.bottomLineColor.value();break}case 12:y=a.hiloStyle.childs().color.value();break;case 21:y=a.hlcBarsStyle.childs().color.value();break;default:throw new Error("Not supported overlay style")}const m={...l.getFormattedValues(p,h,!0),noData:!1,floatCoordinate:v,coordinate:v,color:y};return s&&(m.price=p),m}priceRange(e,t,s){if(s.forceOverlayOnly)return null;if(!(0,r.isInteger)(e))return Ee.logDebug("priceRange: incorrect startBar"),null;if(!(0,r.isInteger)(t))return Ee.logDebug("priceRange: incorrect endBar"),null;if(0===this.data().size())return null;const i=this.priceSource();let l;l=null!==i?this.data().minMaxOnRangeCached(e,t,[{name:i,offset:0}]):this.data().minMaxOnRangeCached(e,t,[{name:"low",offset:0},{name:"high",offset:0}]);const o=null!==l?new w.PriceRange(l.min,l.max):null;return this._postProcessPriceRange(o,s)}bars(){return this.data()}open(e){return(0,i.ensureNotNull)(this.bars().valueAt(e))[1]}high(e){return(0,i.ensureNotNull)(this.bars().valueAt(e))[2]}low(e){return(0,i.ensureNotNull)(this.bars().valueAt(e))[3]}close(e){return(0,i.ensureNotNull)(this.bars().valueAt(e))[4]}hl2(e){return(this.high(e)+this.low(e))/2}hlc3(e){return(this.high(e)+this.low(e)+this.close(e))/3}ohlc4(e){return(this.open(e)+this.high(e)+this.low(e)+this.close(e))/4}canBeHiddenByGlobalFlag(){return!1}async start(e,t){this._formatter=null,this._defaultFormatter=null;const s=super.start(e,t);return this.priceScale()?.updateFormatter(),Le&&this._setQuotesSymbol((0,v.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(this.symbol()))),s}stop(e){super.stop(e),this._quotesProvider.setQuotesSessionSymbol(null)}formatter(){return this._formatter||this._recreateFormatter(),(0,i.ensureNotNull)(this._formatter)}statusView(){return Fe?super.statusView():null}moveItem(e,t,s){if(10===this.style()&&0===t){const t=(0,i.ensureNotNull)(this.priceScale()),s=this.properties().childs().baselineStyle,r=t.height(),l=100-e.y/r*100,o=l<0?0:Math.round(10*l)/10;s.childs().baseLevelPercentage.setValue(Math.max(Math.min(o,100),0))}}measureUnitId(){return(0,d.measureUnitId)(this.symbolInfo())}dataUpdated(){return this._dataUpdated}alertCreationAvailable(){
|
|
return new l.WatchedValue(!this.priceScale()?.isPercentage()&&super.alertCreationAvailable().value()).readonly()}legendValuesProvider(){return this._overlayLegendValuesProvider}tableViewValuesProvider(){return this._overlayTableViewValuesProvider}valuesProvider(){return this._overlayValuesProvider}chartFloatingTooltipValuesProvider(){return this._overlayChartFloatingTooltipValuesProvider}defaultPlotIdForAlert(){return""}tags(){const e=[],t=this.symbolInfo();if(t)e.push(t.name);else{const t=this.symbol();t&&e.push(t)}return e}statusProvider(e){return new fe(this)}inputsInParts(e,t,s,i,r){return null}_onPropertiesChanged(){super._onPropertiesChanged(),this._precomputedBarStyles=new WeakMap}async _tryChangeInputs(){await super._tryChangeInputs(),this._formatter=null,this._defaultFormatter=null,this.priceScale()?.updateFormatter()}_tryCreateFormatter(){const e=P.customFormatters?.priceFormatterFactory?.(this.symbolInfo(),this.properties().childs().minTick.value())??null;return null!==e?e:(0,d.createSeriesFormatter)(this.aliasSymbolInfo(),this.properties().childs().minTick.value())}_tryCreateDefaultFormatter(){return(0,d.createSeriesFormatter)(this.aliasSymbolInfo(),"default")}_onUnitChanged(){"alwaysOff"!==(0,c.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(),this._model.unitConversionEnabled()&&this.isStarted()&&this._tryChangeInputs(),this._unitChanged.fire()}_getSymbolObject(e){const t=super._getSymbolObject(e),s=this.currency();null!==s&&(t["currency-id"]=s);const i=this.unit();return this._model.unitConversionEnabled()&&null!==i&&(t["unit-id"]=i),t}_onSymbolResolvingStart(e,t){this._lastResolvedSymbolSource=t,super._onSymbolResolvingStart(e,t),this._symbolResolvingActive.setValue(!0)}_onSymbolError(){super._onSymbolError(),this._symbolResolvingActive.setValue(!1)}_onSymbolResolved(e,t,s){super._onSymbolResolved(e,t,s),this._recreatePriceFormattingDependencies();const i=t===this.symbol()?(0,_.extractSymbolNameFromSymbolInfo)(s,this.symbol()):null,r=(0,d.symbolCurrency)(s),l=(0,d.symbolUnit)(s,this._model.unitConversionEnabled());this._setSymbolParamsInternal({symbol:i??void 0,currency:r,unit:l},s),Le&&this._setQuotesSymbol((0,v.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(this.symbol()))),this._checkStyle(),this._symbolResolvingActive.setValue(!1)}async _changeInputsImpl(e,t){await super._changeInputsImpl(e,t),this._realignLineToolsIfParamsChanged()}_getPropertyDefinitionsViewModelClass(){return Promise.all([s.e(1861),s.e(5410),s.e(2745),s.e(7903),s.e(607)]).then(s.bind(s,70162)).then((e=>e.StudyOverlayDefinitionsViewModel))}_setQuotesSymbol(e){const t=this.symbolInfo(),s=(0,_.extractSymbolNameFromSymbolInfo)(t,e);this._quotesProvider.setQuotesSessionSymbol(s)}_onQuotesUpdate(e,t){!this._legendView||void 0===t.values.change&&void 0===t.values.change_percent||(this._legendView.update((0,le.sourceChangeEvent)(this.id())),this._model.updateSource(this))}_createViews(){this._priceAxisViews=[];const e=new L(this);this._priceAxisViewsBase=[e];const t=new D(this)
|
|
;this._priceLinesAxisViews=[t],this._paneViews=[],this._labelPaneViews=[];let s=null,r=null;switch(this.properties().childs().style.value()){case 0:r=new ce.SeriesBarsPaneView(this,this._model);break;case 1:r=new ue.SeriesCandlesPaneView(this,this._model);break;case 9:r=new ye.SeriesHollowCandlesPaneView(this,this._model);break;case 13:r=new me.SeriesColumnsPaneView(this,this._model);break;case 2:case 14:case 15:r=new de.SeriesLinePaneView(this,this._model);break;case 3:r=new _e.SeriesAreaPaneView(this,this._model);break;case 16:r=new pe.SeriesHLCAreaPaneView(this,this._model);break;case 10:{r=new ve.SeriesBaselinePaneView(this,this._model);const e=this.properties().childs().baselineStyle.childs();s=new x.SeriesWaterlinePaneView({paneHeight:()=>(0,i.ensureNotNull)(this.priceScale()).height(),color:()=>e.baselineColor.value(),baseLevelPercentage:()=>e.baseLevelPercentage.value()});break}case 12:r=new be.SeriesHiLoPaneView(this,this._model);break;case 21:r=new xe.SeriesHLCBarsPaneView(this,this._model)}r&&this._paneViews.push(r),null!==s&&this._paneViews.push(s),this._paneViews.push(new N(this)),this._dataWindowView||(this._dataWindowView=new re(this,this._model)),this._legendView||(this._legendView=new ne(this,this._model)),this._statusView||(this._statusView=new C.StudyStatusView(this)),this._floatingTooltipView||(this._floatingTooltipView=new Pe.StudyChartFloatingTooltipView(this,this._model)),this._priceAxisViews=[...this._priceAxisViewsBase],this._labelPaneViews.push(new he.PanePriceAxisView(e,this,this._model))}_createStudyOnServer(){const e=super._createStudyOnServer();return this._realignLineToolsIfParamsChanged(),e}_modifyStudyOnServer(e){super._modifyStudyOnServer(e,0)}_titleInParts(e,t,s,i,r){const l=this.symbolInfo();return[this._getSymbolTitlePart(l),[this._getExchangeTitlePart(l,r),this._getPriceSourceTitlePart(l)].filter((e=>null!==e))]}_mergeData(e){return this._invalidateLastNonEmptyPlotRowCache(),this._conflatedChunksBuilder.mergeData(e)}_clearData(){this._conflatedChunksBuilder.clearData()}_moveData(e){this._conflatedChunksBuilder.moveData(e)}_getSymbolTitlePart(e){if(null===e)return ke?"":(e=>this._model.symbolAliasService()?.getAliasByProName(e)?.aliasName??e)(this.properties().childs().inputs.childs().symbol.value());const t=this._model.symbolAliasService()?.getAliasByProName(e.pro_name)?.aliasName??e.name;if(Be)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":return e.description;case"ticker-and-description":return`${t}, ${e.description}`;case"long-description":return e.long_description??e.description}return t}_getExchangeTitlePart(e,t){return null===e||t?null:(0,d.getSymbolListedExchange)(e)}_getPriceSourceTitlePart(e){return Ne&&!1!==this._model.properties().childs().paneProperties.childs().legendProperties.childs().showPriceSource.value()&&void 0!==e?.price_source_id?this._model.availablePriceSources(this.getSymbolString(this._getSymbolForApi(this.symbol()))).name(e.price_source_id)??null:null}_onAllowExtendTimeScaleChanged(){if(!De)return
|
|
;const e=this.isStarted();e&&this.stop(!0);const t=this.properties().childs().allowExtendTimeScale.value();this.properties().childs().inputs.childs().extendTimeScale.setValue(t),e&&this.start(!0)}_setSymbolParamsInternal(e,t){const{symbol:s,currency:i,unit:r,style:l}=e,o=this.properties().childs(),a=o.inputs.childs().symbol.value(),n=o.currencyId.value(),h=o.unitId.value(),c=o.style.value();if(void 0!==s&&o.inputs.childs().symbol.setValueSilently(s),void 0!==i&&o.currencyId.setValueSilently(i),void 0!==r&&o.unitId.setValueSilently(r),void 0!==l&&o.style.setValueSilently(l),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(o.currencyId.setValueSilently((0,d.symbolCurrency)(e)),o.unitId.setValueSilently((0,d.symbolUnit)(e,this._model.unitConversionEnabled())))}o.inputs.childs().symbol.value()!==a&&o.inputs.childs().symbol.fireChanged(),o.currencyId.value()!==n&&o.currencyId.fireChanged(),o.unitId.value()!==h&&o.unitId.fireChanged(),o.style.value()!==c&&o.style.fireChanged(),this._checkStyle(),this._realignLineToolsIfParamsChanged()}_updateBarFunction(){this._barFunction=(0,h.barFunctionByStyle)(this.style(),this.priceSource())}_onMinTickChanged(){this._recreatePriceFormattingDependencies(),this.updateAllViews({type:"global-change"}),this._model.fullUpdate()}_onChartStyleChanged(){this._updateBarFunction(),this._styleToRecover?.originalStyle!==this.style()&&(this._styleToRecover=null)}_checkStyle(){const e=this.style();(0,d.isCloseBasedSymbol)(this.symbolInfo())||this.model().mainSeries().intervalObj().value().is1Tick()?(0,d.isSingleValueBasedStyle)(e)||(this.setStyle(2),this._styleToRecover={correctedStyle:this.style(),originalStyle:e}):null!==this._styleToRecover&&(this.setStyle(this._styleToRecover.originalStyle),this._styleToRecover=null)}_realignLineToolsIfParamsChanged(){let e=null===this._realignToolsLastParams;if(null!==this._realignToolsLastParams){const t=this.compareSymbolParams(this._realignToolsLastParams);e=t.symbolChanged||t.intervalChanged||t.currencyChanged||t.unitChanged}e&&(this._model.realignLineTools(this),this._realignToolsLastParams=this.symbolParams())}}}}]); |