webpackJsonp([14], [function(t, e, i) { "use strict"; function o(t, e) { function i() { this.constructor = t } v(t, e), t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, new i) } function n(t, e) { var i, o, n = {}; for (i in t) Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]); if (null != t && "function" == typeof Object.getOwnPropertySymbols) for (o = 0, i = Object.getOwnPropertySymbols(t); o < i.length; o++) e.indexOf(i[o]) < 0 && (n[i[ o]] = t[i[o]]); return n } function r(t, e, i, o) { var n, r, s = arguments.length, a = s < 3 ? e : null === o ? o = Object.getOwnPropertyDescriptor(e, i) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(t, e, i, o); else for (r = t.length - 1; r >= 0; r--)(n = t[r]) && (a = (s < 3 ? n(a) : s > 3 ? n(e, i, a) : n(e, i)) || a); return s > 3 && a && Object.defineProperty(e, i, a), a } function s(t, e) { return function(i, o) { e(i, o, t) } } function a(t, e) { if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(t, e) } function l(t, e, i, o) { return new(i || (i = Promise))(function(n, r) { function s(t) { try { l(o.next(t)) } catch (t) { r(t) } } function a(t) { try { l(o.throw(t)) } catch (t) { r(t) } } function l(t) { t.done ? n(t.value) : new i(function(e) { e(t.value) }).then(s, a) } l((o = o.apply(t, e || [])).next()) }) } function c(t, e) { function i(t) { return function(e) { return o([t, e]) } } function o(i) { if (n) throw new TypeError("Generator is already executing."); for (; l;) try { if (n = 1, r && (s = r[2 & i[0] ? "return" : i[0] ? "throw" : "next"]) && !(s = s.call( r, i[1])).done) return s; switch (r = 0, s && (i = [0, s.value]), i[0]) { case 0: case 1: s = i; break; case 4: return l.label++, { value: i[1], done: !1 }; case 5: l.label++, r = i[1], i = [0]; continue; case 7: i = l.ops.pop(), l.trys.pop(); continue; default: if (s = l.trys, !(s = s.length > 0 && s[s.length - 1]) && (6 === i[0] || 2 === i[0])) { l = 0; continue } if (3 === i[0] && (!s || i[1] > s[0] && i[1] < s[3])) { l.label = i[1]; break } if (6 === i[0] && l.label < s[1]) { l.label = s[1], s = i; break } if (s && l.label < s[2]) { l.label = s[2], l.ops.push(i); break } s[2] && l.ops.pop(), l.trys.pop(); continue } i = e.call(t, l) } catch (t) { i = [6, t], r = 0 } finally { n = s = 0 } if (5 & i[0]) throw i[1]; return { value: i[0] ? i[1] : void 0, done: !0 } } var n, r, s, a, l = { label: 0, sent: function() { if (1 & s[0]) throw s[1]; return s[1] }, trys: [], ops: [] }; return a = { next: i(0), throw: i(1), return: i(2) }, "function" == typeof Symbol && (a[Symbol.iterator] = function() { return this }), a } function h(t, e) { for (var i in t) e.hasOwnProperty(i) || (e[i] = t[i]) } function u(t) { var e = "function" == typeof Symbol && t[Symbol.iterator], i = 0; return e ? e.call(t) : { next: function() { return t && i >= t.length && (t = void 0), { value: t && t[i++], done: !t } } } } function d(t, e) { var i, o, n, r, s = "function" == typeof Symbol && t[Symbol.iterator]; if (!s) return t; i = s.call(t), n = []; try { for (; (void 0 === e || e-- > 0) && !(o = i.next()).done;) n.push(o.value) } catch (t) { r = { error: t } } finally { try { o && !o.done && (s = i.return) && s.call(i) } finally { if (r) throw r.error } } return n } function p() { for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(d(arguments[e])); return t } function _(t) { return this instanceof _ ? (this.v = t, this) : new _(t) } function f(t, e, i) { function o(t) { h[t] && (c[t] = function(e) { return new Promise(function(i, o) { u.push([t, e, i, o]) > 1 || n(t, e) }) }) } function n(t, e) { try { r(h[t](e)) } catch (t) { l(u[0][3], t) } } function r(t) { t.value instanceof _ ? Promise.resolve(t.value.v).then(s, a) : l(u[0][2], t) } function s(t) { n("next", t) } function a(t) { n("throw", t) } function l(t, e) { t(e), u.shift(), u.length && n(u[0][0], u[0][1]) } if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var c, h = i.apply(t, e || []), u = []; return c = {}, o("next"), o("throw"), o("return"), c[Symbol.asyncIterator] = function() { return this }, c } function m(t) { function e(e, n) { t[e] && (i[e] = function(i) { return (o = !o) ? { value: _(t[e](i)), done: "return" === e } : n ? n(i) : i }) } var i, o; return i = {}, e("next"), e("throw", function(t) { throw t }), e("return"), i[Symbol.iterator] = function() { return this }, i } function g(t) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var e = t[Symbol.asyncIterator]; return e ? e.call(t) : "function" == typeof u ? u(t) : t[Symbol.iterator]() } var v, y; Object.defineProperty(e, "__esModule", { value: !0 }), e.__extends = o, i.d(e, "__assign", function() { return y }), e.__rest = n, e.__decorate = r, e.__param = s, e.__metadata = a, e.__awaiter = l, e .__generator = c, e.__exportStar = h, e.__values = u, e.__read = d, e.__spread = p, e.__await = _, e .__asyncGenerator = f, e.__asyncDelegator = m, e.__asyncValues = g, v = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, e) { t.__proto__ = e } || function(t, e) { for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]) }, y = Object.assign || function(t) { var e, i, o, n; for (i = 1, o = arguments.length; i < o; i++) { e = arguments[i]; for (n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]) } return t } }, function(t, e, i) { "use strict"; (function(t) { function o(t, e) { a.call(this), this._linetool = t, this._pointindex = e, this._model = t._model, this._text = "", this._coordinate = 0, this._background = "#5592C9", this._activeBackground = "#0F6DBF", this._borderColor = "#2E84A6", this._color = "white", this._visible = !1, this._invalidated = !0, this._renderer = new l } function n(t, e) { var i, r, s; if (c.call(this), this._model = t, this._properties = e, this._pointAdded = new m, this ._pointChanged = new m, this._onRestoringFactoryDefaults = new m, this ._onTemplateApplying = new m, this._onTemplateApplied = new m, e.visible && e.frozen || this._properties.merge(defaults("linetool")), i = defaults("linetoolvisibilities"), e .intervalsVisibilities) for (r in i.intervalsVisibilities) this._properties.intervalsVisibilities[r] || this ._properties.intervalsVisibilities.addProperty(r, i.intervalsVisibilities[r]); else this._properties.merge(i); if (this._paneViews = [], this._points = [], this._fixedPoints = [], this._timePoint = [], this._currentPointsetId = null, this._properties.symbol || this._properties.merge({ symbol: t.mainSeries().symbol() }), this._properties.interval || this._properties.merge({ interval: t.mainSeries().interval() }), this._properties.addExclusion && (this._properties.addExclusion("symbol"), this ._properties.addExclusion("symbolInfo"), this._properties.addExclusion("points"), this._properties.addExclusion("interval"), this._properties.addExclusion("visible"), this._properties.addExclusion("lastUpdateTime")), this.calcIsActualSymbol(), this ._properties.intervalsVisibilities.listeners().subscribe(this, n.prototype .calcIsActualSymbol), this._properties.listeners().subscribe(this, n.prototype.propertiesChanged), this ._createPointsProperties(), "_tooltipFieldsHash" in this && !this.hasOwnProperty( "_tooltipFieldsHash") && (this._tooltipFieldsHash = $.extend(!0, {}, this ._tooltipFieldsHash)), this.m_priceAxisViews = [], this.m_timeAxisViews = [], this .pointsCount() > 0) for (s = 0; s < this.pointsCount(); s++) this.m_priceAxisViews.push(this .createPriceAxisView(s)), this.m_timeAxisViews.push(new o(this, s)); this._properties.visible.listeners().subscribe(this, function(t) { t.value() || this._model.selectedSource() !== this || this._model .setSelectedSource(null) }), this.customization = this.customization || { forcePriceAxisLabel: !1, disableSelection: !1, disableErasing: !1, disableSave: !1, showInObjectsTree: !0 }, this._properties.lastUpdateTime || this._properties.addProperty("lastUpdateTime", 0), this._syncStateExclusions = [] } var r = i(8).Point, s = i(221).LineToolPriceAxisView, a = i(222).TimeAxisView, l = i(223), c = i(46).DataSource, h = i(26), u = i(34).Interval, d = i(127).DateTimeFormatter, p = i(810), _ = i(22), f = i(7).getLogger("Chart.LineDataSource"), m = i(10), g = i(3).propertyPages, v = i(66).lineToolsInfo; inherit(o, a), o.prototype.setActive = function(t) { this._active = t }, o.prototype.update = function() { this._invalidated = !0 }, o.prototype.updateImpl = function() { var t, e, i; this._visible = !1, this._model.timeScale().isEmpty() || (t = this._linetool .axisPoints(), t.length <= this._pointindex || this._linetool === this._model .selectedSource() && (this._text = "", e = t[this._pointindex].index, this ._coordinate = this._model.timeScale().indexToCoordinate(e), i = this._model .timeScale().indexToUserTime(e), i && (this._text = new d(this._model .mainSeries().isDWM()).format(i)), this._visible = !0, this ._invalidated = !1)) }, o.prototype.renderer = function() { this._invalidated && (this.updateImpl(), this._invalidated = !1); var t = { text: this._text, coordinate: this._coordinate, color: this._color, background: this._active ? this._activeBackground : this._background, borderColor: this._borderColor, visible: this._visible }; return this._renderer.setData(t), this._renderer }, inherit(n, c), n.prototype.pointAdded = function() { return this._pointAdded }, n.prototype.pointChanged = function() { return this._pointChanged }, n.PointPriceProperty = function(e, i) { t.call(this), this._lineSource = e, this._pointIndex = i, e.pointAdded().subscribe(this, function(t) { this._pointIndex === t && this._listeners.fire(this) }), e.pointChanged().subscribe(this, function(t) { this._pointIndex === t && this._listeners.fire(this) }) }, inherit(n.PointPriceProperty, t), n.prototype.enableCurrentIntervalVisibility = function() { var t, e, i, o, n, r, s, a = u.parse(this._model.mainSeries().interval()); a.kind() === u.SECONDS && (a.multiplier() < 60 ? (this.properties() .intervalsVisibilities.seconds.setValue(!0), t = Math.min(this.properties() .intervalsVisibilities.secondsFrom.value(), a.multiplier()), this .properties().intervalsVisibilities.secondsFrom.setValue(t), e = Math.max( this.properties().intervalsVisibilities.secondsTo.value(), a .multiplier()), this.properties().intervalsVisibilities.secondsTo .setValue(e)) : a = new u(u.MINUTES, a.multiplier() / 60)), a.kind() === u.MINUTES && (a.multiplier() < 60 ? (this.properties() .intervalsVisibilities.minutes.setValue(!0), t = Math.min(this.properties() .intervalsVisibilities.minutesFrom.value(), a.multiplier()), this .properties().intervalsVisibilities.minutesFrom.setValue(t), e = Math.max( this.properties().intervalsVisibilities.minutesTo.value(), a .multiplier()), this.properties().intervalsVisibilities.minutesTo .setValue(e)) : (i = Math.floor(a.multiplier() / 60), this.properties() .intervalsVisibilities.hours.setValue(!0), o = Math.min(this.properties() .intervalsVisibilities.hoursFrom.value(), i), this.properties() .intervalsVisibilities.hoursFrom.setValue(o), n = Math.max(this.properties() .intervalsVisibilities.hoursTo.value(), i), this.properties() .intervalsVisibilities.hoursTo.setValue(n))), a.kind() === u.DAYS && (this .properties().intervalsVisibilities.days.setValue(!0), r = Math.min(this .properties().intervalsVisibilities.daysFrom.value(), a.multiplier()), this .properties().intervalsVisibilities.daysFrom.setValue(r), s = Math.max(this .properties().intervalsVisibilities.daysTo.value(), a.multiplier()), this .properties().intervalsVisibilities.daysTo.setValue(s)), a.kind() === u.WEEKS && this.properties().intervalsVisibilities.weeks.setValue(!0), a.kind() === u.MONTHS && this.properties().intervalsVisibilities.months.setValue(!0) }, n.prototype.getType = function() { return TradingView.className(this.constructor) }, n.prototype.getConstructor = function() { return this._constructor || null }, n.prototype.isActualSymbol = function() { return this._isActualSymbol }, n.prototype.isActualInterval = function() { return this._isActualInterval }, n.prototype.isSavedInChart = function(t) { return !this.customization.disableSave }, n.prototype.setSavingInChartEnabled = function(t) { this.customization.disableSave = !t }, n.prototype.showInObjectTree = function() { return this.customization.showInObjectsTree }, n.prototype.setShowInObjectsTreeEnabled = function(t) { this.customization.showInObjectsTree = t }, n.prototype.isSelectionEnabled = function() { return !this.customization.disableSelection }, n.prototype.setSelectionEnabled = function(t) { this.customization.disableSelection = !t }, n.prototype.visibilityKeyByInterval = function(t) { var e, i = u.parse(t); return n.IntervalsVisibilities.forEach(function(t) { t.kind === i.kind() && t.from <= i.multiplier() && t.to >= i.multiplier() && (e = t.key) }), e }, n.prototype.calcIsActualSymbol = function() { var t, e = this._properties.symbol, i = this._model.mainSeries(), o = e.value(); this._isActualSymbol = i.symbolSameAsCurrent(o), this._isActualSymbol && (t = i .symbol(), o !== t && (f.logWarn( 'Possible drawing "migrating" detected from "' + o + '" to "' + t + '"'), f.logWarn("Series symbolInfo: " + JSON .stringify(i.symbolInfo())), f.logWarn(Error().stack)), e.setValue(t)), this .calcIsActualInterval() }, n.prototype.calcIsActualInterval = function() { var t, e, i, o, n, r = this._properties, s = this._model.mainSeries(), a = u.parse(s.interval()), l = r.intervalsVisibilities; this._isActualInterval = !1, a.kind() === u.SECONDS && a.multiplier() < 60 && (t = l .seconds.value(), e = l.secondsFrom.value(), i = l.secondsTo.value(), this ._isActualInterval = t && a.multiplier() >= e && a.multiplier() <= i), a.kind() === u.SECONDS && a.multiplier() >= 60 && (o = Math.floor(a.multiplier() / 60), t = l.minutes.value(), e = l.minutesFrom.value(), i = l.minutesTo .value(), this._isActualInterval = t && o >= e && o <= i), a.kind() === u .MINUTES && a.multiplier() < 60 && (t = l.minutes.value(), e = l.minutesFrom .value(), i = l.minutesTo.value(), this._isActualInterval = t && a .multiplier() >= e && a.multiplier() <= i), a.kind() === u.MINUTES && a.multiplier() >= 60 && ( n = Math.floor(a.multiplier() / 60), t = l.hours.value(), e = l.hoursFrom .value(), i = l.hoursTo.value(), this._isActualInterval = t && n >= e && n <= i ), a.kind() === u.DAYS && (t = l.days.value(), e = l.daysFrom.value(), i = l .daysTo.value(), this._isActualInterval = t && a.multiplier() >= e && a .multiplier() <= i), a.kind() === u.WEEKS && (this._isActualInterval = l.weeks .value()), a.kind() === u.MONTHS && (this._isActualInterval = l.months.value()), this._isActualInterval || this._model.selectedSource() !== this || this._model .setSelectedSource(null) }, n.PointPriceProperty.prototype.value = function() { var t = this._lineSource.points()[this._pointIndex].price, e = this._lineSource.ownerSource().formatter(), i = e.parse(e.format(t)); return i.price ? i.price : i.value }, n.PointPriceProperty.prototype.setValue = function(t) { var e, i, o = this._lineSource.points()[this._pointIndex]; o.price = parseFloat(t), e = this._lineSource.priceScale(), e.isPercent() && (i = this ._lineSource.ownerSource().firstValue(), o.price = e.priceRange() .convertToPercent(o.price, i)), this._lineSource.setPoint(this._pointIndex, o), this._lineSource._model.updateSource(this._lineSource), this._listeners.fire(this), this._lineSource.endChanging(!0), this._lineSource._syncMultichartState(), this ._lineSource._properties.lastUpdateTime.setValue((new Date).valueOf()) }, n.PointIndexProperty = function(e, i) { t.call(this), this._lineSource = e, this._pointIndex = i }, inherit(n.PointIndexProperty, t), n.PointIndexProperty.prototype.value = function() { return this._lineSource.points()[this._pointIndex].index }, n.PointIndexProperty.prototype.setValue = function(t) { var e, i, o = this._lineSource.points()[this._pointIndex]; o.index = t, e = this._lineSource.priceScale(), e.isPercent() && (i = this._lineSource .ownerSource().firstValue(), o.price = e.priceRange().convertToPercent(o.price, i)), this._lineSource.setPoint(this._pointIndex, o), this._lineSource._model .updateSource(this._lineSource), this._listeners.fire(this), this._lineSource .endChanging(!0), this._lineSource._syncMultichartState(), this._lineSource ._properties.lastUpdateTime.setValue((new Date).valueOf()) }, n.prototype._syncMultichartState = function() { var t = { points: this._timePoint, interval: this._model.mainSeries().interval() }; this.linkKey && !this.properties().singleChartOnly && h.finishChangingLineTool({ model: this._model, linkKey: this.linkKey, symbol: this._model.mainSeries().symbol(), finalState: t }) }, n.prototype._createPointProperty = function(t) { var e, i = this._properties.points; i.addProperty(t), e = i[t], e.addChild("price", new n.PointPriceProperty(this, t)), e .addChild("bar", new n.PointIndexProperty(this, t)) }, n.prototype._createPointsProperties = function() { this._properties.addProperty("points"); for (var t = 0; t < this.pointsCount(); t++) this._createPointProperty(t) }, n.prototype.priceScale = function() { return this._ownerSource ? this._ownerSource.m_priceScale : null }, n.prototype.symbol = function() { return this._properties.symbol.value() }, n.prototype.properties = function() { return this._properties }, n.prototype.isSavedInStudyTemplates = function() { return !1 }, n.prototype.state = function(t) { var e = TradingView.className(this.constructor), i = { type: e, id: this.id(), state: this.properties().state(), points: this._timePoint, zorder: this.zorder(), linkKey: this.linkKey }; return i.state._isActualInterval = this.isActualInterval(), delete i.state.points, t && (i.indexes = this._points), this.ownerSource() && (i.ownerSource = this .ownerSource().id()), this.isFixed() && (i.positionPercents = this ._positionPercents || this.calcPositionPercents()), "version" in this && 1 !== this.version && (i.version = this.version), this.hasAlert.value() && (i.alertId = this._alertId), i }, n.prototype.template = function() { var t = this.properties().state(); return delete t.points, delete t.symbol, delete t.symbolInfo, t }, n.prototype.applyTemplate = function(t) { delete t.symbolInfo, this._onTemplateApplying.fire(t); var e = this.properties(); e.merge(t), e.saveDefaults(), this.propertiesChanged(), this.calcIsActualSymbol(), this .updateAllViews(), this.model().invalidate(new _(_.LIGHT_UPDATE)), this ._onTemplateApplied.fire() }, n.prototype.restoreFactoryDefaults = function() { this.properties().restoreFactoryDefaults(), this._onRestoringFactoryDefaults.fire(), this.model().updateSource(this) }, n.prototype.clearData = function() { this._points = [] }, n.prototype.currentPointsetId = function() { return "pointset_" + this._currentPointsetId }, n.prototype.stop = function() { this.clearServerPoints(), this.hasAlert.value() && TradingView.alertsDispatcher && TradingView.alertsDispatcher.deleteAlert(this._alertId) }, n.prototype.isStarted = function() { return null !== this._currentPointsetId }, n.prototype.restart = function() { this.isFixed() || (this._currentPointsetId = null, this.createServerPoints()) }, n.prototype.tryCreateServerPoints = function() { this.isFixed() || null === this._currentPointsetId && this.createServerPoints() }, n.prototype.normalizePoint = function(t) { var e = this._model.timeScale().normalizeBarIndex(t.index); return e.price = t.price, e }, n.prototype.normalizePoints = function() { var t, e; for (this._timePoint = [], t = 0; t < this._points.length; t++) { if (e = this._model.timeScale().normalizeBarIndex(this._points[t].index), !e .time_t) { this._timePoint = []; break } e.price = this._points[t].price, this._timePoint.push(e) } }, n.prototype.denormalizeTimePoints = function() { var t, e, i = []; for (t = 0; t < this._timePoint.length; t++) { if (void 0 === (e = this._model.timeScale().denormalizeTimePoint(this._timePoint[ t]))) { i = []; break } i.push({ index: e, price: this._timePoint[t].price }) } i.length > 0 && (this._points = i) }, n.prototype.restorePoints = function(t, e, i) { this._timePoint = t, this._points = e, i || this.denormalizeTimePoints() }, n.prototype.restoreExternalPoints = function(t) { if (this.properties().interval.setValue(t.interval), this._timePoint = t.points, this .denormalizeTimePoints(), !this.isActualSymbol()) return void this .clearServerPoints(); this.createServerPoints() }, n.prototype.restorePositionPercents = function(t) { this._positionPercents = t }, n.prototype.updateAllViewsAndRedraw = function() { this.updateAllViews(), this._model.updateSource(this) }, n.prototype.propertiesChanged = function() { if (this.calcIsActualInterval(), this.updateAllViewsAndRedraw(), this.linkKey) { var t = this.properties().state(this._syncStateExclusions); delete t.interval, h.changeLineStyle({ linkKey: this.linkKey, state: t, model: this._model }) } }, n.prototype.points = function() { var t, e, i = []; for (t = 0; t < this._points.length; t++) e = this._points[t], i.push({ index: e.index, price: e.price, time: e.time }); return this._lastPoint && i.push({ index: this._lastPoint.index, price: this._lastPoint.price, time: this._lastPoint.time }), this._currentMovingPoint && this._startMovingPoint && this.correctPoints(i), i }, n.prototype.axisPoints = function() { return this.points() }, n.prototype.fixedPoints = function() { var t, e, i, o, n = []; if (this._positionPercents && !this.priceScale().isEmpty()) for (t = 0; t < this._positionPercents.length; t++) e = this._positionPercents[t], i = this._model.timeScale().width() * e.x, o = this.priceScale().height() * e.y, n.push(new r(i, o)); else for (t = 0; t < this._fixedPoints.length; t++) n.push(this._fixedPoints[t].clone()); return this._lastPoint && n.push(this._lastPoint.clone()), this._currentMovingPoint && this._startMovingPoint && this.correctFixedPoints(n), n }, n.prototype._convertPriceFromPercentIfNeeded = function(t) { var e, i = this.priceScale(); i.isPercent() && (e = this.ownerSource().firstValue(), t.price = i.priceRange() .convertFromPercent(t.price, e)) }, n.prototype._convertPriceToPercentIfNeeded = function(t) { var e, i = this.priceScale(); i.isPercent() && (e = this.ownerSource().firstValue(), t.price = i.priceRange() .convertToPercent(t.price, e)) }, n.prototype._preparePoint = function(t, e) { var i = t; return e && e.shift && this.points().length >= 2 && this._properties.snapTo45Degrees && this._snapPoint45Degree(i, this.points()[this.points().length - 2]), this ._convertPriceFromPercentIfNeeded(i), i }, n.prototype.addPoint = function(t, e, i) { var o = this._preparePoint(t, e); return this._addPointIntenal(o, e, i) }, n.prototype._addPointIntenal = function(t, e, i) { this._points.push(t); var o = this._points.length === this.pointsCount(); return o ? (this._lastPoint = null, i || (this.normalizePoints(), this .createServerPoints())) : this._lastPoint = t, this._pointAdded.fire(this ._points.length - 1), o }, n.prototype.addFixedPoint = function(t) { this._fixedPoints.push(t); var e = this._fixedPoints.length === this.pointsCount(); return e && this.calcPositionPercents(), e }, n.prototype.calcPositionPercents = function() { var t, e, i, o; if (!this.priceScale() || this.priceScale().isEmpty()) return []; for (this._positionPercents = [], t = 0; t < this._fixedPoints.length; t++) e = this ._fixedPoints[0], i = e.x / this._model.timeScale().width(), o = e.y / this .priceScale().height(), this._positionPercents.push({ x: i, y: o }); return this._positionPercents }, n.prototype.calcMiddlePoint = function(t, e) { return new r((t.x + e.x) / 2, (t.y + e.y) / 2) }, n.prototype.restoreFixedPoints = function() { this._fixedPoints = this.fixedPoints() }, n.prototype.onData = function(t) { var e, i, o, n, r, s; if (t.params.customId === this.currentPointsetId() && 0 !== t.params.plots.length) { for (e = 0; e < t.params.plots.length; e++) i = t.params.plots[e], o = this ._timePoint[i.index], n = i.value[0], r = new Date(1e3 * i.value[1]), s = { index: n, time: r, price: o.price }, this._points.length <= i.index ? (this._points.push(s), this._pointAdded .fire(this._points.length - 1)) : (this._points[i.index] = s, this ._pointChanged.fire(i.index)); this.checkAlert && this.checkAlert(), this.updateAllViewsAndRedraw() } }, n.prototype.correctPricesToPercents = function() { var t, e, i = this.priceScale(), o = this.ownerSource().firstValue(); for (t = 0; t < this._points.length; t++) e = this._points[t], e.price = i.priceRange() .convertFromPercent(e.price, o), this._pointChanged.fire(t) }, n.prototype.startChanging = function(t, e) { t < this.m_priceAxisViews.length && this.m_priceAxisViews[t].setActive(!0), t < this .m_timeAxisViews.length && this.m_timeAxisViews[t].setActive(!0), this._properties .lastUpdateTime.setValue((new Date).valueOf()) }, n.prototype.setPoint = function(t, e, i) { if (i && i.shift && this._properties.snapTo45Degrees) { var o = 0 === t ? 1 : t - 1; this._snapPoint45Degree(e, this.points()[o]) } this._convertPriceFromPercentIfNeeded(e), this._points[t] = e, this._pointChanged.fire( t), this.normalizePoints() }, n.prototype.startMoving = function(t) { this.isFixed() && this.restoreFixedPoints(), this._convertPriceFromPercentIfNeeded(t), this._startMovingPoint = t, this._properties.lastUpdateTime.setValue((new Date) .valueOf()) }, n.prototype.move = function(t) { this._convertPriceFromPercentIfNeeded(t), this._currentMovingPoint = t, this .updateAllViews() }, n.prototype.correctPoints = function(t) { var e, i, o = this._currentMovingPoint.index - this._startMovingPoint.index, n = this._currentMovingPoint.price - this._startMovingPoint.price; if (0 === o && 0 === n) return !1; for (e = 0; e < t.length; e++) i = t[e], i.index += o, i.price += n, t[e] = i; return !0 }, n.prototype.correctFixedPoints = function(t) { var e, i = this._currentMovingPoint.subtract(this._startMovingPoint); for (e = 0; e < t.length; e++) t[e] = t[e].add(i) }, n.prototype.endMoving = function(t) { var e, i, o; if (this._properties.interval.setValue(this._model.mainSeries().interval()), e = !1, i = !1, this._currentMovingPoint && this._startMovingPoint) { if (e = this._currentMovingPoint.index !== this._startMovingPoint.index, i = this ._currentMovingPoint.price !== this._startMovingPoint.price, this.isFixed()) this.correctFixedPoints(this._fixedPoints); else if (this.correctPoints(this._points)) for (o = 0; o < this._points.length; o++) this._pointChanged.fire(o); this._startMovingPoint = null, this._currentMovingPoint = null } if (this.isFixed()) return this.calcPositionPercents(), void this.updateAllViews(); this.normalizePoints(), this.updateAllViews(), e && !t && this.createServerPoints(), ( i || e) && this.synchronizeAlert(!this._alertUndoMode) }, n.prototype.endChanging = function(t, e) { var i; for (this._properties.interval.setValue(this._model.mainSeries().interval()), e || (this .normalizePoints(), this.createServerPoints()), i = 0; i < this.m_priceAxisViews .length; i++) this.m_priceAxisViews[i].setActive(!1); for (i = 0; i < this.m_timeAxisViews.length; i++) this.m_timeAxisViews[i].setActive(!1); this.synchronizeAlert(!t) }, n.prototype.paneViews = function(t) { var e, i; if (this.isSourceHidden()) return null; for (e = [], i = this._paneViews.length - 1; i >= 0; --i) e.push(this._paneViews[i]); return e }, n.prototype._setPaneViews = function(t) { this._paneViews = t, this._model.invalidate(new _(_.LIGHT_UPDATE)) }, n.prototype.dataWindowView = function() { return null }, n.prototype.statusView = function() { return null }, n.prototype.isSourceHidden = function() { return !this._properties.visible.value() || h.hideAllDrawings().value() && this .canBeHidden() || !this._isActualInterval || !this._isActualSymbol }, n.prototype.priceAxisViews = function(t, e) { var i, o, n; return this.isSourceHidden() ? null : -1 !== t.dataSources().indexOf(this) && e === this .priceScale() ? this._model.lineBeingEdited() === this ? (i = this._model .linePointBeingEdited(), i < this.m_priceAxisViews.length ? (o = this .m_priceAxisViews.slice(), n = o[i], o.splice(i, 1), o.push(n), o) : this .m_priceAxisViews) : this.m_priceAxisViews : null }, n.prototype.timeAxisViews = function() { var t, e, i; return this.isSourceHidden() ? null : this._model.lineBeingEdited() === this ? (t = this ._model.linePointBeingEdited(), t < this.m_timeAxisViews.length ? (e = this .m_timeAxisViews.slice(), i = e[t], e.splice(t, 1), e.push(i), e) : this .m_timeAxisViews) : this.m_timeAxisViews }, n.prototype.updateAllViews = function() { var t, e, i; if (!this._isActualSymbol) return null; if (!this._properties.visible.value()) return null; if (null !== (t = this.paneViews())) for (e = t, i = 0; i < e.length; i++) e[i].update(); for (e = this.m_priceAxisViews, i = 0; i < e.length; i++) e[i].update(); for (e = this.m_timeAxisViews, i = 0; i < e.length; i++) e[i].update() }, n.prototype.setLastPoint = function(t, e) { this._lastPoint = this._preparePoint(t, e), this.updateAllViews() }, n.prototype.setLastFixedPoint = function(t) { this._lastFixedPoint = t, this.updateAllViews() }, n.prototype.title = function() { return "Line Tool" }, n._pointSetId = 1, n.prototype.start = function() { this.createServerPoints() }, n.prototype.createServerPoints = function() { var t, e, i, o, r, s; if (!this._recursiveGuard && this._isActualSymbol && this._model.chartApi() .connected() && (this.clearServerPoints(), !this._model.timeScale().isEmpty() && ( 0 === this._timePoint.length && this.normalizePoints(), 0 !== this._timePoint .length))) { for (this._currentPointsetId = ++n._pointSetId, t = this._model.mainSeries() .symbolId(), e = this.properties().interval.value(), i = [], o = 0; o < this ._timePoint.length; o++) r = this._timePoint[o], i.push([r.time_t, r.offset]); s = this, this._model.chartApi().createPointset(this.currentPointsetId(), "turnaround", t, e, i, function(t) { s.onData(t) }) } }, n.prototype.clearServerPoints = function() { null !== this._currentPointsetId && (this._model.chartApi().removePointset(this .currentPointsetId()), this._currentPointsetId = null) }, n.prototype.isBeingEdited = function() { return this === this._model.lineBeingEdited() || this === this._model.sourceBeingMoved }, n.prototype.isFixed = function() { return this.properties().locked && this.properties().locked.value() }, n.prototype.isLocked = n.prototype.isFrozen = function() { return this.properties().frozen && this.properties().frozen.value() }, n.prototype._tooltipFieldsHash = {}, n.prototype._tooltipFieldsOrder = ["time", "price", "index", "time0", "price0", "time1", "price1", "time2", "price2", "time3", "price3", "time4", "price4", "distance", "term", "pointsPerBar" ], n.prototype._tooltipFieldsOrdered = null, n.prototype._formatTooltip = function() { return null === this._tooltipFieldsOrdered && (this._tooltipFieldsOrdered = new p(this ._tooltipFieldsHash, p.byOrder(this._tooltipFieldsOrder))), this ._tooltipFieldsOrdered.array.filter(function(t) { return null !== t.value && "" !== t.value }).map(function(t) { return "" + t.title + ": " + t.value }).join("
") }, n.prototype.pointToScreenPoint = function(t) { var e, i, o, n, s, a, l = this._model.timeScale(), c = this.priceScale(); if (!c || c.isEmpty() || l.isEmpty()) return [new r(0, 0), new r(0, 0)]; if (e = null, c.isPercent()) { if (!this.ownerSource()) return; if (null === (e = this.ownerSource().firstValue()) || !isFinite(e)) return } return i = l.indexToCoordinate(t.index, !0), o = t.price, c.isPercent() && (o = c .priceRange().convertToPercent(o, e)), n = c.priceToCoordinate(o, !0), s = new r(i, n), i = l.indexToCoordinate(t.index, !1), n = c.priceToCoordinate(o, !1), a = new r(i, n), [s, a] }, n.prototype.screenPointToPoint = function(t) { var e = this._model.timeScale(), i = this.priceScale(), o = e.coordinateToIndex(t.x), n = i.coordinateToPrice(t.y), r = null; if (i.isPercent()) { if (!this.ownerSource()) return; if (null === (r = this.ownerSource().firstValue()) || !isFinite(r)) return } return i.isPercent() && (n = i.priceRange().convertFromPercent(n, r)), { price: n, index: o } }, n.prototype.tags = function() { return [this._constructor] }, n.prototype._snapPoint45Degree = function(t, e, i) { var o, n, r, s, a, l, c, h, u, d, p, _, f = this._model.timeScale(), m = f.indexToCoordinate(e.index), g = f.indexToCoordinate(t.index) - m, v = this.m_priceScale, y = e.price, b = t.price, S = this.ownerSource().firstValue(); v.isPercent() && (y = v.priceRange().convertToPercent(y, S)), o = v.priceToCoordinate( y), n = v.priceToCoordinate(b) - o, r = Math.round(Math.atan2(g, n) / Math.PI * 4), 2 === Math.abs(r) ? i || (t.price = y) : 0 === Math.abs(r) || 4 === Math.abs(r) ? i || (t.index = e.index) : 0 === Math.abs(r) || 4 === Math.abs(r) ? i || (t.index = e.index) : (s = Math.sqrt(g * g + n * n), a = g < 0 ? -1 : 1, l = n < 0 ? -1 : 1, c = Math.max(Math.abs(n), Math.abs(g)), h = c * Math.sqrt(2), u = h / s, c /= u, d = Math.round(f.coordinateToIndex(m + c * a)), p = Math.abs(f .indexToCoordinate(d) - m), _ = v.coordinateToPrice(o + p * l), t.index = d, t.price = _) }, n.prototype.createPriceAxisView = function(t) { return new s(this, { pointIndex: t }) }, n.prototype.version = 1, n.isLineTool = function(t) { var e = TradingView[t]; return !!e && TradingView.isInherited(e, n) }, n.prototype.alertId = function() { return this._alertId }, n.prototype.setAlert = function(t, e) {}, n.prototype.flushAlert = function() { delete this._alertId, delete this._alert, this.hasAlert.setValue(!1), window.saver && window.saver.saveChartSilently(null, !1) }, n.prototype._processAlertHanders = function(t) { var e, i, o, n = this; ("unsubscribe" !== (t = "subscribe" === t ? "subscribe" : "unsubscribe") || n ._alertCallbacks) && (i = "subscribe" === t ? "on" : "off", e = n.properties(), o = n._alertCallbacks || { flush: n.flushAlert.bind(n), hovered: function(t, e) { e ? n._model.setHoveredSource(n) : n._model.hoveredSource() === n && n ._model.setHoveredSource(null) }, selected: function(t, e) { e && n._model.setSelectedSource(n) }, synchronizeSilently: function(t) { n.synchronizeAlert(!1) } }, n._alertCallbacks || (n._alertCallbacks = o), n.getAlert().done(function(r) { r && (r[i]("destroy", o.flush), r[i]("change:hovered", o.hovered), r[i]( "change:selected", o.selected), e.extendLeft && e.extendLeft[t]( n, o.synchronizeSilently), e.extendRight && e.extendRight[t](n, o.synchronizeSilently)) })) }, n.prototype.editAlert = function() {}, n.prototype.getAlert = function(t) { var e, i = this; return t = t || {}, e = $.Deferred(), TradingView.alertsDispatcher ? TradingView .alertsDispatcher.requestAlert(i._alertId, { success: e.resolve.bind(e), error: e.reject.bind(e), fromCache: t.fromCache }) : f.logError("[Alerts] Can't get alert without alerts dispatcher"), e.promise() }, n.prototype.synchronizeAlert = function(t) { var e = this; e.hasAlert.value() && setTimeout(function() { function i() { e._alertUndoMode = !0, s.undoToCheckpoint(e._undoCheckpointAlert), setTimeout(function() { e._alertUndoMode = !1, e.localAndServerAlersMismatch = !1 }, 0) } function o(t) { var i = t.get("description") !== t.defaultDescription(), o = t.get("extra"), n = o.alertSeries(), r = e._model.mainSeries().stateForAlert(); "MainSeries" === n.type && r.actualSymbol === n.actualSymbol && (o .mainSeries(r), o.alertSeries(r)), t.set("resolution", e .stateForAlert().interval), o.drawing(e), i || t .setDefaultDescription(), e.localAndServerAlersMismatch = !0 } function n(t) { TradingView.alertsDispatcher.restartAlert(t, { success: function() { e.localAndServerAlersMismatch = !1 }, error: i, complete: function() { delete e._undoCheckpointAlert } }) } var r, s = e._getUndoHistory(); e._undoCheckpointAlert || e._alertUndoMode || (r = s.undoStack().pop(), e ._undoCheckpointAlert = s.createUndoCheckpoint(), r && s.undoStack() .push(r)), e.getAlert().done(function(e) { o(e), t && n(e) }).fail(i) }, 0) }, n.prototype._getUndoHistory = function() { return this._model._undoModel.undoHistory }, n.prototype.stateForAlert = function() { var t, e; if (this.canHasAlert()) return t = this.state(), t.id = this.idForAlert(), t.uniqueId = this.idForAlert(), t.title = this.title(), t.interval = this._model.mainSeries() .interval(), e = this._getAlertPlots(), e && (t.plots = e), t }, n.prototype._getAlertPlots = function() { return null }, n.prototype._linePointsToAlertPlot = function(t, e, i, o) { if (2 !== t.length) return f.logError("[Drawing Alert] Wrong points"), null; var n = this._model.timeScale(); return !n || n.isEmpty() ? null : { type: "LinePlot", title: e || this.title(), timestamp: n.indexToTimePoint(0), offset1: t[0].index, offset2: t[1].index, price1: t[0].price, price2: t[1].price, extendBackward: i || !1, extendForward: o || !1 } }, n.prototype.getAlertIsActive = function(t) { this.getAlert({ fromCache: !0 }).done(function(e) { t(!!e && e.get("active")) }).fail(function() { t(!1) }) }, n.prototype.geometry = function() { var t = this, e = function(e) { var i = e.x / t._model.timeScale().width(), o = e.y / t.priceScale().height(); return new r(i, o) }; return this.points().map(function(i) { var o = t.pointToScreenPoint(i)[0]; return e(o) }) }, n.prototype.onlyYMoving = function() { return !1 }, n.prototype.model = function() { return this._model }, n.prototype.isForcedDrawPriceAxisLabel = function() { return this.customization.forcePriceAxisLabel }, n.prototype.getInputsPropertyPage = function() { return g.LineToolInputsPropertyPage }, n.prototype.getVisibilitiesPropertyPage = function() { return g.LineToolVisibilitiesPropertyPage }, n.prototype.getSourceIcon = function() { var t = v[this.getType()]; return void 0 === t ? null : { type: "svg", svgCode: t.icon } }, n.prototype.destroy = function() { this.stop() }, e.LineToolPriceAxisView = s, e.LineDataSource = n }).call(e, i(25)) }, , function(t, e, i) { "use strict"; var o, n, r = i(7).getLogger("Chart.DataSourcePropertyPages"); e.propertyPages = {}, o = e.propertyPages, n = null, e.loadPropertyPages = function() { return null !== n ? n : (r.logNormal("Start loading property pages"), n = new Promise(function( t) { i.e(3).then(function(e) { o.ChartStylesPropertyPage = i(1083), o .LineToolABCDPatternStylesPropertyPage = i(1084), o .LineToolArcStylesPropertyPage = i(1085), o .LineToolArrowMarkStylesPropertyPage = i(1086), o .LineToolBalloonStylesPropertyPage = i(1087), o .LineToolBarsPatternStylesPropertyPage = i(1088) .LineToolBarsPatternStylesPropertyPage, o .LineToolBezierStylesPropertyPage = i(1089), o .LineToolBrushStylesPropertyPage = i(1090), o .LineToolCalloutStylesPropertyPage = i(1091), o .LineToolCircleLinesStylesPropertyPage = i(1092), o .LineToolDateAndPriceRangeStylesPropertyPage = i(1093), o .LineToolDateRangeStylesPropertyPage = i(1094), o .LineToolDisjointAngleStylesPropertyPage = i(1095), o .LineToolElliottStylesPropertyPage = i(1096), o .LineToolEllipseStylesPropertyPage = i(1097), o .LineToolFibChannelStylesPropertyPage = i(1098), o .LineToolFibCirclesStylesPropertyPage = i(1099), o .LineToolFibRetracementStylesPropertyPage = i(1078), o .LineToolFibSpeedResistanceArcsStylesPropertyPage = i(1100), o .LineToolFibSpeedResistanceFanStylesPropertyPage = i(1101), o .LineToolFibSpiralStylesPropertyPage = i(1102), o .LineToolFibTimeZoneStylesPropertyPage = i(1103), o .LineToolFibWedgeStylesPropertyPage = i(1104), o .LineToolFlatBottomStylesPropertyPage = i(1105), o .LineToolGannComplexStylesPropertyPage = i(1106) .LineToolGannComplexStylesPropertyPage, o .LineToolGannFixedStylesPropertyPage = i(1107) .LineToolGannFixedStylesPropertyPage, o .LineToolGannFanStylesPropertyPage = i(1108), o .LineToolGannSquareStylesPropertyPage = i(1109), o .LineToolGhostFeedInputsPropertyPage = i(400) .LineToolGhostFeedInputsPropertyPage, o .LineToolGhostFeedStylesPropertyPage = i(400) .LineToolGhostFeedStylesPropertyPage, o .LineToolHorzLineInputsPropertyPage = i(401) .LineToolHorzLineInputsPropertyPage, o .LineToolHorzLineStylesPropertyPage = i(401) .LineToolHorzLineStylesPropertyPage, o .LineToolIconStylesPropertyPage = i(1110), o .LineToolInputsPropertyPage = i(1076), o .LineToolLineTool5PointsPatternStylesPropertyPage = i(1111), o .LineToolNotePropertyPage = i(1112), o .LineToolParallelChannelStylesPropertyPage = i(1113), o .LineToolPitchfanStylesPropertyPage = i(1114), o .LineToolPitchforkStylesPropertyPage = i(1115), o .LineToolPolylineStylesPropertyPage = i(1116), o .LineToolPredictionStylesPropertyPage = i(1117), o .LineToolPriceLabelStylesPropertyPage = i(1118), o .LineToolProjectionStylesPropertyPage = i(1119), o .LineToolRectangleStylesPropertyPage = i(1120), o .LineToolRiskRewardInputsPropertyPage = i(402) .LineToolRiskRewardInputsPropertyPage, o.LineToolRiskRewardStylesPropertyPage = i(402) .LineToolRiskRewardStylesPropertyPage, o .LineToolTextStylesPropertyPage = i(1121), o .LineToolTimeCyclesPropertyPage = i(1122), o .LineToolTrendAngleInputsPropertyPage = i(403) .LineToolTrendAngleInputsPropertyPage, o .LineToolTrendAngleStylesPropertyPage = i(403) .LineToolTrendAngleStylesPropertyPage, o .LineToolTrendBasedFibExtensionStylesPropertyPage = i(1123), o .LineToolTrendBasedFibTimeStylesPropertyPage = i(1124), o .LineToolTrendLineStylesPropertyPage = i(1125), o .LineToolTrianglePatternStylesPropertyPage = i(1126), o .LineToolTriangleStylesPropertyPage = i(1127), o .LineToolVertLineInputsPropertyPage = i(404) .LineToolVertLineInputsPropertyPage, o .LineToolVertLineStylesPropertyPage = i(404) .LineToolVertLineStylesPropertyPage, o .LineToolVisibilitiesPropertyPage = i(1128), o .StudyCompareInputsPropertyPage = i(1129), o .StudyDisplayPropertyPage = i(378).StudyDisplayPropertyPage, o .StudyInputsPropertyPage = i(246).StudyInputsPropertyPage, o .StudyLineDataSourcePropertyPage = i(1130), o .StudyOverlayStylesPropertyPage = i(1131), o .StudyPivotPointsStandardStylesPropertyPage = i(1132), o .StudyStrategyPropertyPage = i(1133), o .StudyStylesPropertyPage = i(378).StudyStylesPropertyPage, o .VolumePropertyPage = i(1134), r.logNormal( "Property pages loaded"), t() }.bind(null, i)).catch(i.oe) })) } }, , function(t, e, i) { var o = i(569), n = {}, r = {}, s = {}, a = { init: function() { var t, e, i, l; Object.keys(o).forEach(function(i) { t = o[i], e = t.subsets, Array.isArray(e) ? e.forEach(function(t) { n[t] = 1 }) : e && Object.keys(e).forEach(function(t) { n[t] = 1 }), n[i] = 1 }), i = Object.keys(n), i.forEach(function(t) { i.forEach(function(i) { if (void 0 !== (l = o[i])) { if (!(e = l.subsets)) return; r.hasOwnProperty(t) || (r[t] = []), Array.isArray(e) && ~e .indexOf(t) ? r[t].push(i) : t in e && r[t].push(i) } }) }), "undefined" != typeof __initialDisabledFeaturesets && __initialDisabledFeaturesets && __initialDisabledFeaturesets.forEach(function(t) { a.disable(t) }), "undefined" != typeof __initialEnabledFeaturesets && __initialEnabledFeaturesets && __initialEnabledFeaturesets.forEach(function(t) { a.enable(t) }), "undefined" != typeof window && (window.Featuresets = a), this.meta = { _uniqueSetsNames: n, _setsReverseDependencies: r, _setsStates: s } }, enabled: function(t) { var e = function(t) { var i, o, n = r.hasOwnProperty(t) ? r[t] : []; if (!1 === s[t]) return !1; for (i = s[t], o = 0; o < n.length; ++o) i |= e(n[o]); return i }; return !!e(t) }, enable: function(t) { s[t] = !0 }, disable: function(t) { s[t] = !1 }, setEnabled: function(t, e) { s[t] = !!e }, _uniqueSets: function() { return Object.keys(n) } }; a.init(), t.exports = a }, function(t, e, i) { "use strict"; function o(t, e, i) { this._defaultName = t; var n; i ? n = e : (n = TradingView.clone(defaults(t)), e && TradingView.merge(n, e)), r.call(this, n), this._defaultName = t, this.listeners().subscribe(this, o.prototype.onPropertyChanged), this ._exclusions = [] } function n(t) { o._saveDefaults = t } var r = i(25); inherit(o, r), o._saveDefaults = !1, o.prototype.addExclusion = function(t) { this._exclusions.push(t) }, o.prototype.restoreFactoryDefaults = function() { var t, e = {}; this._defaultName.startsWith("study_") && (e = TradingView.clone(TradingView.factoryDefaults( "study"))), this._defaultName.startsWith("linetool") && (e = TradingView.clone(TradingView .factoryDefaults("linetoolvisibilities"))), t = TradingView.clone(TradingView .factoryDefaults(this._defaultName)), this._defaultName.startsWith("study_") && t .inputs && delete t.inputs.symbol, "linetoolicon" === this._defaultName && (t.icon = defaults(this._defaultName).icon), ~["linetooltext", "linetooltextabsolute", "linetoolnote", "linetoolnoteabsolute", "linetoolcallout", "linetoolballoon", "linetoolarrowmark", "linetoolarrowmarkleft", "linetoolarrowmarkup", "linetoolarrowmarkright", "linetoolarrowmarkdown", "linetoolhorzline", "linetoolhorzray" ].indexOf(this._defaultName) && delete t.text, this._exclusions.forEach(function(e) { delete t[e] }), TradingView.merge(e, t), this.merge(e), this._defaultName.startsWith("study_") || TradingView.saveDefaults(this._defaultName, this.state(this._exclusions)), this.listeners() .fire(this) }, o.prototype.cleanupFactoryDefaults = function() { var t = {}; TradingView.saveDefaults(this._defaultName, t), this.listeners().fire(this) }, o.prototype.onPropertyChanged = function() { o._saveDefaults && !this._defaultName.startsWith("study_") && this.saveDefaults() }, o.prototype.saveDefaults = function() { TradingView.saveDefaults(this._defaultName, this.state(this._exclusions)) }, o.prototype.restoreDefaults = function() { var t = TradingView.clone(defaults(this._defaultName)); this.merge(t), this.listeners().fire(this) }, o.prototype.clone = function(t) { return new o(this._defaultName, this.state(), t && t.replaceByState) }, e.DefaultProperty = o, e.saveDefaultProperties = n }, function(t, e, i) { "use strict"; (function(t) { function i() { return x } function o() { return P } function n(t) { t = Math.max(f.ERROR, Math.min(f.DEBUG, t)), x = t, u() } function r(t, e) { var i, o = 0, n = 0; for (i = t.length - 1; i >= 1 && (o += 8 * (1 + encodeURIComponent(t[i]).length), !(i - 1 > 0 && (n = 8 * (1 + encodeURIComponent(t[i - 1]).length), o + n > e))); i--); return t.slice(i) } function s(t, e, i, o, n) { var r = { id: m, message: e, subSystemId: o, timestamp: +t }; m += 1, i.unshift(r), void 0 !== n && i.length > n && (i.length = n) } function a(t) { var e, i = b.reduce(function(t, e) { return t.concat(e) }, []); return i.sort(function(t, e) { return t.id - e.id }), "number" == typeof t && (i = i.slice(-t)), e = i.map(function(t) { return new Date(t.timestamp).toISOString() + ":" + t.subSystemId + ":" + t .message.replace(/"/g, "'") }), r(e, g) } function l(t, e, i, n) { var r, a; if ((e !== w || n.id !== T) && (r = new Date, t <= f.NORMAL && s(r, e, i, n.id, n.maxCount), t <= x && (!n.highRate || o()) && (!S || n.id.match(S)))) { switch (a = r.toISOString() + ":" + n.id + ":" + e, t) { case f.DEBUG: console.debug(a); break; case f.INFO: case f.NORMAL: n.color ? console.log("%c" + a, "color: " + n.color) : console.log(a); break; case f.WARNING: console.warn(a); break; case f.ERROR: console.error(a) } w = e, T = n.id, C && clearTimeout(C), C = setTimeout(function() { w = null, T = null, C = NaN }, 1e3) } } function c(t, e) { function i(t) { return function(e) { return l(t, e, o, n) } } var o, n; return void 0 === e && (e = {}), o = [], b.push(o), n = Object.assign(e, { id: t }), { logDebug: i(f.DEBUG), logError: i(f.ERROR), logInfo: i(f.INFO), logNormal: i(f.NORMAL), logWarn: i(f.WARNING) } } function h() { P = !!p && "true" === localStorage.getItem(y); var t = parseInt(p ? localStorage.getItem(v) || "" : ""); Number.isNaN(t) && (t = f.WARNING), n(t), L.logNormal("Init with settings - level: " + x + ", high-rate: " + P) } function u() { try { p && (localStorage.setItem(y, P + ""), localStorage.setItem(v, x + "")) } catch (t) { L.logWarn("Cannot save logger state (level: " + x + ", high-rate: " + P + ") to localStorage: " + t.message) } } var d, p, _, f, m, g, v, y, b, S, w, T, C, x, P, L; Object.defineProperty(e, "__esModule", { value: !0 }), d = "undefined" != typeof window ? window : t, p = !1; try { localStorage.getItem(""), p = !0 } catch (t) {} _ = "undefined" != typeof TradingView ? TradingView : {}, function(t) { t[t.ERROR = 1] = "ERROR", t[t.WARNING = 2] = "WARNING", t[t.INFO = 3] = "INFO", t[t .NORMAL = 4] = "NORMAL", t[t.DEBUG = 5] = "DEBUG" }(f = e.LOGLEVEL || (e.LOGLEVEL = {})), m = 0, g = 75497472, v = "tv.logger.loglevel", y = "tv.logger.logHighRate", b = [], S = null, w = null, T = null, C = NaN, x = f.WARNING, P = ! 1, e.getLogLevel = i, e.isHighRateEnabled = o, e.setLogLevel = n, e.getLogHistory = a, e .getLogger = c, L = c("logger"), e.loggingOn = d.lon = _.loggingOn = function(t, e) { n(f.DEBUG), L.logNormal("Debug logging enabled"), P = !!t, S = e || null, u() }, e.loggingNormal = _.loggingNormal = function() { n(f.NORMAL), L.logNormal("Logging set to normal level") }, e.loggingOff = d.loff = function() { n(f.INFO), L.logInfo("Debug logging disabled") }, h() }).call(e, i(78)) }, function(t, e, i) { "use strict"; function o(t, e) { return new h(t, e) } function n(t, e) { return t.x === e.x && t.y === e.y } function r(t, e, i) { if (0 === t && 0 === e) throw Error("A and B can not be both equal to zero."); return { A: t, B: e, C: i } } function s(t, e) { var i, o, s; if (n(t, e)) throw Error("Points should be distinct"); return i = t.y - e.y, o = e.x - t.x, s = t.x * e.y - e.x * t.y, r(i, o, s) } function a(t, e) { if (n(t, e)) throw Error("Points of a segment should be distinct"); return [t, e] } function l(t, e) { return { edge: t, isPositive: e } } function c(t, e) { return l(t, t.A * e.x + t.B * e.y + t.C > 0) } Object.defineProperty(e, "__esModule", { value: !0 }); var h = function() { function t(t, e) { this.x = t, this.y = e } return t.prototype.add = function(e) { return new t(this.x + e.x, this.y + e.y) }, t.prototype.addScaled = function(e, i) { return new t(this.x + i * e.x, this.y + i * e.y) }, t.prototype.subtract = function(e) { return new t(this.x - e.x, this.y - e.y) }, t.prototype.dotProduct = function(t) { return this.x * t.x + this.y * t.y }, t.prototype.length = function() { return Math.sqrt(this.x * this.x + this.y * this.y) }, t.prototype.scaled = function(e) { return new t(this.x * e, this.y * e) }, t.prototype.normalized = function() { return this.scaled(1 / this.length()) }, t.prototype.transposed = function() { return new t(-this.y, this.x) }, t.prototype.clone = function() { return new t(this.x, this.y) }, t }(); e.Point = h, e.point = o, e.equalPoints = n, e.line = r, e.lineThroughPoints = s, e.lineSegment = a, e .halfplane = l, e.halfplaneThroughPoint = c }, function(t, e, i) { "use strict"; function o(t, e) { if (!t) throw Error("Assertion failed" + (e ? ": " + e : "")) } function n(t) { if (void 0 === t) throw Error("Value is undefined"); return t } function r(t) { if (null === t) throw Error("Value is null"); return t } function s(t) { return r(n(t)) } Object.defineProperty(e, "__esModule", { value: !0 }), e.assert = o, e.ensureDefined = n, e.ensureNotNull = r, e.ensure = s }, function(t, e, i) { "use strict"; (function(t) { function e() { this._listeners = [] } i(7).getLogger("Common.Delegate"); e.prototype.subscribe = function(t, e, i) { var o = { object: t, member: e, singleshot: !!i }; this._listeners.push(o) }, e.prototype.unsubscribe = function(t, e) { var i, o; for (i = 0; i < this._listeners.length; ++i) if (o = this._listeners[i], o.object === t && o.member.prototype === e.prototype) { this._listeners.splice(i, 1); break } }, e.prototype.unsubscribeAll = function(t) { var e, i; for (e = this._listeners.length - 1; e >= 0; --e) i = this._listeners[e], i.object === t && this._listeners.splice(e, 1) }, e.prototype.destroy = function() { delete this._listeners }, e.prototype.fire = function() { var t, e, i = this._listeners.slice(); for (t = 0; t < i.length; ++t) e = i[t], e.member.apply(e.object || null, arguments); for (t = this._listeners.length - 1; t >= 0; t--) this._listeners[t].singleshot && this ._listeners.splice(t, 1) }, "undefined" != typeof window && (window.Delegate = e), void 0 !== t && t && t.exports && (t.exports = e) }).call(e, i(42)(t)) }, function(t, e, i) { "use strict"; var o = function() { function t(t, e, i) { this._result = t, this._data = e, this._eraseMarker = i } return t.prototype.result = function() { return this._result }, t.prototype.data = function() { return this._data }, t.prototype.eraseMarker = function() { return this._eraseMarker }, t.MOVEPOINT_BACKGROUND = 1, t.REGULAR = 2, t.MOVEPOINT = 3, t.CHANGEPOINT = 4, t.CUSTOM = 5, t.CUSTOM_MOVE = 6, t }(); t.exports = o }, function(t, e, i) { "use strict"; function o(t) { return t ? (window._tv_languages || {})[t] || null : null } function n() { document.body && document.body.dispatchEvent(new a.CustomEvent("tradingview-i18next-initialized")) } var r, s, a, l, c, h, u, d; i(571), r = i(293), s = i(285), a = i(572), l = { translate: r.translationFunction }, window.__tradingviewI18nextInited || (c = window.language || null, h = o(c), c && h || (console .error("No translation data"), c = "en", h = o("en")), c && h ? (u = { interpolation: { prefix: "__", suffix: "__" }, keySeparator: ":::", lng: c, nsSeparator: ":::", resources: (d = {}, d[c] = { translation: h }, d) }, s.init(u, n), l.translate = s.t.bind(s), r.addTranslationFunctionToWindow(l.translate), r .addTranslationFunctionToJQuery(l.translate)) : n(), window.__tradingviewI18nextInited = !0), t .exports = l }, , , function(t, e, i) { (function(t) { function e(t) { return "number" == typeof t && isFinite(t) } function i(t) { return "string" == typeof t ? JSON.parse(t) : t } function o(t) { return null !== t && void 0 !== t && t.constructor === Function } function n(t) { return h(t) && t.then } function r(t, e) { t.prototype = Object.create(e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), t.prototype.superclass = e } function s(t, e) { for (var i in t.prototype) "function" == typeof t.prototype[i] && t.prototype .hasOwnProperty(i) && (t.prototype[i] = function() { throw Error(e + "::" + i + " is an interface member declaration and must be overloaded in order to be called" ) }) } function a(t, e, i, o) { for (var n in i.prototype) if ("function" == typeof i.prototype[n] && !t.prototype[n]) throw Error( "Interface implementation assertion failed: " + e + " does not implement " + o + "::" + n + " function") } var l, c = Array.isArray || function(t) { return "[object Array]" === Object.prototype.toString.call(t) }, h = function(t) { return "object" == typeof t && null !== t }, u = function(t) { return h(t) && -1 !== ("" + t.constructor).indexOf("function Object") }; "undefined" != typeof window ? (l = window.TradingView = window.TradingView || {}, window .isNumber = e, window.isFunction = o, window.inherit = r, window.isArray = c) : l = this .TradingView = this.TradingView || {}, l.isNaN = function(t) { return !(t <= 0 || t > 0) }, l.isAbsent = function(t) { return null === t || void 0 === t }, l.isExistent = function(t) { return null !== t && void 0 !== t }, Number.isNaN = Number.isNaN || function(t) { return t != t }, l.isSameType = function(t, e) { return Number.isNaN(t) || Number.isNaN(e) ? Number.isNaN(t) === Number.isNaN(e) : {} .toString.call(t) === {}.toString.call(e) }, l.isInteger = function(t) { return "number" == typeof t && t % 1 == 0 }, l.parseBool = function(t) { return !0 === t || "true" === t }, l.isBoolean = function(t) { return !0 === t || !1 === t }, l.isString = function(t) { return null !== t && void 0 !== t && t.constructor === String }, l.isInherited = function(t, e) { return t === e || !(!t || !t.prototype) && (void 0 !== t.prototype.superclass && null !== t.prototype.superclass && (t.prototype.superclass === e || l .isInherited(t.prototype.superclass, e))) }, l.TypeValidator = function(t) { this.m_type = t }, l.TypeValidator.prototype.check = function(t) { return t.constructor === this.m_type || l.isInherited(t.constructor, this.m_type) }, l.PredicateValidator = function(t) { this.m_predicate = t }, l.PredicateValidator.prototype.check = function(t) { return this.m_predicate(t) }, l.clone = function(t) { var e, i, o; if (!t || "object" != typeof t) return t; e = "function" == typeof t.pop ? [] : {}; for (i in t) t.hasOwnProperty(i) && (o = t[i], e[i] = o && "object" == typeof o ? l .clone(o) : o); return e }, l.deepEquals = function(t, e, i) { var n, r, s, a, h; if (i || (i = ""), t === e) return [!0, i]; if (o(t) && (t = void 0), o(e) && (e = void 0), void 0 === t && void 0 !== e) return [! 1, i ]; if (void 0 === e && void 0 !== t) return [!1, i]; if (null === t && null !== e) return [!1, i]; if (null === e && null !== t) return [!1, i]; if ("object" != typeof t && "object" != typeof e) return [t === e, i]; if (Array.isArray(t) && Array.isArray(e)) { if (n = t.length, r = e.length, n !== r) return [!1, i]; for (s = 0; s < n; s++) if (a = l.deepEquals(t[s], e[s], i + "[" + s + "]"), !a[0]) return a; return [!0, i] } if (c(t) || c(e)) return [!1, i]; for (h in t) if (a = l.deepEquals(t[h], e[h], i + "[" + h + "]"), !a[0]) return a; return [!0, i] }, l.merge = function(t, e) { for (var i in e) "object" == typeof e[i] && t.hasOwnProperty(i) ? l.merge(t[i], e[i]) : t[i] = e[i]; return t }, l.mergeObj = function(t, e) { for (var i in e) e[i].constructor === Object && t.hasOwnProperty(i) ? l.mergeObj(t[i], e[i]) : t[i] = e[i]; return t }, l.mergeWithRules = function(t, e, i, o) { var n, r; for (n in e) r = o ? o + "." + n : n, i && r in i ? t[n] = i[r](t[n], e[n]) : "object" == typeof e[n] && t.hasOwnProperty(n) ? l.merge(t[n], e[n], i, r) : t[n] = e[n] }, l.sortMultipleFunction = function() { var t = [].slice.call(arguments), e = t.length; return function(i, o) { var n, r, s, a, l, c, h; for (h = 0; h < e && (c = 0, s = t[h], a = "string" == typeof s ? s : s.name, n = i[a], r = o[a], "function" == typeof s.fn && (n = s.fn(n), r = s.fn( r)), l = s.reverse ? -1 : 1, n < r && (c = -1 * l), n > r && (c = 1 * l), 0 === c); h++); return c } }, void 0 !== t && t && t.exports && (t.exports = { inherit: r, clone: l.clone, merge: l.merge, isNumber: e, isInteger: l.isInteger, isBoolean: l.isBoolean, isString: l.isString, isObject: h, isHashObject: u, isPromise: n, isNaN: l.isNaN, isAbsent: l.isAbsent, isExistent: l.isExistent, isSameType: l.isSameType, isArray: c, parseBool: l.parseBool, parseJSONorNot: i, deepEquals: l.deepEquals, declareClassAsPureInterface: s, requireFullInterfaceImplementation: a }) }).call(e, i(42)(t)) }, , function(t, e, i) { "use strict"; (function(t) { function e() {} function i(t) { if (!(this instanceof i)) return new i(t); arguments.length > 0 && (this._value = t), this._listeners = [] } i.prototype.value = function() { return this._owner ? this._owner._value : this._value }, i.prototype.setValue = function(t, e) { var i, o, n, r = this._owner ? this._owner : this; if ("function" == typeof r.hook && (t = r.hook(t)), r.writeLock) return r._value; if (!e && r._value === t && r.hasOwnProperty("_value")) return t; for (r._value = t, i = r._listeners.slice(), o = 0, n = 0; n < i.length; n++) i[n] .once && (r._listeners.splice(n - o, 1), o++), i[n].cb(t); return t }, i.prototype.deleteValue = function() { var t, e, i, o = this._owner ? this._owner : this; if (o.hasOwnProperty("_value")) { if (o.writeLock) return o._value; for (delete o._value, t = o._listeners.slice(), e = 0, i = 0; i < t.length; i++) t[ i].once && (o._listeners.splice(i - e, 1), e++), t[i].cb() } }, i.prototype.subscribe = function(t, e) { var i, o, n; if ("function" != typeof t) throw new TypeError("callback must be a function"); i = !!e && !!e.once, o = !!e && !!e.callWithLast, n = this._owner ? this._owner : this, o && n.hasOwnProperty("_value") && (t(n._value), i) || n._listeners.push({ cb: t, owner: this, once: !!e && !!e.once }) }, i.prototype.unsubscribe = function(t) { var e, i, o = this._owner ? this._owner : this; for (void 0 === t && (t = null), e = o._listeners, i = e.length; i--;) e[i].owner !== this && o !== this || e[i].cb !== t && null !== t || e.splice(i, 1) }, i.prototype.listeners = function() { return (this._owner ? this._owner : this)._listeners }, i.prototype.readonly = function() { if (this._readonlyInstance) return this._readonlyInstance; var t = this._readonlyInstance = new e; return t.subscribe = this.subscribe.bind(this), t.unsubscribe = this.unsubscribe.bind( this), t.value = this.value.bind(this), t.when = this.when.bind(this), t.spawn = function() { return this.spawn().readonly() }.bind(this), t }, i.prototype.spawn = function() { var t = new i; return delete t._listeners, t._owner = this._owner || this, t.destroy = function() { this.unsubscribe(), delete this._owner }, t }, i.prototype.when = function(t) { var e, i = this; if (this.value()) return void t(); e = function(o) { o && (i.unsubscribe(e), t()) }, i.subscribe(e) }, i.prototype.opposite = function() { var t, e; return this._opposite || (t = this, e = new i(!this.value()), this.subscribe(function( t) { e.setValue(!t) }), e.subscribe(function(e) { t.setValue(!e) }), this._opposite = e), this._opposite }, "undefined" != typeof window && (window.WatchedValue = i), void 0 !== t && t && t .exports && (t.exports = i) }).call(e, i(42)(t)) }, , function(t, e, i) { "use strict"; function o(t, e) { var i, o; return null === t ? e : null === e ? t : (i = Math.min(t.min, e.min), o = Math.max(t.max, e.max), { min: i, max: o }) } var n, r, s, a, l, c, h, u; Object.defineProperty(e, "__esModule", { value: !0 }), n = i(9), r = i(86), s = i(7), a = s.getLogger("Chart.PlotList"), function(t) { t[t.NearestLeft = -1] = "NearestLeft", t[t.Exact = 0] = "Exact", t[t.NearestRight = 1] = "NearestRight" }(l = e.PlotRowSearchMode || (e.PlotRowSearchMode = {})), c = 30, h = -2e6, u = function() { function t(t) { void 0 === t && (t = []), this._items = [], this._plotNames = [], this._start = 0, this ._end = 0, this._shareRead = !1, this._minMaxCache = {}, this._rowSearchCache = {}, this._plotNames = t } return t.prototype.clear = function() { this._items = [], this._start = 0, this._end = 0, this._shareRead = !1, this ._minMaxCache = {}, this._rowSearchCache = {} }, t.prototype.plotNames = function() { return this._plotNames }, t.prototype.first = function() { return this.size() > 0 ? this._items[this._start] : null }, t.prototype.last = function() { return this.size() > 0 ? this._items[this._end - 1] : null }, t.prototype.firstIndex = function() { return this.size() > 0 ? this._indexAt(this._start) : null }, t.prototype.lastIndex = function() { return this.size() > 0 ? this._indexAt(this._end - 1) : null }, t.prototype.size = function() { return this._end - this._start }, t.prototype.isEmpty = function() { return 0 === this.size() }, t.prototype.contains = function(t) { return null !== this._search(t) }, t.prototype.valueAt = function(t) { var e = this.search(t); return null !== e ? e.value : null }, t.prototype.add = function(t, e) { var i, o; return this._shareRead ? (a.logDebug("add: readonly collection modification attempt"), ! 1) : (i = { index: t, value: e }, o = this._search(t), this._rowSearchCache = {}, null === o ? (this._items .splice(this._lowerbound(t), 0, i), this._start = 0, this._end = this._items .length, !0) : (this._items[o] = i, !1)) }, t.prototype.search = function(t, e) { var i, o; return void 0 === e && (e = l.Exact), this._rowSearchCache[t] && this._rowSearchCache[t] [e] ? this._rowSearchCache[t][e] : null === (i = this._search(t, e)) ? null : (o = { index: this._indexAt(i), value: this._valueAt(i) }, this._rowSearchCache[t] = this._rowSearchCache[t] || {}, this ._rowSearchCache[t][e] = o, o) }, t.prototype.fold = function(t, e) { var i, o, n, r = e; for (i = this._start; i < this._end; ++i) o = this._indexAt(i), n = this._valueAt(i), r = t(o, n, r); return r }, t.prototype.findFirst = function(t, e) { var i, o, n, r = void 0 !== e && Math.min(this._start + e, this._end) || this._end; for (i = this._start; i < r; ++i) if (o = this._indexAt(i), n = this._valueAt(i), t(o, n)) return { index: o, value: n }; return null }, t.prototype.findLast = function(t, e) { var i, o, n, r = void 0 !== e && Math.max(this._end - e, this._start) || this._start; for (i = this._end - 1; i >= r; --i) if (o = this._indexAt(i), n = this._valueAt(i), t(o, n)) return { index: o, value: n }; return null }, t.prototype.each = function(t) { var e, i, o; for (e = this._start; e < this._end && (i = this._indexAt(e), o = this._valueAt(e), !t( i, o)); ++e); }, t.prototype.reduce = function(t, e) { var i, o, n, r = e; for (i = this._start; i < this._end; ++i) o = this._indexAt(i), n = this._valueAt(i), r = t(r, o, n); return r }, t.prototype.range = function(e, i) { var o = new t; return o._items = this._items, o._start = this._lowerbound(e), o._end = Math.min(this ._lowerbound(i) + 1, o._items.length), o._shareRead = !0, o }, t.prototype.minMaxOnRange2 = function(t, e, i) { var r, s, a, l, h, u, d, p, _, f, m, g, v, y, b, S, w, T, C; if (this.isEmpty()) return null; for (r = null, s = n.ensureNotNull(this.firstIndex()), a = n.ensureNotNull(this .lastIndex()), l = 0, h = i; l < h.length; l++) { for (u = h[l], d = t - u.offset, p = e - u.offset, d = Math.max(d, s), p = Math.min( p, a), _ = Math.ceil(d / c) * c, f = Math.max(_, Math.floor(p / c) * c), m = this._lowerbound(d), g = this._upperbound(Math.min(p, _, e)), v = this ._plotMinMax(m, g, u), r = o(r, v), this._minMaxCache[u.index] || (this ._minMaxCache[u.index] = {}), y = this._minMaxCache[u.index], b = Math.max( _ + 1, d); b < f; b += c) S = Math.floor(b / c), w = y[S], void 0 === w && (T = S * c, C = (S + 1) * c - 1, w = this.minMaxOnRange(T, C, [ u ]), y[S] = w), r = o(r, w); m = this._lowerbound(f), g = this._upperbound(p), v = this._plotMinMax(m, g, u), r = o(r, v), void 0 !== u.baseValue && null !== r && (r.min = r.min ? Math.min(u .baseValue, r.min) : r.min, r.max = r.min ? Math.max(u.baseValue, r .max) : r.max) } return r }, t.prototype.minMaxOnRange = function(t, e, i) { var n, r, s, a, l, c, h = null; for (n = 0, r = i; n < r.length; n++) s = r[n], a = this._lowerbound(t - s.offset), l = Math.min(this._lowerbound(e - s.offset) + 1, this._items.length), this._items[this ._end - 1] && this._items[l - 1].index > e - s.offset && (l = a), c = this ._plotMinMax(a, l, s), h = o(h, c), void 0 !== s.baseValue && null !== h && (h.min = h.min ? Math.min(s.baseValue, h.min) : h.min, h.max = h.max ? Math.max(s .baseValue, h.max) : h.max); return h }, t.prototype.merge = function(t) { var e, i, o, n; if (this._shareRead) return a.logDebug( "merge: readonly collection modification attempt"), []; for (e = [], e.earliestRow = null, i = 0, o = t; i < o.length; i++) n = o[i], this ._invalidateCacheForRow(n), (null === e.earliestRow || e.earliestRow.index > n .index) && (e.earliestRow = n), this.add(n.index, n.value) ? e.push({ insert: n }) : e.push({ update: n }); return e }, t.prototype.addTail = function(t, e) { var i, o, n, r; for (void 0 === e && (e = !1), i = 0, e && this._end - this._start > 0 && (i = 1, this ._items[this._end - this._start - 1].value = t[0].value), o = i; o < t .length; ++o) { if (n = t[o], null === (r = this.lastIndex())) { a.logError("Can't add tail to the empty plotlist"); break } this.add(r + 1, n.value) } this._rowSearchCache = {} }, t.prototype.move = function(t) { var e, i, o, n, r, s, l, c; if (this._shareRead) return a.logDebug( "move: readonly collection modification attempt"), []; for (e = [], e.earliestRow = null, i = 0, o = t; i < o.length; i++) n = o[i], null !== ( r = this._search(n.old)) && (s = this._items[r].value, l = { index: n.old, value: s }, this._items.splice(r, 1), this._end = this._items.length, e.push({ remove: l }), this._invalidateCacheForRow(l), n.new !== h && (c = { index: n.new, value: s }, (null === e.earliestRow || e.earliestRow.index > c.index) && (e .earliestRow = c), this.add(c.index, c.value) ? e.push({ insert: c }) : e.push({ update: c }), this._invalidateCacheForRow(c))); return this._rowSearchCache = {}, e }, t.prototype.remove = function(t) { var e, i, o, n, r, s; if (this._shareRead) return a.logDebug( "remove: readonly collection modification attempt"), []; if (null === (e = this._search(t, l.NearestRight))) return []; if (i = [], o = this._items.splice(e), o.length > 0) for (i.earliestRow = o[0], n = 0, r = o; n < r.length; n++) s = r[n], i.push({ remove: s }); return this._end = this._items.length, this._minMaxCache = {}, this ._rowSearchCache = {}, i }, t.prototype.state = function() { return { columns: this._plotNames, start: this._start, end: this._end, data: this._items, shareread: this._shareRead } }, t.prototype.restoreState = function(t) { if (!t) return void this.clear(); this._plotNames = t.columns, this._start = t.start, this._end = t.end, this._shareRead = t.shareread, this._items = t.data, this._minMaxCache = {}, this._rowSearchCache = {} }, t.prototype._indexAt = function(t) { return this._items[t].index }, t.prototype._valueAt = function(t) { return this._items[t].value }, t.prototype._length = function() { return this._items.length }, t.prototype._search = function(t, e) { var i, o = this._bsearch(t); return null === o && e ? e < 0 ? (i = this._lowerbound(t), i > this._start && (i -= 1), i !== this._end && this._indexAt(i) < t ? i : null ) : (i = this._upperbound(t), i !== this._end && t < this._indexAt(i) ? i : null) : o }, t.prototype._bsearch = function(t) { var e = this._lowerbound(t); return e === this._end || t < this._items[e].index ? null : e }, t.prototype._lowerbound = function(t) { return r.lowerbound(this._items, t, function(t, e) { return t.index < e }, this._start, this._end) }, t.prototype._upperbound = function(t) { return r.upperbound(this._items, t, function(t, e) { return e.index > t }, this._start, this._end) }, t.prototype._plotMinMax = function(t, e, i) { var o, n, r, s = null; for (o = t; o < e; o++) n = this._items[o].value, void 0 === (r = n[i.index]) || null === r || Number.isNaN(r) || (null === s ? s = { min: r, max: r } : (r < s.min && (s.min = r), r > s.max && (s.max = r))); return s }, t.prototype._invalidateCacheForRow = function(t) { var e, i = Math.floor(t.index / c); for (e = 0; e < this._plotNames.length; e++) this._minMaxCache[e] && delete this ._minMaxCache[e][i] }, t }(), e.PlotList = u, e.mergeMinMax = o }, , function(t, e, i) { "use strict"; (function(e) { function o(t, e, i, o) { this._map = $.extend({}, this._map, o), e && (e = this.unpackLevels(e)), r.call(this, t, e, i), this.updateCollectibleProperty() } var n = i(15).isSameType, r = i(6).DefaultProperty, s = i(809); inherit(o, r), o.prototype.state = function(t, i) { t = t || [], t.push("__collectibleLines"); var o = e.prototype.state.call(this, t); return i ? o : this.packLevels(o) }, o.prototype.clone = function() { var t = this.state(); return this.__collectibleLines && (t.__collectibleLines = this.__collectibleLines .state()), new o(this._defaultName, t) }, o.prototype.merge = function(t) { e.prototype.merge.call(this, this.unpackLevels(t)), this.updateCollectibleProperty() }, o.prototype._map = { prefixes: [""], range: [0, 0], names: ["coeff", "color", "visible", "linestyle", "linewidth"], typecheck: { pack: Object, unpack: Array } }, o.prototype._packLvlTpl = function() { return [] }, o.prototype._unpackLvlTpl = function() { return {} }, o.prototype._packLvlFill = function(t, e, i, o) { return o.push(i[e]), o }, o.prototype._unpackLvlFill = function(t, e, i, o) { return o[e] = i[t], o }, o.prototype._iterateLevels = function(t, e) { var i, o, r, s, a; for (i in this._map.prefixes) for (o = (this._map.prefixes[i] || "") + "level", r = this._map.range[0]; r <= this ._map.range[1]; r++) if (t[o + r] && n(t[o + r], e.typecheck())) { s = e.tpl(); for (a in this._map.names) s = e.fill(a, this._map.names[a], t[o + r], s); t[o + r] = s } return t }, o.prototype.packLevels = function(t) { return this._iterateLevels(t, { tpl: this._packLvlTpl, fill: this._packLvlFill, typecheck: this._map.typecheck.pack }) }, o.prototype.unpackLevels = function(t) { return this._iterateLevels(t, { tpl: this._unpackLvlTpl, fill: this._unpackLvlFill, typecheck: this._map.typecheck.unpack }) }, o.prototype.saveDefaults = function() { TradingView.saveDefaults(this._defaultName, this.state(this._exclusions, !0)) }, o.prototype.updateCollectibleProperty = function() { var t, e; this.__collectibleLines && (t = this, e = [], this.__collectibleLines._childs.forEach( function(i) { var o, n = t.__collectibleLines[i].value(), r = n.split("."), s = t[r[0]]; for (o = 1; o < r.length && s; ++o) s = s[r[o]]; s && e.push({ property: s.color, defaultValue: s.color.value() }) }), this.collectibleColors ? this.collectibleColors.reloadProperties(e) : this.collectibleColors = new s(e)) }, t.exports = o }).call(e, i(25)) }, function(t, e, i) { "use strict"; function o(t) { this._invalidationLevel = t || o.UPDATE_CURSOR_ONLY, this._invalidatedPanes = {} } o.UPDATE_CURSOR_ONLY = 1, o.LIGHT_UPDATE = 2, o.FULL_UPDATE = 3, o.prototype.invalidatePane = function( t, e) { this._invalidatedPanes[t] ? this._invalidatedPanes[t] = Math.max(this._invalidatedPanes[t], e) : this._invalidatedPanes[t] = e }, o.prototype.invalidateAll = function(t) { this._invalidationLevel = Math.max(this._invalidationLevel, t) }, o.prototype.fullInvalidation = function() { return this._invalidationLevel }, o.prototype.invalidateForPane = function(t) { return this._invalidatedPanes[t] ? Math.max(this._invalidatedPanes[t], this ._invalidationLevel) : this._invalidationLevel }, o.prototype.merge = function(t) { this.force = this.force || t.force, this._invalidationLevel = Math.max(this._invalidationLevel, t._invalidationLevel); for (var e in t._invalidatedPanes) this._invalidatedPanes[e] ? this._invalidatedPanes[e] = Math .max(this._invalidatedPanes[e], t._invalidatedPanes[e]) : this._invalidatedPanes[e] = t ._invalidatedPanes[e] }, o.prototype.exclude = function(t) { this._invalidationLevel <= t && (this._invalidationLevel = 0); for (var e in this._invalidatedPanes) this._invalidatedPanes[e] <= t && (this._invalidatedPanes[ e] = 0) }, t.exports = o }, function(t, e, i) { "use strict"; function o(t, e, i) { h[t].unsubscribe(i, e) } function n(t, e, i) { r(t, e, i) } function r(t, e, i, o) { if (h.hasOwnProperty(t) || (h[t] = new c), d[t]) return void e.call(i); h[t].subscribe(i, e, o) } function s(t) { u.push(t) } function a(t) { var e, i, o = []; for (e = 1; e < arguments.length; e++) o[e - 1] = arguments[e]; i = [t].concat(o), u.forEach(function(t) { t.apply(null, i) }), h.hasOwnProperty(t) && h[t].fire.apply(h[t], o) } function l(t) { d[t] && console.warn("Something went wrong: emitOnce called multiple times with same event (" + t + ")"), d[t] = !0, a.apply(null, arguments) } var c, h, u, d; Object.defineProperty(e, "__esModule", { value: !0 }), c = i(10), h = {}, u = [], d = {}, e.unsubscribe = o, e.on = n, e.subscribe = r, e .subscribeToAll = s, e.emit = a, e.emitOnce = l }, function(t, e, i) { "use strict"; (function(t, e, o) { var n, r, s, a, l; i(64), n = i(200).regExpEscape, r = i(93).TVXWindowEvents, s = i(199).TVLocalStorage, a = [ "s.tradingview.com", "betacdn.tradingview.com" ], l = window.TVSettings = function() { function i(t) { return D + "." + t } function o(t, e) { var i; return i = V[t], window.is_authenticated && !W || null != i || (i = V[t]), null == i ? e : i } function c(t, e) { var i = o(t, void 0); if (null == i) return e; try { return JSON.parse(i) } catch (i) { return f(t), e } } function h(t, e) { var i = o(t); return null == i ? e : !(!i || "false" === i || 0 == +i) } function u(t, e, i) { var n, r = o(t, void 0, i); if (null == r) return e; if (n = parseFloat(r), !isFinite(n)) throw new TypeError('"' + r + '" is not float (key: "' + t + '")'); return n } function d(t, e, i) { var n, r = o(t, void 0, i); if (null == r) return e; if (n = parseInt(r, 10), !isFinite(n)) throw new TypeError('"' + r + '" is not int (key: "' + t + '")'); return n } function p(t, e, i) { i = i || {}; var o = "" + e; return V[t] !== o && (V[t] = o, g(t)), i.forceFlush && !B && (B = setTimeout( function() { B = void 0, v() }, E)), l } function _(t, e, i) { return p(t, JSON.stringify(e), i), l } function f(t, e) { return e = e || {}, null != V[t] && (delete V[t], g(t)), e.forceFlush && v(), l } function m() { R = void 0, O.length && v() } function g(t) { if (H) null == V[t] ? H.removeValue(i(t)) : H.setValue(i(t), V[t]); else if (!window.is_authenticated || W) try { null == V[t] ? s.removeItem(i(t)) : s.setItem(i(t), V[t]) } catch (t) {} else O.push(t), R || (R = setTimeout(m, M)); r.emit("settings", JSON.stringify({ key: t, value: V[t] })) } function v(e) { var i, o, n, r, s; if (!t.enabled("widget") && window.is_authenticated && !W && 0 !== O.length) { for (i = O, O = [], o = {}, n = i.length; n--;) r = i[n], s = V[r], void 0 === s && (s = null), o[r] = s; $.ajax({ url: "/savesettings/", type: "POST", data: { delta: JSON.stringify(o) }, async: !e }) } } function y() { var t, e, i; for (t = 0; t < s.length; t++) e = s.key(t), i = D.length, e.substring(0, i + 1) === D + "." && (O = [], s.removeItem(e)); $.post("/restoredefaults/", {}, function(t) { TVDialogs.showNotice("Success", "Defaults has been successfully restored") }).error(function(t) {}) } function b() { return Object.keys(V) } function S(t, e) { var i, o = b(e), r = []; for (t = RegExp("^" + n(t).replace(/\\\*\\\*/gi, ".+").replace(/\\\*/gi, "[^.]+") + "$", "gi"), i = o.length - 1; i >= 0; i--) t.test(o[i]) && r.push(o[i]), t .lastIndex = 0; return r } function w(t) { for (var e = 0; e < z.length; ++e) if (z[e].exec(t)) return !0; return !1 } function T() { var e, i, o, n, r; for (V = {}, e = D + ".", i = !t.enabled("save_chart_properties_to_local_storage"), o = s.length; o--;)(n = s.key(o)) && n.substring(0, e.length) === e && (r = n .substring(e.length), i && !w(r) || (V[r] = s.getItem(n))) } function C(t) { var e, i, o, n, r; for (V = {}, e = 0 === Object.keys(t).length, i = D + ".", o = s.length; o--;)(n = s .key(o)) && n.substring(0, i.length) === i && (e && (r = n.substring(i .length), p(r, s.getItem(n))), s.removeItem(n)); Object.keys(t).forEach(function(e) { V[e] = t[e] + "" }) } function x() { var t, e, i, o; if (TradingView.onWidget() && a.includes(window.location.host)) for (t = "tradingview.", e = s.length; e--;) i = s.key(e), 0 === i.indexOf(t) && (o = i.replace(t, D + "."), s.setItem(o, s.getItem(i)), s.removeItem(i)) } function P(t) { H ? C(H.initialSettings || {}) : window.is_authenticated && !W ? C(t || {}) : (x(), T()), F.fire() } function L(t) { H = t } var I, k, A, M, E, D, V, O, R, B, z, F, N = !1, W = t.enabled("cqg_terminal"), H = null; try { N = !TradingView.onWidget() && parent && parent !== window && !!parent.IS_DEMO_PAGE } catch (t) {} return N ? (I = { "widgetbar.layout-settings": { widgets: {}, settings: { minimized: !0 } }, notShowMainWizard: !0 }, k = function(t, e, i) { var o = I[t]; return null == o ? e : o }, A = function() {}, { loaded: !1, loadedModel: !1, getValue: k, getJSON: k, getBool: k, getFloat: k, getInt: k, setValue: A, setJSON: A, remove: A, restoreDefaults: A, keys: function() { return Object.keys(I) }, keysMask: function() { return [] }, sync: A, onSync: { subscribe: function() {} } }) : (M = 12e4, E = 10, "local" === window.environment && (M = 5e3), D = TradingView .onWidget() ? "tradingview-widget" : "tradingview", V = {}, O = [], z = [ /^widgetbar\.widget\.watchlist.+/, /.+quicks$/, /^widgetbar\.layout-settings$/, /^ChartSideToolbarWidget\.visible$/, /^onwidget\.watchlist$/, /^domepanel.visible$/, /^chart\.favoriteDrawings$/, /^chart\.favoriteDrawingsPosition$/, /^ChartFavoriteDrawingToolbarWidget\.visible/, /^trading\.chart\.proterty$/, /^trading_floating_toolbar\.position$/ ], r.on("settings", function(t) { var e = JSON.parse(t); null == e.value ? delete V[e.key] : V[e.key] = e.value }), F = new e, document.addEventListener("visibilitychange", function() { "hidden" !== document.visibiltyState && !0 !== document.hidden || v() }), window.addEventListener("unload", function() { v(!0) }), { loaded: !1, loadedModel: !1, getValue: o, getJSON: c, getBool: h, getFloat: u, getInt: d, setValue: p, setJSON: _, remove: f, restoreDefaults: y, keys: b, keysMask: S, sync: P, onSync: F, setSettingsAdapter: L }) }(), void 0 !== o && o && o.exports && (o.exports = l) }).call(e, i(5), i(10), i(42)(t)) }, function(t, e, i) { "use strict"; (function(e) { function i(t) { if (this._listeners = new e, this._childs = [], void 0 !== t && null !== t) if (this.isPrimitiveType(t)) this._value = t; else for (var i in t) this.addProperty(i, t[i]) } i.prototype.merge = function(t) { var e, i; if (null != t) if (this.isPrimitiveType(t)) this._value = t; else if (Array.isArray(t)) for (e = 0; e < t.length; e++) this[e] ? this[e].merge(t[e]) : this.addProperty(e, t[e]); else for (i in t) this[i] ? this[i].merge(t[i]) : this.addProperty(i, t[i]) }, i.prototype.state = function(t) { var e, i, o, n, r, s = this._value; for (void 0 === s && (s = {}), e = 0; e < this._childs.length; e++) if (i = this._childs[e], !t || -1 === t.indexOf(i)) if (t) { for (o = [], n = 0; n < t.length; n++) r = t[n], r.startsWith(i + ".") && o .push(r.substr(i.length + 1)); s[i] = this[i].state(o) } else s[i] = this[i].state(); return s }, i.prototype.clone = function(t) { return new i(this.state()) }, i.prototype.isPrimitiveType = function(t) { return !!isNumber(t) || (!!new TradingView.TypeValidator(String).check(t) || TradingView .isBoolean(t)) }, i.prototype.value = function() { return this._value }, i.prototype.listeners = function() { return this._listeners }, i.prototype.childCount = function() { return this._childs.length }, i.prototype.setValue = function(t, e) { (this._value !== t || e) && (this._value = t, this._listeners.fire(this)) }, i.prototype.setValueSilently = function(t) { this._value = t }, i.prototype.addProperty = function(t, e) { var o = new i(e); this[t] = o, this._childs.push(t), o.listeners().subscribe(this, i.prototype .childChanged) }, i.prototype.removeProperty = function(t) { this[t].listeners().unsubscribe(this, i.prototype.childChanged), delete this[t], this ._childs = this._childs.filter(function(e) { return e !== t }) }, i.prototype.addChild = function(t, e) { this[t] = e, -1 === $.inArray(t, this._childs) && this._childs.push(t), e.listeners() .subscribe(this, i.prototype.childChanged) }, i.prototype.childChanged = function(t, e) { this.listeners().fire(this) }, i.prototype.subscribe = function(t, e) { this.listeners().subscribe(t, e) }, i.prototype.unsubscribe = function(t, e) { this.listeners().unsubscribe(t, e) }, i.prototype.unsubscribeAll = function(t) { this.listeners().unsubscribeAll(t) }, t.exports = i }).call(e, i(10)) }, function(t, e, i) { "use strict"; (function(e, o, n) { function r(t) { return "cursor" === t || "arrow" === t || "dot" === t } function s(t) { !t && u && u.stayInDrawingMode.value() || this.tool.setValue(this.cursorTool.value()) } function a(t, e) { return function(e) { t.inFire || (t.inFire = !0, t.fire(e), t.inFire = !1) } } function l() { K || (g.setValue(TVSettings.getValue("chart.cursorPreference", "cursor")), g.subscribe( function(t) { r(t) && v.setValue(t) }, { callWithLast: !0 }), v.subscribe(function(t) { t && TVSettings.setValue("chart.cursorPreference", t) }), u = new c("drawings"), d = new n, p = new n, _ = new n, f = new n, d.setValue(! 1), p.setValue(!1), _.setValue(!1), f.setValue(!1), g.subscribe(function() { h.emit("onSelectedLineToolChanged") }), K = !0) } var c = i(6).DefaultProperty, h = i(23), u = null, d = null, p = null, _ = null, f = null, m = new e, g = new e, v = new e, y = new o, b = new o, S = new o, w = new o, T = new o, C = new o, x = new o, P = new o, L = new o, I = new o, k = new o, A = new o, M = new o, E = new o, D = new o, V = a(y), O = a(b), R = a(S), B = a(w), z = a(T), F = a(C), N = a(x), W = a(P), $ = a(L), H = a(I), U = a(k), j = a(A), q = a(M), G = a(E), Y = a(D), K = !1; t.exports = { tool: g, cursorTool: v, toolIsCursor: r, resetToCursor: s, init: l, createdLineTool: y, continuedLineTool: b, cancelledLineTool: S, createLineTool: V, continueLineTool: O, cancelLineTool: R, startedMovingLineTool: w, movedLineTool: T, finishedMovingLineTool: C, startMovingLineTool: B, moveLineTool: z, finishMovingLineTool: F, startedChangingLineTool: x, changedLineTool: P, finishedChangingLineTool: L, startChangingLineTool: N, changeLineTool: W, finishChangingLineTool: $, removedLineTool: I, removeLineTool: H, restoredLineTool: E, restoreLineTool: G, restoredLineToolState: D, restoreLineToolState: Y, finishedLineTool: k, finishLineTool: U, changedLineStyle: A, changeLineStyle: j, copiedLineTool: M, copyLineTool: q, properties: function() { return u }, hideAllDrawings: function() { return d }, hideMarksOnBars: function() { return _ }, lockDrawings: function() { return p }, drawOnAllCharts: function() { return u.drawOnAllCharts }, lockTimeAxis: function() { return f }, lockTimeAxisTime: m } }).call(e, i(17), i(10), i(25)) }, , function(t, e, i) { "use strict"; function o(t, e) { if (!n.isNumber(t)) return "n/a"; if (!n.isInteger(e)) throw new TypeError("invalid length"); if (e < 0 || e > 16) throw new TypeError("invalid length"); return 0 === e ? "" + t : ("0000000000000000" + t).slice(-e) } var n, r, s, a, l; Object.defineProperty(e, "__esModule", { value: !0 }), i(12), n = i(15), r = i(7), s = r.getLogger("Chart.PriceFormatter"), e.customFormatters = { dateFormatter: null, timeFormatter: null }, e.formatterOptions = { decimalSign: ".", decimalSignFractional: "'" }, a = { custom: $.t("Price format is invalid."), fraction: $.t("Fraction part is invalid."), secondFraction: $.t("Second fraction part is invalid.") }, e.numberToStringWithLeadingZero = o, l = function() { function t(t, e, i, o) { if (this.type = "price", e || (e = 1), n.isNumber(t) && n.isInteger(t) || (t = 100), t < 0) throw new TypeError("invalid base"); if (this._priceScale = t, this._minMove = e, this._minMove2 = o, i && void 0 !== o && o > 0 && 2 !== o && 4 !== o && 8 !== o) return void s.logDebug("invalid minmove2"); this._fractional = i, this.calculateDecimal() } return t.prototype.isFractional = function() { return !!this._fractional }, t.prototype.state = function() { return { fractional: this._fractional, fractionalLength: this._fractionalLength, minMove: this._minMove, minMove2: this._minMove2, priceScale: this._priceScale } }, t.prototype.calculateDecimal = function() { if (this._fractionalLength = 0, this._priceScale > 0 && this._minMove > 0) { var t = this._priceScale; for (this._fractional && this._minMove2 && (t /= this._minMove2); t > 1;) t /= 10, this._fractionalLength++ } }, t.prototype.format = function(t, e, i, o) { void 0 === o && (o = !0); var n = ""; return t < 0 ? (n = !0 === e ? "−" : !1 === o ? "" : "-", t = -t) : t && !0 === e && ( n = "+"), this._fractional ? n + this._formatAsFractional(t, i) : n + this ._formatAsDecimal(t, i) }, t.prototype.parse = function(t) { return this._fractional ? this._minMove2 ? this._parseAsDoubleFractional(t) : this ._parseAsSingleFractional(t) : this._parseAsDecimal(t) }, t.prototype.hasForexAdditionalPrecision = function() { return !this._fractional && 10 === this._minMove2 }, t.serialize = function(t) { return t.state() }, t.deserialize = function(e) { return new t(e.priceScale, e.minMove, e.fractional, e.minMove2) }, t.prototype._formatAsDecimal = function(t, i) { //格式化价格 if (this.type == "price") { var price = "0.00"; //如果价格大于1则保留2位小数 if (t > 1) { price = t.toFixed(2) } else { //否则 let splitList = t.toString().split(".") let num = 0 if (splitList[1]) { for (var i = 0; i < splitList[1].length; i++) { if (splitList[1][i] == "0") { num++ } else { //如果不为0了 直接中断 break; } } } if (num >= 4) { var last = "" + splitList[1].substring(num, splitList[1].length) if (last.length >= 4) { if (last[num] >= 5) { price = '0.0{' + num + '}' + (parseInt(last[1] + last[2] + last[ 3]) + 1) } else { price = '0.0{' + num + '}' + last[1] + last[2] + last[3] } } else { price = '0.0{' + num + '}' + last } } else { price = t.toFixed(5) } } return price } else { var n, r, s, a, l; i = i || 0, n = this._fractional ? Math.pow(10, this._fractionalLength || 0) : Math.pow(10, i) * this._priceScale / this._minMove, r = Math.floor(t), s = +( Math .round(t * n) - r * n).toFixed(this._fractionalLength), s >= n && (s -= n, r += 1), a = "", 1 !== n && (l = void 0 !== this._fractionalLength ? this ._fractionalLength : NaN, a = e.formatterOptions.decimalSign + o(+s.toFixed(this._fractionalLength) * this._minMove, l + i), a = this._removeEndingZeros(a, i)) return "" + r + a } }, t.prototype._formatAsFractional = function(t, i) { var n, r, s, a, l, c, h, u, d, p = this._priceScale / this._minMove, _ = Math.floor(t), f = i ? Math.floor(t * p) - _ * p : Math.round(t * p) - _ * p; if (f === p && (f = 0, _ += 1), n = "", i && (r = (t - _ - f / p) * p, r = Math.round( r * Math.pow(10, i)), n = o(r, i), n = this._removeEndingZeros(n, i)), !this ._fractionalLength) throw Error("_fractionalLength is not calculated"); return s = "", this._minMove2 ? (a = ["0", "5"], l = ["0", "2", "5", "7"], c = ["0", "1", "2", "3", "4", "5", "6", "7" ], h = f % this._minMove2, f = (f - h) / this._minMove2, u = o(f, this ._fractionalLength), d = 2 === this._minMove2 ? a[h] : 8 === this ._minMove2 ? c[h] : l[h], s = u + e.formatterOptions.decimalSignFractional + d ) : s = o(f * this._minMove, this._fractionalLength), "" + _ + e .formatterOptions.decimalSignFractional + s + n }, t.prototype._removeEndingZeros = function(t, e) { for (var i = 0; i < e && "0" === t[t.length - 1]; i++) t = t.substr(0, t.length - 1); return t }, t.prototype._parseAsDecimal = function(t) { var i, o, n = RegExp(/^(\-?)[0-9]+$/), r = n.exec(t); return r ? (i = parseFloat(t), { price: i, res: !0, suggest: this.format(i) }) : (o = RegExp("^(-?)[0-9]+\\" + e.formatterOptions.decimalSign + "[0-9]*$"), r = o.exec(t), r ? (i = parseFloat(t.replace(e.formatterOptions.decimalSign, ".")), { price: i, res: !0, suggest: this.format(i) }) : { error: a.custom, res: !1 }) }, t.prototype._patchFractPart = function(t, e) { var i = { 0: 0, 5: 1 }, o = { 0: 0, 2: 1, 5: 2, 7: 3 }; return 2 === e ? void 0 === i[t] ? -1 : i[t] : 4 === e ? void 0 === o[t] ? -1 : o[t] : t }, t.prototype._parseAsSingleFractional = function(t) { var i, o, n, r, s, l, c = RegExp(/^(\-?)[0-9]+$/), h = c.exec(t); return h ? (i = parseFloat(t), { price: i, res: !0, suggest: this.format(i) }) : (o = RegExp("^(-?)([0-9]+)\\" + e.formatterOptions.decimalSignFractional + "([0-9]+)$"), h = o.exec(t), h ? (n = !!h[1], r = parseInt(h[2]), s = this ._priceScale, (l = this._patchFractPart(parseInt(h[3]), s)) >= s || l < 0 ? { error: a.fraction, res: !1 } : (i = r + l / s, n && (i = -i), { price: i, res: !0, suggest: this.format(i) })) : { error: a.custom, res: !1 }) }, t.prototype._parseAsDoubleFractional = function(t) { var i, o, n, r, s, l, c, h, u, d = RegExp(/^(\-?)[0-9]+$/), p = d.exec(t); return p ? (i = parseFloat(t), { price: i, res: !0, suggest: this.format(i) }) : (o = RegExp("^(-?)([0-9]+)\\" + e.formatterOptions.decimalSignFractional + "([0-9]+)\\" + e.formatterOptions.decimalSignFractional + "([0-9]+)$"), p = o.exec(t), p ? (n = !!p[1], r = parseInt(p[2]), s = void 0 !== this._minMove2 ? this._minMove2 : NaN, l = this._priceScale / s, c = this._minMove2, h = this._patchFractPart(parseInt(p[3]), l), u = this ._patchFractPart(parseInt(p[4]), c), h >= l || h < 0 ? { error: a.fraction, res: !1 } : void 0 !== c && u >= c || u < 0 ? { error: a.secondFraction, res: !1 } : (i = void 0 !== c ? r + h / l + u / (l * c) : NaN, n && (i = -i), { price: i, res: !0, suggest: this.format(i) })) : { error: a.custom, res: !1 }) }, t }(), e.PriceFormatter = l }, , function(t, e, i) { "use strict"; function o(t, e, i) { var o, n, r, s, c; if (e = e || 0, !a(t)) return i ? l.rgbaToString(l.rgba(l.parseRgb(t), l.normalizeAlphaComponent(1 - e / 100))) : t; if (e < 0 && e > 100) throw Error("invalid transparency"); return o = l.parseRgb(t), n = o[0], r = o[1], s = o[2], c = l.normalizeAlphaComponent(1 - e / 100), l.rgbaToString([n, r, s, c]) } function n(t) { return a(t) ? t : l.rgbaToString(l.rgba(l.parseRgb(t), l.normalizeAlphaComponent(1))) } function r(t) { var e = l.parseRgb(t).map(function(t) { return t /= 255, t <= .03928 ? t / 12.92 : Math.pow((t + .055) / 1.055, 2.4) }); return +(.2126 * e[0] + .7152 * e[1] + .0722 * e[2]).toFixed(3) } function s(t, e) { return l.rgbaToString(l.blendRgba(l.parseRgba(t), l.parseRgba(e))) } function a(t) { return 0 === t.indexOf("#") } Object.defineProperty(e, "__esModule", { value: !0 }); var l = i(32); e.generateColor = o, e.resetTransparency = n, e.getLuminance = r, e.blendColors = s, e.isHexColor = a }, function(t, e, i) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }), e.dur = 350, e.easingFunc = { linear: function(t) { return t }, easeInQuad: function(t) { return t * t }, easeOutQuad: function(t) { return t * (2 - t) }, easeInOutQuad: function(t) { return t < .5 ? 2 * t * t : (4 - 2 * t) * t - 1 }, easeInCubic: function(t) { return t * t * t }, easeOutCubic: function(t) { return --t * t * t + 1 }, easeInOutCubic: function(t) { return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1 }, easeInQuart: function(t) { return t * t * t * t }, easeOutQuart: function(t) { return 1 - --t * t * t * t }, easeInOutQuart: function(t) { return t < .5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t }, easeInQuint: function(t) { return t * t * t * t * t }, easeOutQuint: function(t) { return 1 + --t * t * t * t * t }, easeInOutQuint: function(t) { return t < .5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t } }, e.color = { black0: "#000", black20: "#2b2d36", black25: "#2b2e37", black30: "#212121", black70: "#4A4A4A", black80: "#535353", black100: "#646464", black110: "#757575", black140: "#8A8A8A", black170: "#ADAEB0", black180: "#b4b4b4", black200: "#C8C8C8", black220: "#DADDE0", black230: "#ECECEC", black240: "#F2F2F2", black248: "#F8F8F8", black255: "#FFF", brand: "#3BB3E4", brandHover: "#3BABD8", brandActive: "#3898C2", brandDown: "#049DDC", brand220: "#3BB3E0", brand255: "#3BB3FF", brandNew: "#37A6EF", spinner: "#00A2E2", brandMedium80: "#3C4650", brandMedium90: "#465a6e", brandMedium100: "#627384", brandMedium120: "#758696", brandMedium150: "#94959C", brandMedium190: "#9DB2BD", brandMedium220: "#E9EFF2", brandMedium230: "#EAECEF", brandMedium240: "#F1F3F6", brandDark: "#2A2C39", brandDark50: "#252733", brandDark45: "#20222D", brandDarkText: "#6A6B74", danger: "#FF4A68", dangerHover: "#F24965", dangerDown: "#FF173E", success: "#3CBC98", success55: "#37BC9B", success250: "#00FFC0", successHover: "#38B395", successDown: "#00A97F", attention: "#FFC84A", attention50: "#F89E30", growing: "#37bc9b", falling: "#ff4a68" } }, , function(t, e, i) { "use strict"; (function(t, e) { function o(t) { TradingView.merge(this, { palettes: {}, inputs: [], plots: [], graphics: {}, defaults: {} }), TradingView.merge(this, t); var e = t.fullId || t.id; TradingView.merge(this, o.parseIdString(e)), this.name = this.id } var n = i(9).assert, r = i(7).getLogger("Chart.Study.MetaInfo"), s = i(206).applyOverridesToStudyDefaults, a = null; o.VERSION_STUDY_ARG_SOURCE = 41, o.METAINFO_FORMAT_VERSION_SOS_V2 = 42, o .VERSION_PINE_PROTECT_TV_4164 = 43, o.CURRENT_METAINFO_FORMAT_VERSION = 45, o .CHILD_STUDY_ALLOWED_PLOT_TYPES = ["line"], o.CHILD_STUDY_EXCLUDE_IDS = [ "CorrelationCoefficient@tv-basicstudies" ], o.CHILD_STUDY_PARENT_EXCLUDE_IDS = [], o.FilledArea = {}, o.FilledArea.TYPE_PLOTS = "plot_plot", o.FilledArea.TYPE_HLINES = "hline_hline", o.versionOf = function(t) { var e = "_metainfoVersion" in t && isNumber(t._metainfoVersion) ? t._metainfoVersion : 0; return e < 0 && r.logError("Metainfo format version cannot be negative: " + e), e > o .CURRENT_METAINFO_FORMAT_VERSION && r.logWarn( "Client doesn't support this version of metainfo format: " + e), e }, o.parseIdString = function(t) { var e, i, o, n, r = {}; if (-1 === t.indexOf("@")) r.shortId = t, r.packageId = "tv-basicstudies", r.id = t + "@" + r.packageId, r.version = 1; else if (e = t.split("@"), r.shortId = e[0], i = e[1].split("-"), 3 === i.length) r .packageId = i.slice(0, 2).join("-"), r.id = r.shortId + "@" + r.packageId, r .version = i[2]; else if (1 === i.length && "decisionbar" === i[0]) r.packageId = "les-" + i[0], r.id = r .shortId + "@" + r.packageId, r.version = 1; else { if (1 !== i.length) throw Error("unexpected study id:" + t); r.packageId = "tv-" + i[0], r.id = r.shortId + "@" + r.packageId, r.version = 1 } return r.fullId = r.id + "-" + r.version, "tv-scripting" === r.packageId ? (o = r .shortId, 0 === o.indexOf("Script$") || 0 === o.indexOf("StrategyScript$") ? ( n = o.indexOf("_"), r.productId = n >= 0 ? o.substring(0, n) : r.packageId ) : r.productId = r.packageId) : r.productId = r.packageId, r }, o.getPackageName = function(t) { return (/^[^@]+@([^-]+-[^-]+)/.exec(t || "") || [0, "tv-basicstudies"])[1] }, o.cutFullId = function(t) { return t.replace(/(@[^-]+-[^-]+).*$/, "$1") }, o.cutDollarHash = function(t) { var e, i, o = t.indexOf("$"), n = t.indexOf("@"); return -1 === o ? t : (e = t.substr(0, o), i = n >= 0 ? t.substr(n) : "", e + i) }, o.cutScriptIdPart = function(t) { var e = t.indexOf("$"), i = t.indexOf("@"); return e < 0 && i >= 0 ? "" : t.substring(Math.max(e + 1, 0), i >= 0 ? i : t.length) }, o.hasUserIdSuffix = function(t) { return /^USER;[\d\w]+;\d+$/.test(t) }, o.getSourceIdByInputs = function(t, e) { var i, n, r; if (!Array.isArray(t) || !e) return null; for (i = 0; i < t.length; ++i) if (n = t[i], o.isSourceInput(n) && "string" == typeof e[n.id]) return r = e[n.id], ~r.indexOf("$") && (r = r.split("$")[0]), r; return null }, o.getSourceInputIds = function(t) { var e, i, n = [], r = t.inputs; for (e = 0; e < r.length; ++e) i = r[e], o.isSourceInput(i) && n.push(i.id); return n }, o.setChildStudyMetaInfoPropertiesSourceId = function(e, i, n) { var r, s, a, l; for (r = 0; r < e.inputs.length; ++r) s = e.inputs[r], o.isSourceInput(s) && n instanceof t && n.inputs && n.inputs[s.id] && (a = n.inputs[s.id].value(), a .indexOf("$") > 0 && (l = a.replace(/^[^\$]+/, i), n.inputs[s.id].setValue(l))) }, o.patchChildStudyMetaInfoState = function(t) { function e(t) { if ("object" == typeof t) for (var i in t) "string" == typeof t[i] && /^[^\$]+\$\d+$/.test(t[i]) ? t[i] = t[i].replace(/^[^\$]+/, "{pid}") : e(t[i]) } t.state && e(t.state.inputs), t.state.isChildStudy = !0 }, o.prototype.parseValue = function(t, e) { return "bool" === t ? TradingView.parseBool(e) : e }, o.prototype.defaultInputs = function() { var t, e = []; for (t = 0; t < this.inputs.length; t++) e.push(this.inputs[t].defval); return e }, o.prototype.state = function(t) { var e, i = {}; for (e in this) this.hasOwnProperty(e) && (i[e] = this[e], !0 !== t && "id" === e && (i[ e] += "-" + this.version)); return i }, o.prototype.symbolInputId = function() { var t = this.inputs.filter(function(t) { return "symbol" === t.type }); return t.length > 0 ? t[0].id : null }, o.findStudyMetaInfoByDescription = function(t, e) { if (t) { for (var i = 0; i < t.length; ++i) if (t[i].description.toLowerCase() === e.toLowerCase()) return t[i]; throw Error("unexpected study id:" + e) } throw Error("There is no studies metainfo") }, o._findStudyMetaInfo = function(t, e) { for (var i = 0; i < t.length; i += 1) if (t[i].id === e) return [i, t[i]]; return [] }, o.findStudyMetaInfo = function(t, e) { if (!t) throw new ReferenceError("There is no studies metainfo"); var i = o._findStudyMetaInfo(t, e)[1]; if (!i) throw new ReferenceError("unexpected study id:" + e); return i }, o.isParentSourceId = function(t) { return "string" == typeof t && /^[^\$]+\$\d+$/.test(t) }, o.isSourceInput = function(t) { return t.id && (("source" === t.id || "src" === t.id) && ("text" === t.type || "source" === t.type) || "source" === t.type) }, o.getChildSourceInputTitles = function(t, e, i) { var n, r, s, a, l = {}; if (e.plots && e.plots.length && t.options && t.options.length) for (n = 0; n < t.options.length; ++n) r = t.options[n], s = r && +r.split("$")[1], (a = isFinite(s) && e.plots[s]) && ~o.CHILD_STUDY_ALLOWED_PLOT_TYPES.indexOf(a .type) && (l[r] = e.styles && e.styles[a.id] && e.styles[a.id].title || a .id, i && (l[r] = i + ": " + l[r])); return l }, o.removeStudyMetaInfo = function(t, e, i) { var n = function(i) { return void 0 !== (i = void 0 !== i ? i : o._findStudyMetaInfo(t, e.id)[0]) && ( t.splice(i, 1), defaults.remove(o.getStudyPropertyRootName(e)), !0) }; if (t) return n(i); throw Error("There are no studies metainfo") }, o.getStudyPropertyRootName = function(t) { var e = "study_" + t.id; return t.pine && t.pine.version && (e += "_" + t.pine.version.replace(".", "_")), e }, o.addOrReplaceStudyMetaInfo = function(t, e) { var i, n, s, a, l = new o(e), c = o._findStudyMetaInfo(t, l.id), h = c[0], u = c[1]; if (u) { if (i = u.pine && u.pine.version, !(null == (n = l.pine && l.pine.version) || null == i || n >= i)) return l; o.removeStudyMetaInfo(t, l, h) } else o.removeStudyMetaInfo(t, l, h) && r.logDebug("Study with id=" + l.id + " already exists in the model!"); return t.push(l), l.defaults && (s = TradingView.clone(l.defaults), s.precision = "default", a = o.getStudyPropertyRootName(l), defaults.create(a, s)), l }, o.overrideDefaults = function(t) { null !== a && 0 !== t.length && s(a, t, function(t) { return TradingView.defaultProperties["study_" + t] || null }) }, o.setDefaultsOverrides = function(t) { a = t }, o.createMetaInfoStub = function(t, e) { var i, o, r; return n(TradingView.isExistent(t.scriptIdPart), "scriptIdPart is missing, study: " + JSON.stringify(t)), i = t.extra && "strategy" === t.extra.kind || !0 === t .isTVScriptStrategy, o = TVScript.createScriptStudyId(t.scriptIdPart, e, i), r = { isTVScriptStubToCompile: !0, id: o, scriptIdPart: t.scriptIdPart, description: t.scriptName, TVScriptSourceCode: t.scriptSource, is_hidden_study: t.extra && t.extra.is_hidden_study, extra: t.extra, version: e }, r.pine = {}, r.pine.version = TradingView.isExistent(t.version) ? t.version : -1, r.pine.access = TVScript.Access.MAP_ID_TO_NAME[t.access], r.pine.userHaveAccess = t.userHaveAccess, !0 === i && (r.isTVScriptStrategy = !0), r }, o.isScriptStrategy = function(t) { if (t.extra && t.extra.kind) return t.extra.kind === TVScript.Kinds.STRATEGY; if (!0 === t.isTVScriptStrategy) return !0; var e = t.TVScriptSourceCode || t.scriptSource; return !!e && TVScript.isStrategy(e) }, o.replaceWithFullStudyMetaInfoAsync = function(t, e) { var i = $.Deferred(); return e.isTVScriptStubToCompile || i.resolve(e), i.promise() }, o.getOrderedInputIds = function(t) { var e, i, o = [], n = t.inputs; for (e = 0; e < n.length; ++e) i = n[e], o.push(i.id); return o }, o.canBeChild = function(t) { var e, i, n; if (t && "string" == typeof t) return !0; if (!t || t.extra && !o.isAllowedSourceInputsCount(t.extra.sourceInputsCount) || !0 === t.canNotBeChild || !1 === t.canBeChild || ~o.CHILD_STUDY_EXCLUDE_IDS.indexOf(t .id) || t.isTVScriptStrategy || t.TVScriptSourceCode && TVScript.isStrategy(t .TVScriptSourceCode)) return !1; if (t.isTVScriptStubToCompile) return !0; for (e = t.inputs, i = 0, n = 0; n < e.length; ++n) o.isSourceInput(e[n]) && ++i; return o.isAllowedSourceInputsCount(i) }, o.isAllowedSourceInputsCount = function(t) { return 1 === t }, o.canHaveChildren = function(t) { if (t) { if (t.isTVScriptStrategy || t.TVScriptSourceCode && TVScript.isStrategy(t .TVScriptSourceCode)) return !1; if (t.id && !~o.CHILD_STUDY_PARENT_EXCLUDE_IDS.indexOf(t.id) && Array.isArray(t .plots)) for (var e = 0; e < t.plots.length; ++e) if (~o.CHILD_STUDY_ALLOWED_PLOT_TYPES.indexOf(t.plots[e].type)) return !0 } return !1 }, TradingView.StudyMetaInfo = o, void 0 !== e && e && e.exports && (e.exports = o) }).call(e, i(25), i(42)(t)) }, function(t, e, i) { "use strict"; var o, n, r, s; Object.defineProperty(e, "__esModule", { value: !0 }), o = {}, n = RegExp("^([0-9]*)$"), r = RegExp("^(\\d*)([DWMS])$"), s = function() { function t(e, i) { if (void 0 === i && e !== t.INVALID) return t.parse(e); var o = e; o !== t.SECONDS && o !== t.MINUTES && o !== t.HOURS && o !== t.DAYS && o !== t.WEEKS && o !== t.MONTHS && o !== t.INVALID && (o = "invalid"), this._kind = o, this._multiplier = i } return t.prototype.kind = function() { return this._kind }, t.prototype.multiplier = function() { return this._multiplier }, t.prototype.isValid = function() { return this.kind() !== t.INVALID }, t.prototype.isDWM = function() { return this.isValid() && !this.isIntraday() }, t.prototype.isIntraday = function() { return -1 !== [t.SECONDS, t.MINUTES, t.HOURS].indexOf(this.kind()) }, t.prototype.letter = function() { return this.isValid() && this.kind() !== t.MINUTES ? this.kind()[0].toUpperCase() : "" }, t.prototype.value = function() { return this.isValid() ? this.kind() === t.MINUTES ? this.multiplier() + "" : this .multiplier() + this.letter() : "" }, t.prototype.isEqualTo = function(e) { if (!(e instanceof t)) throw Error("Argument is not an Interval"); return this.kind() !== t.INVALID && e.kind() !== t.INVALID && (this.kind() === e .kind() && this.multiplier() === e.multiplier()) }, t.prototype.inMilliseconds = function(e) { var i, n; if (!this.isValid()) return NaN; if (this.kind() === t.MONTHS) { if (void 0 === e) throw Error("unixDateTimeFrom should be provided"); return i = new Date(e), i.setUTCMonth(i.getUTCMonth() + (this.multiplier() || 1)), + i - e } return n = this.multiplier(), void 0 === n ? NaN : o[this.kind()] * n }, t.isEqual = function(e, i) { return t.parse(e).isEqualTo(t.parse(i)) }, t.parse = function(e) { var i, o; return e = (e + "").toUpperCase().split(",")[0], i = { D: t.DAYS, W: t.WEEKS, M: t.MONTHS, H: t.HOURS, S: t.SECONDS }, (o = n.exec(e)) ? new t(t.MINUTES, parseInt(e, 10)) : (o = r.exec(e), o ? new t( i[o[2]], parseInt(o[1], 10) ? parseInt(o[1], 10) : 1) : new t(t.INVALID)) }, t.isDWM = function(e) { return t.parse(e).isDWM() }, t.kind = function(e) { return t.parse(e).kind() }, t.isValid = function(e) { return t.parse(e).isValid() }, t.normalize = function(e) { var i = new t(e); return i.isValid() ? i.value() : null }, t.SECONDS = "seconds", t.MINUTES = "minutes", t.HOURS = "hours", t.DAYS = "days", t .WEEKS = "weeks", t.MONTHS = "months", t.INVALID = "invalid", t }(), e.Interval = s, o[s.SECONDS] = 1e3, o[s.MINUTES] = 60 * o[s.SECONDS], o[s.HOURS] = 60 * o[s .MINUTES], o[s.DAYS] = 24 * o[s.HOURS], o[s.WEEKS] = 7 * o[s.DAYS] }, function(t, e, i) { "use strict"; (function(e, o, n, r) { function s(t, e, i, o) { this._study = t, this.m_series = e, this.m_model = i, this._plotName = o, this._visible = ! 1, this._points = [new Z(0, 0)], this._invalidated = !0, this._lineRenderer = new C } function a() { return { visible: !0, color: "#0496FF", linestyle: CanvasEx.LINESTYLE_SOLID, linewidth: 2, plottype: at.PlotType.Line, histogramBase: 0, transparency: 50, trackPrice: !1, joinPoints: !1 } } function l(t, e, i, o) { var n, r; return o.isTVScriptStrategy ? n = "StudyStrategy" : (r = "study_" + (o.classId || o .shortId), n = r in TradingView ? r : "Study"), new TradingView[n](t, e, i, o) } function c(t, e, i, o, n) { return h(t, e, i, o, st.getStudyPropertyRootName(t), n) } function h(t, e, i, o, n, r) { var s, a, l, c, h, u = p(t, e, i, o); for (r instanceof v && (s = st.getSourceInputIds(t), s.length > 0 && (a = s[0], u.inputs[ a] = "{pid}$0")), l = new J(n, u, !0), l.addExclusion("visible"), l.addExclusion( "precision"), l.addExclusion("minTick"), c = 0; c < t.inputs.length; ++c) h = t .inputs[c], h.isHidden && (l.addExclusion("inputs." + c), l.addExclusion("inputs." + h .id)); return l } function u(t, e, i, o, n, r) { return d(t, e, i, o, n, st.getStudyPropertyRootName(t), r) } function d(t, e, i, o, n, r, s) { var a, l, c, h = _(t, e, i, o, n), u = new J(r, h, !0); for (u.addExclusion("visible"), u.addExclusion("precision"), u.addExclusion("minTick"), a = e || t, l = 0; l < a.inputs.length; ++l) c = a.inputs[l], c.isHidden && (u.addExclusion( "inputs." + l), u.addExclusion("inputs." + c.id)); return u } function p(t, o, n, r) { var s, a, l, c, h, u, d, p, _ = i(84); if (st.versionOf(t) < 1) throw Error( "This function cannot work with metainfo of the old format version. Required format version >= 1" ); return s = TradingView.clone(defaults("study")), f(s, t), a = st.getStudyPropertyRootName( t), l = TradingView.clone(defaults(a, r)), t.isTVScript && t.TVScriptSourceCode !== l .TVScriptSourceCode && (l = TradingView.clone(TradingView.factoryDefaults(a, r))), TradingView.merge(s, l), o && (S(!(o instanceof e), "propsState should not be an instance of Property"), TradingView.merge(s, o)), c = TradingView.clone(t), h = {}, _.mergeInputsObjPart(h, c.defaults.inputs), _ .mergeInputsObjPart(h, s.inputs), s.inputs = h, delete c.inputs, delete c.defaults .inputs, u = {}, TradingView.merge(u, c.defaults), TradingView.merge(u, TradingView .factoryDefaults("study_" + c.id)), TradingView.merge(u, s), TradingView.merge(u, c), delete u.defaults, s = u, d = null !== n ? n.model().getStudyShiftColorStartOffset() : void 0, p = m(n, t), TradingView.merge(s, g(s, p, d)), o && TradingView.merge(s.styles, o.styles), s } function _(t, e, o, n, r) { var s, a, l, c, h, u, d = i(84); return t.version && o.version && t.version !== o.version && ct.logWarn( "Serialized metaInfo version " + t.version + " is not equal to the saved state version " + o.version), s = TradingView.clone( defaults("study")), TradingView.merge(s, TradingView.factoryDefaults("study_" + t .id)), f(s, t), TradingView.merge(s, o), s = r.updateStudyState(s, t, e), a = TradingView.clone(e || t), a && st.versionOf(a) >= 1 && (l = {}, d.mergeInputsObjPart(l, a.defaults.inputs), d.mergeInputsObjPart(l, s.inputs), s.inputs = l, delete a .inputs, delete a.defaults.inputs, c = {}, TradingView.merge(c, a.defaults), TradingView.merge(c, TradingView.factoryDefaults("study_" + a.id)), TradingView .merge(c, s), delete a.defaults, TradingView.merge(c, a), s = c), h = null !== n ? n .model().getStudyShiftColorStartOffset() : void 0, u = m(n, a), TradingView.merge(s, g( s, u, h)), s } function f(t, e) { var i, o, n, r; if (e.plots) for (i = 0; i < e.plots.length; i++) o = e.plots[i].id, (n = e.plots[i].type) !== at .PlotTypes.COLORER && (r = a(), n === at.PlotTypes.COLORER && (r.transparency = 0), r.plottype = n, r.title = o, t.styles && o in t.styles && TradingView.merge(r, t .styles[o]), t.styles[o] = r) } function m(t, e) { var i, o, n, r, s = 0; if (t) for (i = 0; i < t.dataSources().length; i++) o = t.dataSources()[i], o.metaInfo && o .metaInfo() && (n = o.metaInfo().id === e.id, r = (o.metaInfo().pine && o.metaInfo() .pine.version) === (e.pine && e.pine.version), n && r && s++); return s } function g(t, e, i) { var o, n; if (!e) return t; for (o in t.styles)(n = t.styles[o].color) && (t.styles[o].color = X(n, e, i)); return t } function v(t, e, r, s) { var a, l, c, h, u, d, p, _, f, m, g = i(158); for (this._titleCache = {}, this._resolvedSymbols = {}, this._priceAxisViewsBase = [], this ._paneViews = [], this._hlinesPriceAsisViews = [], this._horizlinesPriceAsisViews = [], W.call(this, t), this.m_data = new ot, this._graphics = new q(s), this ._plotOffsets = {}, this._plotOffsetsMetaInfoOverride = {}, this._model = t, this ._chartApi = t._chartApi, this._series = r instanceof TradingView.Series ? r : this ._model.mainSeries(), r instanceof v && (this._source = r, this._isChildStudy = !0, this ._source.setChild(this)), this._numericFormatter = new et, this._metaInfo = s, this ._properties = e, this._properties.listeners().subscribe(this, this.changeStyles), this ._properties.visible.listeners().subscribe(this, this.visibleChanged), this._properties .visible.listeners().subscribe(this, this.processHibernate), a = 0; a < this._metaInfo .plots.length; a++) l = this._metaInfo.plots[a].id, null != (c = this.properties() .styles[l]) && null != c.visible && c.visible.listeners().subscribe(this, this .processHibernate); for (h in this._metaInfo.graphics) for (u in this._metaInfo.graphics[h]) d = this._properties.graphics[h][u], d.visible && d.visible.listeners().subscribe(this, this.processHibernate); if (this._showStudyArgumentsProperty = this.model().properties().paneProperties .legendProperties.showStudyArguments, this._turnaroundCounter = 1, this._turnaround = "st" + this._turnaroundCounter, this._status = "", this._plotFields = [], p = this .metaInfo().plots) for (a = 0, _ = p.length; a < _; a++) u = p[a].id, this._plotFields.push(u); this.clearData(), this._studyModified = !1, this._tagsChanged = new o, this.createViews(), f = this, this._handler = function(t) { f.onData(t) }, this._handler.isTVScriptStrategy = this._metaInfo.isTVScriptStrategy, this ._createFormatter(), f = this, this._properties.precision.listeners().subscribe(null, function() { f._createFormatter(), f._model.invalidate(new G(G.FULL_UPDATE)) }), this._showStudyArgumentsProperty.listeners().subscribe(this, this .invalidateTitleCache), this._properties.description.listeners().subscribe(this, this.invalidateTitleCache), this._properties.shortDescription && this._properties .shortDescription.listeners().subscribe(this, this.invalidateTitleCache), n.enabled( "update_study_formatter_on_symbol_resolve") && t.mainSeries().onSymbolResolved() .subscribe(this, v.prototype._createFormatter), f = this, m = {}, this ._simplePlotsCount = s.plots.filter(function(t, e) { if (f.isLinePlot(e)) return !0; if (f.isOHLCSeriesPlot(e)) { var i = f.metaInfo().plots[e].target; return !m[i] && (m[i] = i, !0) } return !1 }).length, this._properties.showInDataWindow.listeners().subscribe(t, g.prototype .fullUpdate), this.hasBarColorer() && this._properties.visible.listeners() .subscribe(t.mainSeries(), TradingView.Series.prototype.invalidateBarStylesCache), this .onStart = new o, this._childStudyByRebind = new o } function y(t, e) { return t && t[e] && t[e].hasOwnProperty("showLast") ? t[e].showLast.value() : null } var b = i(9), S = b.assert, w = b.ensureNotNull, T = i(217).StudyBarColorer, C = i(94).HorizontalLineRenderer, x = i(787), P = x.BandPaneView, L = x.BandBackgroundPaneView, I = x.HlineFillPaneView, k = i(324).StudyPriceAxisView, A = i(87), M = A.StudyPaneView, E = A.StudyBackgroundPaneView, D = A.StudyPlotShapesPaneView, V = A.StudyPlotCharsPaneView, O = A.StudyPlotArrowsPaneView, R = A.StudyPlotBarsPaneView, B = A.StudyPlotCandlesPaneView, z = i(805), F = z.PlotFillPaneView, N = z.AreaBackgroundPaneView, W = i(46).PriceDataSource, H = i(124), U = i(125).StudyDataWindowView, j = i(126), q = i(219), G = i(22), Y = i(15).parseJSONorNot, K = i(330).ChartApiInterface, Z = i(8).Point, X = i(32).shiftColor, J = i(6).DefaultProperty, Q = i(28).PriceFormatter, tt = i(331).VolumeFormatter, et = i(89).NumericFormatter, it = i(19), ot = it.PlotList, nt = it.PlotRowSearchMode, rt = it.mergeMinMax, st = i(33), at = i(111), lt = i(3).propertyPages, ct = i(7).getLogger("Chart.Study"); s.prototype.update = function() { this._invalidated = !0 }, s.prototype.updateImpl = function() { this._visible = !1; var t = this._study.lastValueData(this._plotName, !0); t.noData || (this._visible = !0, this._points = [new Z(0, t.coordinate)], this._color = t.color) }, s.prototype.renderer = function() { this._invalidated && (this.updateImpl(), this._invalidated = !1); var t = {}; return t.width = this.m_model.timeScale().width(), t.height = this._study.priceScale() .height(), t.points = this._points, t.color = this._color, t.linewidth = this._study .properties().styles[this._plotName].linewidth.value(), t.linestyle = CanvasEx .LINESTYLE_DOTTED, t.visible = this._visible, this._lineRenderer.setData(t), this ._lineRenderer }, inherit(v, W), TradingView.Study = v, i(918), v.prototype.lastValueData = function(t, e, i) { var o, n, r, s, a, l, c, h, u, d, p, _, f, m, g, v, y, b, S, w, T, C, x = { noData: !0 }; if (this._model.timeScale().isEmpty() || null == this.priceScale() || this.priceScale() .isEmpty() || this.data().isEmpty()) return x; if (null === (o = this._model.timeScale().visibleBars())) return x; if (!this.properties().visible.value()) return x; if (n = this.properties().styles, r = this.properties().ohlcPlots, n && n[t] && (s = n[ t]), r && r[t] && (s = r[t]), !s || !s.visible.value()) return x; if (a = this.offset(t), null == (l = this.nearestIndex(o.lastBar() - a, nt .NearestLeft)) || void 0 === l) return x; for (h = this.metaInfo().plots, c = 0; c < h.length && !(h[c].id === t || this .isOHLCClosePlot(c) && h[c].target === t); c++); if (u = this._lastNonEmptyPlotRow(c), d = null !== u && o.contains(u.index), p = null !== u ? u.value : null, !(_ = e || d ? p : this.data().valueAt(l)) || ! isNumber(_[c + 1])) return x; for (f = { noData: !1 }, m = null, g = null, y = 0; y < h.length; y++) h[y].target === t && (this .isSelfColorerPlot(y) || this.isOHLCColorerPlot(y)) && (m = y, g = this .metaInfo().palettes[h[y].palette], v = this.properties().palettes[h[y].palette] ); if (b = _[c + 1], i && (f.price = b), this.priceScale().properties().percentage .value()) { if (!(S = this.firstValue(!0))) return x; b = this.priceScale().priceRange().convertToPercent(b, S) } return f.text = this.priceScale().formatter().format(b), w = s.color.value(), m && _ .length > m + 1 ? (T = _[m + 1], void 0 !== T && null !== T ? (C = g.valToIndex ? g .valToIndex[T] : T, f.color = v.colors[C].color.value()) : f.color = w) : f .color = w, f.floatCoordinate = this.priceScale().priceToCoordinate(b, !0), f .coordinate = Math.round(f.floatCoordinate), f.item = _, f }, v.prototype.series = function() { return this._series }, v.prototype.model = function() { return this._model }, v.prototype._invalidateLastNonEmptyPlotRowCache = function() { this._lastNonEmptyPlotRowCache = {} }, v.prototype.clearData = function() { this._invalidateLastNonEmptyPlotRowCache(), this.m_data = new ot(this._plotFields), this ._graphics = new q(this._metaInfo), this._plotOffsets = {} }, v.prototype.onTagsChanged = function() { return this._tagsChanged }, v.prototype.properties = function() { return this._properties }, v.prototype.state = function(t) { var e, i, o, n, r = TradingView.className(this.constructor), s = { type: r, id: this.id(), state: this.properties().state(), zorder: this.zorder() }; for (this.metaInfo() instanceof st ? s.metaInfo = TradingView.clone(this.metaInfo() .state()) : (s.metaInfo = TradingView.clone(this.metaInfo()), s.metaInfo.id = st .parseIdString(s.metaInfo.id + (s.metaInfo.version ? "-" + s.metaInfo.version : "")).fullId), t && (s.data = this.m_data.state(), s.data.symbols = this ._resolvedSymbols, s.data.graphics = this._graphics.graphics(), s.data .plotOffsets = this._plotOffsets), this.ownerSource() && (s.ownerSource = this .ownerSource().id()), e = 0; e < this._metaInfo.inputs.length; e++) "bar_time" === this._metaInfo.inputs[e].type && (i = this._metaInfo.inputs[e].id, ( o = s.state.inputs[i]) < 0 && (n = this._rightOffsetToUnixTime(-o), s.state .inputs[i] = n && n >= 0 ? n : 0)); return this._isChildStudy && st.patchChildStudyMetaInfoState(s), s }, v.prototype._plotsForAlert = function() { var t = this, e = this._metaInfo, i = [at.PlotTypes.LINE, at.PlotTypes.SHAPES, at.PlotTypes.CHARS, at.PlotTypes .ARROWS, at.PlotTypes.OHLC_OPEN, at.PlotTypes.OHLC_HIGH, at.PlotTypes.OHLC_LOW, at.PlotTypes.OHLC_CLOSE ]; return e.plots.map(function(t, e) { return t.pinePlotIndex = e, t }).filter(function(t) { return -1 !== i.indexOf(t.type) }).map(function(i) { var o = { id: i.id, type: i.type, pinePlotIndex: i.pinePlotIndex, offset: t.offset(i.id) }; return e.styles && void 0 !== e.styles[i.id] && (o.title = e.styles[i.id] .title || ""), i.target && e.ohlcPlots && e.ohlcPlots[i.target] && ( o.ohlcTitle = e.ohlcPlots[i.target].title), o }) }, v.prototype.isSavedInStudyTemplates = function() { for (var t = 0; t < this._metaInfo.inputs.length; t++) if ("bar_time" === this._metaInfo.inputs[t].type) return !1; return !0 }, v.prototype.restoreData = function(t) { this._invalidateLastNonEmptyPlotRowCache(), this.m_data.restoreState(t), this ._resolvedSymbols = t.symbols, this._graphics.setGraphics(t.graphics), this ._postProcessGraphics(), this._plotOffsets = t.plotOffsets }, v.prototype.restart = function() { this._restarting = !0, this.clearData(), n.enabled("stop_study_on_restart") && this .stop(), setTimeout(this.start.bind(this), 0) }, v.prototype.stop = function(t) { if (!0 === t && this._children) for (var e = 0; e < this._children.length; ++e) this._children[e].stop(!0); this._chartApi && this._chartApi.connected() && this._studyId && this._chartApi .removeStudy(this._studyId, this._handler, this._isChildStudy), n.enabled( "update_study_formatter_on_symbol_resolve") && this._model.mainSeries() .onSymbolResolved().unsubscribe(this, v.prototype._createFormatter), this._studyId = null, this.clearData(), this._unsubscribeExtendedHours(), this.recalculate() }, v.prototype._resolveSymbol = function(t) { var e = function e(i, o) { this._chartApi.resolveSymbol(this._makeNextSymbolId(), i, function(i) { switch (i.method) { case "symbol_resolved": this._resolvedSymbols[t] = i.params[1], this .invalidateTitleCache(!0), o.resolve(t); break; case "symbol_error": if ("permission denied" === i.params[1] && i.params[2]) switch (i.params[2]) { case TradingView.Series.PD_REASON_EXTENDED_HOURS: break; case TradingView.Series.PD_REASON_SYMBOL: if (i.params[3]) return void e(i.params[3], o); break; default: return void e(i.params[2], o) } o.reject(t) } }.bind(this)) }.bind(this), i = $.Deferred(); return e(t, i), i.promise() }, v.prototype._allSymbolsAreResolved = function() { var t, e, i, o, n = $.Deferred(), r = []; for (t = 0; t < this._metaInfo.inputs.length; t++) "symbol" === this._metaInfo.inputs[t] .type && (e = this._metaInfo.inputs[t].id, i = this._properties.inputs[e].value(), this._resolvedSymbols[i] || (o = this._resolveSymbol(i), r.push(o))); return r.length > 0 ? $.when.apply($, r).done(function() { 0 !== this._studyId && this.stop(!0), this.start(!0), n.resolve( "All symbols are resolved now") }.bind(this)).fail(function(t) { this._status = $.t("Invalid Symbol"), this.stop(!0), this._model .updateSource(this), n.reject("Invalid symbol, " + t) }.bind(this)) : n.resolve("There are no symbols to resolve"), n.promise() }, v.prototype._allInputsAreValid = function() { var t, e, i; for (t = 0; t < this._metaInfo.inputs.length; t++) if ("bar_time" === this._metaInfo.inputs[t].type && (e = this._metaInfo.inputs[t] .id, void 0 === (i = this._properties.inputs[e].value()) || null == i)) return !1; return !0 }, v.prototype.sourceId = function() { return this._studyId }, v.prototype.source = function() { return this._source || this._series }, v.prototype.ownerSource = function() { return this._isChildStudy ? this._source : W.prototype.ownerSource.call(this) }, v.prototype.getAllOwnerSources = function() { for (var t = [], e = this.ownerSource(); null != e;) t.push(e), e = e.ownerSource(); return t }, v.prototype.isChildStudy = function() { return !!this._isChildStudy }, v.prototype.setChild = function(t) { t instanceof v && t.source() === this && (this._children || (this._children = []), - 1 === this._children.indexOf(t) && this._children.push(t)) }, v.prototype.unsetChild = function(t) { if (t instanceof v && t.source() === this && this._children) { var e = this._children.indexOf(t); ~e && this._children.splice(e, 1) } }, v.prototype.hasChildren = function() { return !(!this._children || !this._children.length) }, v.prototype.getAllChildren = function() { var t, e, i, o; if (!Array.isArray(this._children)) return []; for (t = this._children.slice(), e = 0; e < t.length; ++e) for (i = t[e].getAllChildren(), o = 0; o < i.length; ++o) ~t.indexOf(i[o]) || t .push(i[o]); return t }, v.prototype._debugId = function() { var t = []; return this._studyId && t.push(this._studyId), t.push(this._metaInfo.fullId), t.push( this._metaInfo.description), JSON.stringify({ study: t }) }, v.prototype.isStarted = function() { return !!this._studyId }, v.prototype.isRestarting = function() { return !!this._restarting }, v.prototype.isVisible = function() { var t, e, i; if (!this.properties().visible.value()) return !1; if (this._metaInfo.plots.length > 0) return !0; for (t in this._metaInfo.graphics) for (e in this._metaInfo.graphics[t]) if (i = this.properties().graphics[t][e], !i.visible || i.visible.value()) return !0; return !!this._metaInfo.isTVScriptStrategy }, v.prototype.start = function(t, e) { var i, o = this._model.mainSeries(); if (!o.isStarted()) return void o.onCompleted().subscribe(this, function() { this.start(t, e) }, !0); this._isChildStudy && this._source.isHibernated() && this._source.start(), i = !this ._isChildStudy && !this.hasChildren() && !this.isVisible(), !this._chartApi || !this ._chartApi.connected() || i && !0 !== e || this._allSymbolsAreResolved().done( function(i) { this._startAfterSymbolsResolved(t, e) }.bind(this)).fail(function(t) { ct.logError("ERROR: " + this._debugId() + " start failed, " + t), delete this._restarting }.bind(this)) }, v.prototype._getStudyIdWithLatestVersion = function() { var t = st.cutDollarHash(this._metaInfo.id), e = t; return ["Script@tv-scripting", "StrategyScript@tv-scripting", "ESD@tv-scripting"] .indexOf(t) >= 0 ? e += "-72!" : e += "-" + this._metaInfo.version, e }, v.prototype._startAfterSymbolsResolved = function(t, e) { var i, o; if (!this.isStarted() || this._restarting) { if (this._isChildStudy) { if (!this._source.isStarted() || this._source.isRestarting()) return void this ._source.onStart.subscribe(this, this._startAfterSymbolsResolved, !0); st.setChildStudyMetaInfoPropertiesSourceId(this._metaInfo, this._source .sourceId(), this._properties) } if (this._studyId = v.makeNextStudyId(), delete this._restarting, this ._allInputsAreValid() && (this._inputs = this.inputs(), i = this ._getStudyIdWithLatestVersion(), this._chartApi.createStudy(this._studyId, this._turnaround, this._isChildStudy ? this._source.sourceId() : this ._series._seriesId, i, this._inputs, this._handler, this._isChildStudy), this._studyName = i, this._subscribeExtendedHours(), this.onStart.fire(this._studyId), !0 === t && this._children)) for (o = 0; o < this._children.length; ++o) this._children[o].start(!0, e) } }, v._nextSymbolId = 0, v.prototype._makeNextSymbolId = function() { return "ss_" + ++v._nextSymbolId }, v._nextStudyId = 0, v.makeNextStudyId = function() { return "st" + ++v._nextStudyId }, v.prototype._rightOffsetToUnixTime = function(t) { var e; return this._series.bars().size() >= t && (e = w(this._series.bars().lastIndex()) - t, w(this._series.bars().valueAt(e))[TradingView.TIME_PLOT]), null }, v.prototype.getSymbolString = function(t) { return this._series && this._series.extendedHours.value() ? "=" + JSON.stringify({ symbol: t, session: "extended" }) : t }, v.prototype.inputsForGUI = function() { return this.inputs({ symbolsForDisplay: !0, skipHiddenInputs: !0, skipFakeInputs: !1, fakeInputsForDisplay: !0, asObject: !1 }) }, v.prototype.inputsForAlert = function() { var t = this.offset(), e = this.inputs(); return t && e.push(t), e }, v.prototype.inputs = function(t) { var e = { symbolsForDisplay: !1, symbolsForChartApi: !0, skipHiddenInputs: !1, skipFakeInputs: !1, asObject: !0 }; return TradingView.merge(e, t), this._buildInputs(e) }, v.prototype._buildInputs = function(t) { var e, i; S(!!t, "options not set"), e = {}; try { e = this._prepareInputs(t) } catch (t) { ct.logWarn("Failed to prepare study inputs: " + t) } return t.asObject ? (i = {}, Object.keys(e).forEach(function(t) { null != e[t] && (i[t] = e[t]) }), i) : (i = [], Object.keys(e).forEach(function(t) { null != e[t] && i.push(e[t]) }), i) }, v.prototype._prepareInputs = function(t) { var e, i, o, r; for (S(!!t, "options not set"), e = {}, i = 0; i < this._metaInfo.inputs.length; i++) o = this._metaInfo.inputs[i], o.isFake && t.skipFakeInputs || o.isHidden && t .skipHiddenInputs || "bool" === o.type && t.skipHiddenInputs && n.enabled( "dont_show_boolean_study_arguments") || (r = this._prepareInput(o, t), e[o.id] = TradingView.clone(r)); return e }, v.prototype._prepareInput = function(t, e) { var i = this._prepareInputValue(t, e); return !t.isFake || e.fakeInputsForDisplay ? i : e.onlyAtomValues ? i : { v: i, f: !0, t: t.type } }, v.prototype._prepareInputValue = function(t, e) { var i, o, n, r, s = t.id; return "symbol" === t.type ? (i = this._properties.inputs[s].value(), e && e .symbolsForDisplay ? this._resolvedSymbols && this._resolvedSymbols[i] && (i = this._resolvedSymbols[i].exchange ? this._resolvedSymbols[i].name + ", " + this._resolvedSymbols[i].exchange : this._resolvedSymbols[i].name) : (this ._resolvedSymbols && this._resolvedSymbols[i] && (o = this._resolvedSymbols[ i], i = o.ticker || o.full_name), e && e.symbolsForChartApi && (i = this .getSymbolString(i))), i) : "bar_time" === t.type ? (n = this ._properties.inputs[s].value(), n < 0 && (r = this._rightOffsetToUnixTime(-n), n = r && r >= 0 ? r : n), n) : this._metaInfo.isTVScript || this._metaInfo .pine ? "text" === s ? this._metaInfo.defaults.inputs.text : "pineId" === s ? this ._metaInfo.scriptIdPart : "pineVersion" === s ? this._metaInfo.pine ? this._metaInfo .pine.version : "-1" : this._properties.inputs[s].value() : this._properties.inputs[ s].value() }, v.prototype._rebindToSource = function(t, e) { var i, o, n, r, s, a, l, c, h, u, d; if (this._isChildStudy) { if (this._source.unsetChild(this), delete this._nonPriceParent, o = null, t === this ._model.mainSeries()) { for (n = this._model.studiesMetaData(), s = 0; s < n.length; ++s) if (this._metaInfo.id === n[s].id) { r = n[s]; break } if (!r) return void ct.logError("Can not find " + this._metaInfo.id + " meta info"); delete this._source, delete this._isChildStudy, delete this._ownerSource, this ._metaInfo = r.state(!0), i = this._series._seriesId, o = K .REBIND_STUDY_CHILD_TO_STANDALONE } else { if (!(t instanceof v)) return ct.logError( "Unable to rebind study to source of this type"), !1; this._ownerSource = t, this._source = t, i = this._source.sourceId(), this ._source.setChild(this), this._source.isHibernated() && this._source.start() } this._chartApi.rebindStudy(this._studyId, this._turnaround, i, this._studyName, e, this._handler, o) } else { if (!(t instanceof v)) return ct.logError( "Unable to rebind study to source of this type"), !1; if (a = t.isHibernated(), a && t.start(), l = !1, this ._canCreateStudyWithRebindType(K.REBIND_STUDY_STANDALONE_TO_CHILD) && (l = this ._chartApi.rebindStudy(this._studyId, this._turnaround, t.sourceId(), this ._studyName, e, this._handler, K.REBIND_STUDY_STANDALONE_TO_CHILD)), !l) return a && t.stop(), !1; this._metaInfo = TradingView.clone(this._metaInfo), this._isChildStudy = !0, this ._ownerSource = t, this._source = t, this._source.setChild(this), this ._childStudyByRebind.fire() } return c = this.m_priceScale, h = t.priceScale(), c !== h && (u = this._model .paneForSource(this), d = this._model.paneForSource(t), u === d && (~c .dataSources().indexOf(this) && c.removeDataSource(this), h.addDataSource( this), this.setPriceScale(h))), !0 }, v.prototype.childStudyByRebind = function() { return this._childStudyByRebind }, v.prototype._changeInputsImpl = function(t, e) { var i, o, n, r, s = this.source(), a = this._properties.inputs && this._properties.inputs.state(), l = st.getSourceIdByInputs(this._metaInfo.inputs, a), c = !0; if (l) if ("high" === l || "open" === l || "low" === l || "close" === l || "hl2" === l || "ohl3" === l || "ohlc4" === l) s = this._model.mainSeries(); else for (i = this._model.dataSources(), o = 0; o < i.length; ++o) if (i[o] instanceof v && i[o].sourceId() === l) { s = i[o]; break } if (s !== this.source()) { if (!this._rebindToSource(s, t) && a) { for (n = null, r = null, o = 0; o < e.length; ++o) if (e[o] !== t[o] && 0 === t[o].indexOf(l)) { n = this._properties.inputs[a[o].id], r = e[o], c = !1; break } n && n.setValue(r) } } else this._chartApi.modifyStudy(this._studyId, this._turnaround, t, this._handler); c && (this._studyModified = c) }, v.prototype._changeInputs = function(t) { var e = TradingView.clone(this._inputs); this._studyId && this._chartApi.connected() ? (this._turnaround = "st" + ++this ._turnaroundCounter, this._allInputsAreValid() ? this._allSymbolsAreResolved() .done(this._changeInputsImpl.bind(this, t, e)).fail(function(t) { ct.logError("ERROR: " + this._debugId() + " _changeInputs: cannot modify study, " + t) }.bind(this)) : this.stop()) : (this.stop(!0), this.start(!0)), this._inputs = t, this._tagsChanged.fire(), this._titleCache = {} }, v.prototype.testInputValue = function(t, e) { var i, o; return !st.canBeChild(this._metaInfo) || !st.isSourceInput(t) || (!(i = this._properties .inputs && this._properties.inputs[t.id]) || (o = v.getInputRebindType(t, i .value(), e), !!this._canCreateStudyWithRebindType(o))) }, v.prototype._canCreateStudyWithRebindType = function(t) { return t !== K.REBIND_STUDY_STANDALONE_TO_CHILD || this._chartApi.isCanCreateStudy(!0) }, v.prototype.changeStyles = function() { var t, e = null != this._metaInfo.inputs.filter(function(t) { return "symbol" === t.type })[0]; !this.isStarted() && !e || this._restarting || (this._inputs ? (t = this.inputs(), JSON .stringify(t) !== JSON.stringify(this._inputs) && this._changeInputs(t)) : this._chartApi && this._chartApi.connected() && this.restart(), this .hasBarColorer() && this._model.mainSeries().invalidateBarStylesCache(), e && this.invalidateBarStylesCache(), this.createViews(), this.recalculate(!0), this .updateAllViews()) }, v.prototype._isModifiedStudyInputs = function(t) { if (void 0 === this._oldStudyInputs) return this._oldStudyInputs = t, !0; var e = Object.keys(this._oldStudyInputs); return S(e.length === Object.keys(t).length, "keys quantity should be equal"), e .forEach(function(e) { S(t.hasOwnProperty(e), "key '" + e + "' should existing in studyInputs"), this._oldStudyInputs[e] !== t[e] && (this._oldStudyInputs = t) }, this), this._oldStudyInputs === t }, v.prototype.visibleChanged = function() { this._series instanceof TradingView.Series && this._series.invalidateBarColorerCache() }, v.prototype.invalidateBarStylesCache = function() { this.m_data.each(function(t, e) { e[TradingView.STYLE_PLOT] = null }) }, v.prototype.processHibernate = function() { this.isHibernateAllowed() && (!this._studyId && this.isVisible() && this.start(), this ._studyId && !this.isVisible() && this.stop()) }, v.prototype.isHibernated = function() { return !this.isVisible() && !this._studyId }, v.prototype.isHibernateAllowed = function() { return !this._isChildStudy && !this.hasChildren() }, v.prototype.lastPriceLabelFixedCoordinate = function(t) { return this._priceAxisViewsCache[t]._fixedCoordinate }, v.prototype.priceLabelText = function(t) { var e, i, o, n; return 1 === this._simplePlotsCount ? this._metaInfo.shortDescription : (e = this ._metaInfo.styles, i = this._metaInfo.ohlcPlots, e && e[t] && (o = e[t]), i && i[t] && (o = i[t]), n = o.title, this._metaInfo.is_price_study ? this._metaInfo .shortDescription + ":" + n : n) }, v.prototype.createPlotLabels = function(t) { for (var e = 0; e < t.length; e++) this._paneViews.push(new H(this._model, this, t[e], "priceLabelText", "showStudyPlotLabels")) }, v.prototype.createViews = function() { var t, e, i, o, n, r, a, l, c, h, u, d, p; if (this._priceAxisViewsBase = [], this._paneViews = [], t = {}, this ._priceAxisViewsCache = {}, e = [], this.metaInfo().plots) for (i = 0; i < this.metaInfo().plots.length; i++) if (!(this.isSelfColorerPlot(i) || this.isTextColorerPlot(i) || this .isBarColorerPlot(i) || this.isOHLCColorerPlot(i))) if (o = this.metaInfo().plots[i].id, this.isBgColorerPlot(i)) this ._paneViews.push(new E(this, this._series, this._model, o)); else if (this.isPlotShapesPlot(i)) this._paneViews.push(new D(this, this ._series, this._model, o)); else if (this.isPlotCharsPlot(i)) this._paneViews.push(new V(this, this._series, this ._model, o)); else if (this.isPlotArrowsPlot(i)) this._paneViews.push(new O(this, this._series, this ._model, o)); else if (this.isOHLCSeriesPlot(i)) { if (n = this.metaInfo().plots[i].target, t[n]) continue; t[n] = n, this.isOHLCBarsPlot(i) ? this._paneViews.push(new R(this, this._series, this ._model, n)) : this.isOHLCCandlesPlot(i) && this._paneViews.push(new B(this, this._series, this._model, n)), r = new k(this, { plotIndex: n }), this._priceAxisViewsCache[n] = r, this._priceAxisViewsBase.push(r), e.push( n) } else r = new k(this, { plotIndex: o }), this._priceAxisViewsCache[o] = r, this._priceAxisViewsBase.push(r), this ._paneViews.push(new M(this, this._series, this._model, o)), this.properties() .styles[o].trackPrice.value() && this._paneViews.push(new s(this, this._series, this ._model, o)), e.push(o); if (this._properties.bands) for (i = 0; i < this._properties.bands.childCount(); i++) this._properties.bands[i] .visible.value() && this._paneViews.push(new P(this._properties.bands[i], this)); this._properties.bandsBackground && this._paneViews.push(new L(this)), a = [], this .metaInfo().graphics && (a = Object.keys(this.metaInfo().graphics), a.sort(function( t, e) { return v.graphicsZOrderPriority(t) - v.graphicsZOrderPriority(e) })); for (l in a) c = a[l], h = "_paneView" + c, u = "StudyPaneView_" + c, TradingView.Study[ u] && (this[h] = new TradingView.Study[u](this, this._model), this._paneViews .push(this[h])), this._dataWindowView || "hhists" !== c || (this ._dataWindowView = new TradingView.StudyHHistsDataWindowView(this, this._model)); if (this._properties.areaBackground && this._paneViews.push(new N(this)), this ._properties.filledAreas && this._metaInfo.filledAreas) for (i = 0; i < this._metaInfo.filledAreas.length; ++i) d = this._metaInfo .filledAreas[i], p = this._properties.filledAreasStyle[d.id], d.type === st .FilledArea.TYPE_PLOTS || d.palette ? this._paneViews.push(new F(this, d, p)) : d.type === st.FilledArea.TYPE_HLINES ? this._paneViews.push(new I(this, d, p)) : ct.logWarn("Unsupported filledArea type: " + d.type); this.createPlotLabels(e), this._dataWindowView || (this._dataWindowView = new U(this, this._model)), this._statusView || (this._statusView = new j(this, this._model .properties())), this._priceAxisViews = [].concat(this._priceAxisViewsBase, this ._hlinesPriceAsisViews, this._horizlinesPriceAsisViews) }, v.prototype.recalculate = function(t) { var e = this._model.paneForSource(this); this._model.recalculatePane(e, t), this._model.updateSource(this) }, v.prototype.data = function() { return this.m_data }, v.prototype.metaInfo = function() { return this._metaInfo }, v.prototype.status = function() { return this._status }, v.prototype.title = function(t, e, i) { var o, n = JSON.stringify([t, e, i]); return this._titleCache[n] ? this._titleCache[n] : (o = this._title(t, e, i || !this ._showStudyArgumentsProperty.value()), this._titleCache[n] = o, o) }, v.prototype._title = function(t, e, i) { var o, n, r, s, a, l, c, h, u, d, p, _, f; if (o = t ? this._metaInfo.shortDescription || this._properties.shortDescription && this ._properties.shortDescription.value() || "Study" : this._metaInfo.description || this._properties.description && this._properties.description.value() || "Study", e = e || {}, o = $.t(o), !i && (n = this.inputsForGUI() || [], n.length > 0)) { if (r = {}, this._isChildStudy) for (s = 0; s < this._metaInfo.inputs.length; ++s) if (a = this._metaInfo.inputs[s], st.isSourceInput(a)) { l = a.id, c = this._properties.inputs[l].value(), c.indexOf("$") >= 0 && this._source && (h = this._source.metaInfo(), u = this._source.title(t, null, !0), 1 === h.plots.length ? r[ c] = u : (d = c.split("$")[1], p = h.plots[d].id, _ = h .styles && h.styles[p] && h.styles[p].title || p, r[c] = u + ": " + _)); break } f = this, n = n.map(function(t) { var i = isNumber(t) ? f._numericFormatter.format(t) : r && r[t] || t; return e[i] && (i = e[i]), i }), o += " (" + n.join(", ") + ")" } return o }, v.prototype.invalidateTitleCache = function(t) { if (this._titleCache = {}, !0 === t && this._children) for (var e = 0; e < this._children.length; ++e) this._children[e] .invalidateTitleCache(t) }, v.prototype.graphics = function() { return this._graphics.graphics() }, v.prototype.turnaround = function(t) { return !0 === t ? this.source().turnaround(!0) + "_" + this._turnaround : this ._turnaround }, v.prototype._checkTurnaround = function(t) { return t === this._turnaround || t === this._model.mainSeries().turnaround() || t === this.turnaround(!0) }, v.prototype._makeJSONForNSData = function(t, e) { var i = "" !== t.params.nonseries.d ? Y(t.params.nonseries.d) : e || ""; return Promise.resolve(i) }, v.prototype.onData = function(t) { var e, i, o, n, r = this; switch (t.method) { case "study_loading": this._status = $.t("loading..."), this._failed = !1, this._statusView.update(), this._model.updateSource(this), -1 === ["Plot splits", "Plot earnings", "Plot dividends" ].indexOf(r._metaInfo.description) && (r._loadingStartTime = (new Date) .getTime()); break; case "study_error": delete this._loadingStartTime, this._failed = !0, this.clearData(), "string" == typeof t.params[2] ? this._status = $.t(t.params[2].split(":", 2)[0]) : this ._status = "", this._statusView.update(), this._model.updateSource(this); break; case "study_completed": if (!this._checkTurnaround(t.params[1])) return Promise.resolve(); e = "chartSession:" + r._chartApi._sessionid, i = (new Date).getTime() - this ._loadingStartTime, ct.logDebug(e + ", Study " + this._metaInfo .description + " loading took " + i + " ms"), delete this ._loadingStartTime, this._status = "", this._statusView.update(), o = this ._model.paneForSource(this), this._model.recalculatePane(o), this ._updateSources(), this._model.invalidate(new G(G.FULL_UPDATE)); break; case "study_deleted": break; case "data_update": return this._checkTurnaround(t.params.turnaround) ? (this._studyModified && ( this.clearData(), this._studyModified = !1), n = 0 === this.m_data .size() && this._metaInfo.plots.length > 0, S(!!t.params.nonseries, "data.params.nonseries is missing"), new Promise(function(e) { r._makeJSONForNSData(t).then(function(i) { var o, s; t.params.nonseries.d = i, r._processPlotOffsets(t .params), r.transformData(t.params.plots), o = r._mergeData(t.params.plots).earliestRow, r .hasBarColorer() && (null !== o ? r._model .mainSeries().invalidateBarStylesCache(o .index) : ct.logNormal( "ERROR: No earliestRow in studies plots, " + r._debugId())), r._graphics.process(t .params.nonseries), r ._postProcessGraphics(), s = r._model .paneForSource( r), r._model.recalculatePane(s, n), r ._updateSources(), e() }) })) : Promise.resolve() } return Promise.resolve() }, v.prototype.transformData = function(t) {}, v.prototype.moveData = function(t) { this._invalidateLastNonEmptyPlotRowCache(), this.m_data.move(t) }, v.prototype.replaceData = function(t, e, i) { this._invalidateLastNonEmptyPlotRowCache(), this.m_data.remove(t + 1), this.m_data .addTail(i, e) }, v.prototype._updateSources = function() { this._model.updateSource(this), this.hasBarColorer() && this._model.updateSource(this ._model.mainSeries()) }, v.processPlotOffsets = function(t, e) { if (!e.nonseries || "nochange" !== e.nonseries.indexes) { var i = e.nonseries.d; if (!i || !i.indexes_replace) return i && i.offsets ? void(t._plotOffsets = i .offsets) : void(t._plotOffsets = {}) } }, v.prototype._processPlotOffsets = function(t) { v.processPlotOffsets(this, t) }, v.prototype._mergeData = function(t) { return this._invalidateLastNonEmptyPlotRowCache(), this.m_data.merge(t) }, v.prototype._postProcessGraphics = function() { var t = this, e = function(e) { var i, o, n, r, s = t._graphics.graphics(), a = []; if (s && s[e]) for (n = s[e], i = 0; i < n.length; i += 1) if (n[i].data) for (o = 0; o < n[i].data.length; o += 1) r = { line: n[i].data[o], styleId: n[i].styleId, lineType: e }, a.push(new v.StudyPriceAxisView_hlines(t, r)); return a }; this._hlinesPriceAsisViews = e("hlines"), this._horizlinesPriceAsisViews = e( "horizlines"), this._priceAxisViews = [].concat(this._priceAxisViewsBase, this ._hlinesPriceAsisViews, this._horizlinesPriceAsisViews) }, v.prototype._getNonPriceParent = function() { var t, e; if (this._nonPriceParent) return this._nonPriceParent; for (t = this.source(); t instanceof v;) { if (e = t.metaInfo(), !e.is_price_study || "Compare@tv-basicstudies" === e.id) return this._nonPriceParent = t, t; t = t.source() } }, v.prototype.firstValue = function(t) { var e, i, o, n, r, s; return !this._isChildStudy && "Compare@tv-basicstudies" === this._metaInfo.id || !this ._metaInfo.is_price_study ? null === (e = this._model.timeScale().visibleBars()) ? null : (i = e.firstBar(), o = e.lastBar(), 0 === this.m_data.size() ? null : (r = this, this.m_data.range(i, o).each(function(e, i) { var o, s, a; for (o = 1; o < i.length; ++o) if (void 0 !== i[o - 1] && null !== i[o - 1] && !r .isSelfColorerPlot(o - 1) && (s = r._metaInfo.plots[o - 1] .id, a = r.properties().styles[s], a.visible && a .visible.value() && !(t && Math.abs(i[o]) < 1e-10 || void 0 === i[o] || null === i[o] || n))) return n = i[o], !0 }), this._nonPriceFirstValue = n, n)) : this._isChildStudy && (s = this ._getNonPriceParent()) && this.priceScale() === s.priceScale() ? void 0 !== s ._nonPriceFirstValue ? s._nonPriceFirstValue : s.firstValue() : this._series .firstValue() }, v.offset = function(t, e) { var i = 0; return t._plotOffsets && void 0 !== t._plotOffsets[e] && (i += t._plotOffsets[e]), void 0 !== t._plotOffsetsMetaInfoOverride[e] ? i += t._plotOffsetsMetaInfoOverride[ e] : t.properties().offsets && void 0 !== t.properties().offsets[e] && (i += t .properties().offsets[e].val.value()), t.properties().offset && (i += t .properties().offset.val.value()), i }, v.prototype.offset = function(t) { return v.offset(this, t) }, v.prototype.priceRange = function(t, e) { var i, o, n, s, a, l, c, h, u, d, p, _, f, m, g, v, y, b, S, w; if (!TradingView.isInteger(t)) return void ct.logDebug( "priceRange: incorrect startBar"); if (!TradingView.isInteger(e)) return void ct.logDebug("priceRange: incorrect endBar"); if (0 === this.m_data.size()) return null; if (i = null, o = this, n = o._metaInfo, 0 === n.plots.length) return null; for (a = [], c = 0; c < n.plots.length; ++c) if (!(o.isSelfColorerPlot(c) || o.isTextColorerPlot(c) || o.isBarColorerPlot(c) || o .isBgColorerPlot(c) || o.isOHLCColorerPlot(c)) && (h = n.plots[c].id, o .isOHLCSeriesPlot(c) ? (d = n.plots[c].target, u = o.properties().ohlcPlots[d]) : u = o.properties().styles[h], u .visible.value() && (l = null, u.location && (l = u.location.value()), s || (p = [CanvasEx.MARKLOC_ABSOLUTE, CanvasEx.MARKLOC_TOP, CanvasEx .MARKLOC_BOTTOM ].indexOf(l) < 0, _ = o.isPlotShapesPlot(c) || o.isPlotCharsPlot(c), s = _ && p || o.isPlotArrowsPlot(c)), o.isLinePlot(c) || (o .isPlotShapesPlot(c) || o.isPlotCharsPlot(c)) && u.location .value() === CanvasEx.MARKLOC_ABSOLUTE || o.isOHLCSeriesPlot(c)))) { if (f = { index: c + 1, offset: o.offset(h) }, m = o.properties().styles[h].plottype.value(), !o.properties() .skipHistogramBaseOnAutoScale && [at.PlotType.Histogram, at.PlotType .Columns, at.PlotType.Area ].indexOf(m) >= 0) { if (g = o.properties().styles[h].histogramBase.value(), !isNumber(g)) continue; f.baseValue = g } a.push(f) } if (v = o.m_data.minMaxOnRange2(t, e, a), s && (a = [{ index: TradingView.LOW_PLOT, offset: 0 }, { index: TradingView.HIGH_PLOT, offset: 0 }], y = o.series().data().bars().minMaxOnRange2(t, e, a), v = rt(v, y)), null !== v && (i = new r(v.min, v.max)), n.bands) for (c = 0; c < n.bands.length; c++) if (o.properties().bands[c].visible.value()) { if (g = o.properties().bands[c].value.value(), !isNumber(g)) continue; i ? i.apply(g, g) : i = new r(g, g) } return i && i.minValue() === i.maxValue() && (b = .005 * i.minValue(), i = new r(i.minValue() - b, i.maxValue() + b)), S = this.priceScale(), S && S .properties().percentage.value() && i ? (w = this.firstValue(), w ? i .convertToPercents(w) : null) : S && S.isLog() && i ? new r(o.priceScale() .priceToLogical(i.minValue()), o.priceScale().priceToLogical(i.maxValue())) : i }, v.prototype.paneViews = function(t) { return this.properties().visible.value() ? this._paneViews : null }, v.prototype.dataWindowView = function() { return this._dataWindowView }, v.prototype.statusView = function() { return this._statusView }, v.prototype.priceAxisViews = function(t, e) { return this._model.paneForSource(this) === t && e === this.priceScale() && (this ._showLastValueOnPriceScale() || this.properties().oldShowLastValue && this .properties().oldShowLastValue.value()) ? this._priceAxisViews : null }, v.prototype._showLastValueOnPriceScale = function() { return this._model.properties().scalesProperties.showStudyLastValue.value() }, v.prototype.isLinePlot = function(t) { return this._metaInfo.plots[t].type === at.PlotTypes.LINE }, v.isSelfColorerPlot = function(t, e) { return t._metaInfo.plots[e].type === at.PlotTypes.COLORER }, v.prototype.isSelfColorerPlot = function(t) { return v.isSelfColorerPlot(this, t) }, v.prototype.isTextColorerPlot = function(t) { return this._metaInfo.plots[t].type === at.PlotTypes.TEXT_COLORER }, v.prototype.isBarColorerPlot = function(t) { return this._metaInfo.plots[t].type === at.PlotTypes.BAR_COLORER }, v.prototype.isBgColorerPlot = function(t) { return this._metaInfo.plots[t].type === at.PlotTypes.BG_COLORER }, v.prototype.isPlotShapesPlot = function(t) { return this._metaInfo.plots[t].type === at.PlotTypes.SHAPES }, v.prototype.isPlotCharsPlot = function(t) { return this._metaInfo.plots[t].type === at.PlotTypes.CHARS }, v.prototype.isPlotArrowsPlot = function(t) { return this._metaInfo.plots[t].type === at.PlotTypes.ARROWS }, v.prototype.isOHLCBarsPlot = function(t) { var e = this._metaInfo.plots[t].target, i = this.metaInfo().defaults.ohlcPlots[e]; return i && this.isOHLCSeriesPlot(t) && i.plottype === at.OHLCType.BARS }, v.prototype.isOHLCCandlesPlot = function(t) { var e = this._metaInfo.plots[t].target, i = this.metaInfo().defaults.ohlcPlots[e]; return i && this.isOHLCSeriesPlot(t) && i.plottype === at.OHLCType.CANDLES }, v.prototype.isOHLCSeriesPlot = function(t) { var e = this._metaInfo.plots[t].type; return e === at.PlotTypes.OHLC_OPEN || e === at.PlotTypes.OHLC_HIGH || e === at .PlotTypes.OHLC_LOW || e === at.PlotTypes.OHLC_CLOSE }, v.prototype.isOHLCOpenPlot = function(t) { return this._metaInfo.plots[t].type === at.PlotTypes.OHLC_OPEN }, v.prototype.isOHLCHighPlot = function(t) { return this._metaInfo.plots[t].type === at.PlotTypes.OHLC_HIGH }, v.prototype.isOHLCLowPlot = function(t) { return this._metaInfo.plots[t].type === at.PlotTypes.OHLC_LOW }, v.prototype.isOHLCClosePlot = function(t) { return this._metaInfo.plots[t].type === at.PlotTypes.OHLC_CLOSE }, v.prototype.isOHLCColorerPlot = function(t) { return this._metaInfo.plots[t].type === at.PlotTypes.OHLC_COLORER }, v.prototype.isDataOffsetPlot = function(t) { return this._metaInfo.plots[t].type === at.PlotTypes.DATAOFFSET }, v.prototype.hasBarColorer = function() { for (var t = 0; t < this._metaInfo.plots.length; ++t) if (this.isBarColorerPlot(t)) return !0; return !1 }, v.prototype.barColorer = function() { var t, e, i = null; for (t = 0; t < this._metaInfo.plots.length; ++t) this.isBarColorerPlot(t) && (e = new T(this, t), null == i ? i = e : i.pushBackBarColorer(e)); if (null == i) throw Error( "Cannot create BarColorer: study doesn't have a bar_colorer plot!"); return i }, v.prototype.base = function() { return "Volume" === this._metaInfo.id ? 1 : 0 }, v.prototype._createFormatter = function() { var t, e, i; "default" === this.properties().precision.value() ? this.metaInfo().defaults && (t = parseInt(this.metaInfo().defaults.precision)) : t = parseInt(this.properties() .precision.value()), isFinite(t) || (t = -1 !== ["Volume@tv-basicstudies", "VbPVisible@tv-volumebyprice", "VbPSessions@tv-volumebyprice" ].indexOf(this._metaInfo.id) ? 0 : 1e4), e = this.series().symbolInfo(), 0 === t ? ( i = 0, e && e.volume_precision && (i = e.volume_precision), this._formatter = new tt(i)) : this._formatter = new Q(Math.pow(10, t)), this.priceScale() && this .priceScale().updateFormatter() }, v.prototype.formatter = function() { return this._formatter }, v.prototype.nearestIndex = function(t, e) { if (!TradingView.isInteger(t)) return void ct.logDebug( "nearestIndex: incorrect logicalPoint"); var i = this._series.data().bars().search(t, e); return null !== i ? i.index : void 0 }, v.prototype._lastNonEmptyPlotRow = function(t) { var e, i; return TradingView.isInteger(t) ? void 0 !== this._lastNonEmptyPlotRowCache[t] ? this ._lastNonEmptyPlotRowCache[t] : (e = 1e3, null === (i = this.data().findLast( function(e, i) { return void 0 !== i[t] }, e)) ? null : (this._lastNonEmptyPlotRowCache[t] = i, this ._lastNonEmptyPlotRowCache[t])) : (ct.logDebug( "_lastNonEmptyPlotRow: incorrect plotIndex"), null) }, v.prototype.updateAllViews = function() { var t; for (t = 0; t < this._paneViews.length; t++) this._paneViews[t].update(); for (this._dataWindowView.update(), this._statusView.update(), t = 0; t < this ._priceAxisViews.length; t++) this._priceAxisViews[t].update() }, v.prototype.tags = function() { return !this._metaInfo || !this._metaInfo.description || this._metaInfo .isTVScriptStub || this._metaInfo.is_hidden_study || this._metaInfo.isTVScript && "tv-scripting" === this._metaInfo.productId ? [] : [this._metaInfo.description] }, v.isPointsBasedStudy = function(t) { switch (t) { case "VbPFixed@tv-volumebyprice": case "mtp_tsanalysis@mtp-mtpredictor": case "mtp_riskreward@mtp-mtpredictor": case "mtp_decisionpoint@mtp-mtpredictor": case "mtp_ew_main@mtp-mtpredictor": case "mtp_ew_major@mtp-mtpredictor": case "mtp_ew_minor@mtp-mtpredictor": case "mtp_wpt_down1ora@mtp-mtpredictor": case "mtp_wpt_down2orb@mtp-mtpredictor": case "mtp_wpt_down3@mtp-mtpredictor": case "mtp_wpt_down4@mtp-mtpredictor": case "mtp_wpt_down5@mtp-mtpredictor": case "mtp_wpt_downc@mtp-mtpredictor": case "mtp_wpt_up1ora@mtp-mtpredictor": case "mtp_wpt_up2orb@mtp-mtpredictor": case "mtp_wpt_up3@mtp-mtpredictor": case "mtp_wpt_up4@mtp-mtpredictor": case "mtp_wpt_up5@mtp-mtpredictor": case "mtp_wpt_upc@mtp-mtpredictor": return !0; default: return !1 } }, v.lineToolNameForPointsBasedStudy = function(t) { switch (t) { case "VbPFixed@tv-volumebyprice": return "LineToolVbPFixed"; case "RegressionTrend@tv-basicstudies": return "LineToolRegressionTrend"; case "mtp_tsanalysis@mtp-mtpredictor": return "LineStudyMtpAnalysis"; case "mtp_riskreward@mtp-mtpredictor": return "LineStudyMtpRiskReward"; case "mtp_decisionpoint@mtp-mtpredictor": return "LineStudyMtpDecisionPoint"; case "mtp_ew_main@mtp-mtpredictor": return "LineStudyMtpElliotWaveMain"; case "mtp_ew_major@mtp-mtpredictor": return "LineStudyMtpElliotWaveMajor"; case "mtp_ew_minor@mtp-mtpredictor": return "LineStudyMtpElliotWaveMinor"; case "mtp_wpt_down1ora@mtp-mtpredictor": return "LineStudyMtpDownWave1OrA"; case "mtp_wpt_down2orb@mtp-mtpredictor": return "LineStudyMtpDownWave2OrB"; case "mtp_wpt_down3@mtp-mtpredictor": return "LineStudyMtpDownWave3"; case "mtp_wpt_down4@mtp-mtpredictor": return "LineStudyMtpDownWave4"; case "mtp_wpt_down5@mtp-mtpredictor": return "LineStudyMtpDownWave5"; case "mtp_wpt_downc@mtp-mtpredictor": return "LineStudyMtpDownWaveC"; case "mtp_wpt_up1ora@mtp-mtpredictor": return "LineStudyMtpUpWave1OrA"; case "mtp_wpt_up2orb@mtp-mtpredictor": return "LineStudyMtpUpWave2OrB"; case "mtp_wpt_up3@mtp-mtpredictor": return "LineStudyMtpUpWave3"; case "mtp_wpt_up4@mtp-mtpredictor": return "LineStudyMtpUpWave4"; case "mtp_wpt_up5@mtp-mtpredictor": return "LineStudyMtpUpWave5"; case "mtp_wpt_upc@mtp-mtpredictor": return "LineStudyMtpUpWaveC"; default: throw Error("There is no line tool name, associated with study id " + t) } }, v.isStudyLineTool = function(t) { var e = i(128).StudyLineDataSource, o = TradingView[t]; return "function" == typeof o && o.prototype instanceof e }, v.prototype.onExtendedHoursChanged = function() { this.restart() }, v.prototype.hasSymbolInputs = function() { for (var t = this._metaInfo.inputs.length; t--;) if ("symbol" === this._metaInfo.inputs[t].type) return !0; return !1 }, v.prototype._subscribeExtendedHours = function() { !this._isSubscribedToExtendedHours && this.hasSymbolInputs() && (this._series .extendedHours.listeners().subscribe(this, this.onExtendedHoursChanged), this ._isSubscribedToExtendedHours = !0) }, v.prototype._unsubscribeExtendedHours = function() { this._isSubscribedToExtendedHours && (this._series.extendedHours.listeners() .unsubscribe(this, this.onExtendedHoursChanged), delete this ._isSubscribedToExtendedHours) }, v.prototype.removeByRemoveAllStudies = function() { return !0 }, v.prototype.canHaveChildren = function() { return void 0 === this._canHaveChildren && (this._canHaveChildren = !!st .canHaveChildren(this._metaInfo)), this._canHaveChildren }, v.getInputRebindType = function(t, e, i) { var o = st.isSourceInput(t); return o && !~e.indexOf("$") && ~i.indexOf("$") ? K.REBIND_STUDY_STANDALONE_TO_CHILD : o && ~e.indexOf("$") && !~i.indexOf("$") ? K.REBIND_STUDY_CHILD_TO_STANDALONE : 0 }, v.prototype.getPlotFields = function() { return this._plotFields }, v.prototype.getMinFirstBarIndexForPlot = function(t) { var e, i = y(this._properties.styles, t) || y(this._properties.ohlcPlots, t) || y(this ._properties.filledAreasStyle, t); return null === i ? -1 / 0 : (e = this.data().lastIndex(), null === e ? -1 / 0 : e - i + 1) }, v.prototype.getInputsPropertyPage = function() { return lt.StudyInputsPropertyPage }, v.prototype.getStylesPropertyPage = function() { return lt.StudyStylesPropertyPage }, v.prototype.getDisplayPropertyPage = function() { return lt.StudyDisplayPropertyPage }, t.exports = { Study: v, createStudy: l, prepareStudyProperties: c, prepareStudyPropertiesForLoadChart: u, prepareStudyPropsStateForLoadChart: _ } }).call(e, i(25), i(10), i(5), i(73)) }, , , , , function(t, e, i) { "use strict"; function o(t, e, i) { var o, n, s; for (e = e || t || i || "", o = "", n = 0; n < c.length; n++) if ((s = e.match(c[n])) && 3 === s.length) { e = s[1], o = s[2]; break } r.emit(e.toLowerCase().replace(" ", "_"), { category: t, label: i, value: o }) } function n(t, e, i) { var n, r, a; if (s.enabled("charting_library_base")) return void o(t, e, i); n = (t ? t + ":" : "") + e, i && (n += " " + i), l.logNormal(n), s.enabled("widget") || (r = window ._gaq, window._UNIT_TESTS || void 0 === r || (a = ["_trackEvent", t, e], void 0 !== i && a .push(i), r.push(a))) } var r, s, a, l, c; Object.defineProperty(e, "__esModule", { value: !0 }), r = i(23), s = i(5), a = i(7), l = a.getLogger("Common.TrackEvent"), c = [ /Study_(Drawing)_(.*)/, /(Study)_(.*)@tv-basicstudies/, /(Study)_(.*)/, /(Chart Style) (.*)/ ], e.trackEvent = n, window.TradingView = window.TradingView || {}, window.TradingView.trackEvent = n }, , , , function(t, e, i) { "use strict"; function o(t, e, i) { var o = e.subtract(t), n = i.subtract(t), r = n.dotProduct(o) / o.dotProduct(o); return { coeff: r, distance: t.addScaled(o, r).subtract(i).length() } } function n(t, e, i) { var n, r, s = o(t, e, i); return 0 <= s.coeff && s.coeff <= 1 ? s : (n = t.subtract(i).length(), r = e.subtract(i).length(), n < r ? { coeff: 0, distance: n } : { coeff: 1, distance: r }) } Object.defineProperty(e, "__esModule", { value: !0 }), e.distanceToLine = o, e.distanceToSegment = n }, function(t, e, i) { "use strict"; function o(t, e, i, o, n, r) { var s, a, h, u; return l.equalPoints(t, e) ? null : (s = new l.Point(0, 0), a = new l.Point(i, o), n ? r ? (h = c .intersectLineAndRectangle(l.lineThroughPoints(t, e), s, a), Array.isArray(h) ? h : null ) : (u = c.intersectRayAndRectangle(e, t, s, a), null === u || l.equalPoints(e, u) ? null : l.lineSegment(e, u)) : r ? (u = c.intersectRayAndRectangle(t, e, s, a), null === u || l.equalPoints(t, u) ? null : l.lineSegment(t, u)) : (h = c .intersectLineSegmentAndRectangle(l.lineSegment(t, e), s, a), Array.isArray(h) ? h : null)) } function n(t) { return .3 * t } function r(t) { return 2 + .5 * t } function s(t) { return null !== t && void 0 !== t && !h.isNaN(t) } function a(t, e) { void 0 !== e && u.setLineStyle(t, e) } var l, c, h, u; Object.defineProperty(e, "__esModule", { value: !0 }), l = i(8), c = i(132), h = i(15), u = i(90), e.extendAndClipLineSegment = o, e.optimalBarWidth = n, e.selectionTolerance = r, e.coordinateIsValid = s, e.setValidLineStyle = a }, function(t, e, i) { "use strict"; (function(t) { function o() { this._zorder = 0, this.m_priceScale = null, this._id = s.randomHashN(6), this._ownerSource = null, this._userEditEnabled = !0, this.hasAlert = new t(!1) } function n(t) { o.call(this), this._isOverlay = null, this._model = t } var r = i(6).DefaultProperty, s = i(61); o.prototype.createPropertiesObject = function(t, e, i) { return new r(t, e, i) }, o.prototype.id = function() { return this._id }, o.prototype.idForAlert = function() { return this._id }, o.prototype.setId = function(t) { this._id = t }, o.prototype.zorder = function() { return this._zorder }, o.prototype.setZorder = function(t) { "number" == typeof t && this._zorder !== t && (this._zorder = t) }, o.prototype.title = function() { throw Error("Implement this fun in a subclass") }, o.prototype.priceScale = function() { return this.m_priceScale }, o.prototype.setPriceScale = function(t) { this.m_priceScale = t }, o.prototype.ownerSource = function() { return this._ownerSource }, o.prototype.setOwnerSource = function(t) { this._ownerSource = t, t && this.setPriceScale(t.priceScale()) }, o.prototype.isSavedInChart = function(t) { return !0 }, o.prototype.isSavedInStudyTemplates = function() { return !0 }, o.prototype.isRemovedByStudyTemplates = function() { return !0 }, o.prototype.hasContextMenu = function() { return !0 }, o.prototype.showInObjectTree = function() { return !0 }, o.prototype.setUserEditEnabled = function(t) { this._userEditEnabled = t }, o.prototype.userEditEnabled = function() { return this._userEditEnabled }, o.prototype.canBeHidden = function() { return this.userEditEnabled() }, o.prototype.isUserDeletable = function() { return this.userEditEnabled() }, o.prototype.canHasAlert = function() { return !1 }, o.prototype.properties = function() { throw Error("Implement this fun in a subclass") }, o.prototype.statusView = function() { return null }, o.prototype.dataWindowView = function() { return null }, o.prototype.priceAxisViews = function(t, e) { return null }, o.prototype.updateAllViews = function() {}, o.prototype.paneViews = function(t) { return null }, o.prototype.isChildStudy = function() { return !1 }, o.prototype.hasChildren = function() { return !1 }, o.prototype.canHaveChildren = function() { return !1 }, o.prototype.onClickOutside = function() {}, o.prototype.getInputsPropertyPage = function() { return null }, o.prototype.getStylesPropertyPage = function() { return null }, o.prototype.getDisplayPropertyPage = function() { return null }, o.prototype.getVisibilitiesPropertyPage = function() { return null }, o.prototype.getStrategyPropertyPage = function() { return null }, o.prototype.getSourceIcon = function() { return null }, inherit(n, o), n.prototype.isNoScale = function() { return !!this._isOverlay }, n.prototype.base = function() { return 0 }, n.prototype.formatter = function() { return null }, n.prototype.model = function() { return this._model }, n.prototype.priceRange = function(t, e) { return null }, n.prototype.isDraggable = function() { return !this._metaInfo || !this._metaInfo.linkedToSeries }, n.prototype.priceLineColor = function(t) { return t }, e.DataSource = o, e.PriceDataSource = n }).call(e, i(17)) }, function(t, e, i) { "use strict"; function o(t, e, i, o, n) { this._wptStudyId = o, this._pointsCount = n, m.call(this, t, e, i) } function n(t, e, i) { o.call(this, t, e, i, "mtp_wpt_down1ora", 2) } function r(t, e, i) { o.call(this, t, e, i, "mtp_wpt_down2orb", 2) } function s(t, e, i) { o.call(this, t, e, i, "mtp_wpt_down3", 3) } function a(t, e, i) { o.call(this, t, e, i, "mtp_wpt_down4", 2) } function l(t, e, i) { o.call(this, t, e, i, "mtp_wpt_down5", 5) } function c(t, e, i) { o.call(this, t, e, i, "mtp_wpt_downc", 3) } function h(t, e, i) { o.call(this, t, e, i, "mtp_wpt_up1ora", 2) } function u(t, e, i) { o.call(this, t, e, i, "mtp_wpt_up2orb", 2) } function d(t, e, i) { o.call(this, t, e, i, "mtp_wpt_up3", 3) } function p(t, e, i) { o.call(this, t, e, i, "mtp_wpt_up4", 2) } function _(t, e, i) { o.call(this, t, e, i, "mtp_wpt_up5", 5) } function f(t, e, i) { o.call(this, t, e, i, "mtp_wpt_upc", 3) } var m = i(105).LineStudyMtp; inherit(o, m), o.prototype._studyInputs = function() { var t, e, i, o, n = this.points(); if (n.length < this.pointsCount()) return null; for (t = [this.properties().inputs.displayZoneLabels.value()], e = 0; e < this.pointsCount(); ++ e) { if (i = n[e].index, null === (o = this._model.mainSeries().bars().valueAt(i))) return null; t.push(1e3 * o[TradingView.TIME_PLOT]) } return t }, o.prototype._mtpStudyId = function() { return this._wptStudyId }, o.prototype.pointsCount = function() { return this._pointsCount }, inherit(n, o), n.getTooltipText = function(t) { return "Down Wave 1 or A: Select Point " + ((t ? t._points.length : 0) + 1) }, inherit(r, o), r.getTooltipText = function(t) { return "Down Wave 2 or B: Select Point " + ((t ? t._points.length : 0) + 1) }, inherit(s, o), s.getTooltipText = function(t) { return "Down Wave 3: Select Point " + ((t ? t._points.length : 0) + 1) }, inherit(a, o), a.getTooltipText = function(t) { return "Down Wave 4: Select Point " + ((t ? t._points.length : 0) + 1) }, inherit(l, o), l.getTooltipText = function(t) { return "Down Wave 5: Select Point " + ((t ? t._points.length : 0) + 1) }, inherit(c, o), c.getTooltipText = function(t) { return "Down Wave C: Select Point " + ((t ? t._points.length : 0) + 1) }, inherit(h, o), h.getTooltipText = function(t) { return "Up Wave 1 or A: Select Point " + ((t ? t._points.length : 0) + 1) }, inherit(u, o), u.getTooltipText = function(t) { return "Up Wave 2 or B: Select Point " + ((t ? t._points.length : 0) + 1) }, inherit(d, o), d.getTooltipText = function(t) { return "Up Wave 3: Select Point " + ((t ? t._points.length : 0) + 1) }, inherit(p, o), p.getTooltipText = function(t) { return "Up Wave 4: Select Point " + ((t ? t._points.length : 0) + 1) }, inherit(_, o), _.getTooltipText = function(t) { return "Up Wave 5: Select Point " + ((t ? t._points.length : 0) + 1) }, inherit(f, o), f.getTooltipText = function(t) { return "Up Wave C: Select Point " + ((t ? t._points.length : 0) + 1) }, e.LineStudyMtpDownWave1OrA = n, e.LineStudyMtpDownWave2OrB = r, e.LineStudyMtpDownWave3 = s, e .LineStudyMtpDownWave4 = a, e.LineStudyMtpDownWave5 = l, e.LineStudyMtpDownWaveC = c, e .LineStudyMtpUpWave1OrA = h, e.LineStudyMtpUpWave2OrB = u, e.LineStudyMtpUpWave3 = d, e .LineStudyMtpUpWave4 = p, e.LineStudyMtpUpWave5 = _, e.LineStudyMtpUpWaveC = f }, function(t, e, i) { "use strict"; (function(e) { var o = i(86), n = 1e-10, r = function() { function t(t, e, i, o, n) { var r, s = n, a = 0; if (isNaN(t.get(e - 1))) return { index: NaN, value: NaN }; for (r = 0; r < e; ++r) o(t.get(r), s) && (a = r, s = t.get(r)); return { index: a, value: s } } function r(t, e) { return 100 * t / e } function s(t, e, i, o, n) { var r, s, a; this._areaRight = t, this._areaLeft = e, this._pivotType = i, this._series = o, this ._currentIndex = n.new_var(0), this._currentValue = n.new_var(NaN), this ._pivotIndex = n.new_var(-1), this._index = w.n(n), this._isNewBar = n.symbol .isNewBar, r = this._currentIndex.get(1), s = this._currentValue.get(1), a = this._pivotIndex.get(1), this._index > 1 && (this._currentIndex.set(r), this ._currentValue.set(s), this._pivotIndex.set(a)) } function a(t, e, i) { var o, n, r, a, l; this._deviation = t, o = i.new_var(w.high(i)), n = i.new_var(w.low(i)), o.get(2 * e + 1), n.get(2 * e + 1), this._pivotHigh = new s(e, e, s.HIGH, o, i), this ._pivotLow = new s(e, e, s.LOW, n, i), this._lastVal = i.new_var(NaN), this ._lastIndex = i.new_var(-1), this._lastType = i.new_var(), this._index = w.n(i), this._isNewBar = i.symbol.isNewBar, this._isBarClosed = i.symbol.isBarClosed, r = this._lastIndex.get(1), a = this._lastVal.get(1), l = this._lastType.get(1), this._index > 1 && this.addPivot(r, a, l), this.processPivot(this._pivotHigh), this.processPivot(this._pivotLow) } function l(t) { this.symbol = t, this.vars = [], this.vars_index = 0, this.ctx = [], this .ctx_index = 0 } function c(t) { this.mindepth = 0, this.original = NaN, this.modified = !1, this.symbol = t } function h(t, e) { this.timezone = t || "America/New_York", this.session = e || "0000-0000" } function u(t, e, i, o, n, r) { this.periodBase = i, this.tickerid = t, this.period = e, this.index = -1, this .time = NaN, this.open = NaN, this.high = NaN, this.low = NaN, this.close = NaN, this.volume = NaN, this.updatetime = NaN, this.isNewBar = !1, this .isBarClosed = !1, this.session = new S.Session, this.other_sessions = {}, this .script = o, this.ticker = u.parseTicker(t); var s = u.parsePeriod(e); this.resolution = s.resolution, this.interval = s.interval, this.bb_cache = {}, this .minTick = n, this.periodForInitialRange = r } function d(t, e, i, o, n, r, s, a, c) { this.body = n, this.symbols = [], this.runner = o, this.inputCallback = s, this .out = r, this.nonseriesOut = c, this.ctx = new l(this.add_sym(t, e, i, a)), this.init() } function p(t) { this.symbols = [], this.barsets = [], this.subscription = [], this.host = t, this .isRecalculated = !1, this.start() } function _(t) { p.feed = t } function f(t) { this.runner = new p(t) } function m(t, e) { this.info = t, this.bars = e || [], this.isBarClosed = !0 } function g(t, e) { this.period = t, this.generateEmptyBars = !!e } function v() {} var y = "undefined" != typeof window ? window : e, b = y.PineJsCalendar ? y.PineJsCalendar : i(50), S = i(58), w = {}; return w.max_series_size = 10001, w.n = function(t) { return t.symbol.index + 1 }, w.nz = function(t, e) { return e = e || 0, isFinite(t) ? t : e }, w.na = function(t) { return 0 === arguments.length ? NaN : isNaN(t) ? 1 : 0 }, w.isZero = function(t) { return Math.abs(t) <= 1e-10 }, w.toBool = function(t) { return isFinite(t) && !w.isZero(t) }, w.eq = function(t, e) { return w.isZero(t - e) }, w.neq = function(t, e) { return !w.eq(t, e) }, w.ge = function(t, e) { return w.isZero(t - e) || t > e }, w.gt = function(t, e) { return !w.isZero(t - e) && t > e }, w.lt = function(t, e) { return !w.isZero(t - e) && t < e }, w.le = function(t, e) { return w.isZero(t - e) || t < e }, w.and = function(t, e) { return isNaN(t) || isNaN(e) ? NaN : w.isZero(t) || w.isZero(e) ? 0 : 1 }, w.or = function(t, e) { return isNaN(t) || isNaN(e) ? NaN : w.isZero(t) && w.isZero(e) ? 0 : 1 }, w.not = function(t) { return isNaN(t) ? NaN : w.isZero(t) ? 1 : 0 }, w.greaterOrEqual = function(t, e) { return e - t < n }, w.lessOrEqual = function(t, e) { return t - e < n }, w.equal = function(t, e) { return Math.abs(t - e) < n }, w.greater = function(t, e) { return t - e > n }, w.less = function(t, e) { return e - t > n }, w.max = Math.max, w.min = Math.min, w.pow = Math.pow, w.abs = Math.abs, w.log = Math.log, w.log10 = function(t) { return Math.log(t) / Math.LN10 }, w.sqrt = Math.sqrt, w.sign = function(t) { return isNaN(t) ? NaN : w.isZero(t) ? 0 : t > 0 ? 1 : -1 }, w.exp = Math.exp, w.sin = Math.sin, w.cos = Math.cos, w.tan = Math.tan, w.asin = Math.asin, w.acos = Math.acos, w.atan = Math.atan, w.floor = Math.floor, w.ceil = Math.ceil, w.round = Math.round, w.avg = function(t, e, i, o, n, r) { var s, a; if (2 === arguments.length) return (t + e) / 2; for (s = 0, a = 0; a < arguments.length; a++) s += arguments[a]; return s / arguments.length }, w.open = function(t) { return t.symbol.open }, w.high = function(t) { return t.symbol.high }, w.low = function(t) { return t.symbol.low }, w.close = function(t) { return t.symbol.close }, w.hl2 = function(t) { return (t.symbol.high + t.symbol.low) / 2 }, w.hlc3 = function(t) { return (t.symbol.high + t.symbol.low + t.symbol.close) / 3 }, w.ohlc4 = function(t) { return (t.symbol.open + t.symbol.high + t.symbol.low + t.symbol.close) / 4 }, w.volume = function(t) { return t.symbol.volume }, w.updatetime = function(t) { return t.symbol.updatetime }, w.time = function(t, e, i) { return t.symbol.bartime(e, i) }, w.period = function(t) { return t.symbol.period }, w.tickerid = function(t) { return t.symbol.tickerid }, w.ticker = function(t) { return t.symbol.ticker }, w.interval = function(t) { return t.symbol.interval }, w.isdwm = function(t) { return t.symbol.isdwm() }, w.isintraday = function(t) { return !t.symbol.isdwm() }, w.isdaily = function(t) { return "D" === t.symbol.resolution }, w.isweekly = function(t) { return "W" === t.symbol.resolution }, w.ismonthly = function(t) { return "M" === t.symbol.resolution }, w.year = function(t) { return w.timepart(t.symbol, b.YEAR, arguments[1]) }, w.month = function(t) { return w.timepart(t.symbol, b.MONTH, arguments[1]) }, w.weekofyear = function(t) { return w.timepart(t.symbol, b.WEEK_OF_YEAR, arguments[1]) }, w.dayofmonth = function(t) { return w.timepart(t.symbol, b.DAY_OF_MONTH, arguments[1]) }, w.dayofweek = function(t) { return w.timepart(t.symbol, b.DAY_OF_WEEK, arguments[1]) }, w.hour = function(t) { return w.timepart(t.symbol, b.HOUR_OF_DAY, arguments[1]) }, w.minute = function(t) { return w.timepart(t.symbol, b.MINUTE, arguments[1]) }, w.second = function(t) { return w.timepart(t.symbol, b.SECOND, arguments[1]) }, w.add_days_considering_dst = function(t, e, i) { return b.add_days_considering_dst(b.get_timezone(t), e, i) }, w.selectSessionBreaks = function(t, e) { var i, o, n, r, s, a; if (w.isdwm(t) || void 0 === t.symbol.session.timezone) return []; if (i = u.newBarBuilder(t.symbol.period, t.symbol.session), o = [], n = e .length, i.moveTo(e[n - 1]), 1 === n && i.sessionStart === e[0]) o.push(e[ 0]); else { for (r = n - 2; r >= 0; --r)(s = e[r]) >= i.sessionStart || (i.moveTo(s), a = e[r + 1], o.push(a)); o.reverse() } return o }, w.iff = function(t, e, i) { return w.not(t) ? i : e }, w.rising = function(t, e) { for (var i = 1; i < e + 1; ++i) if (t.get(i) > t.get(0)) return 0; return 1 }, w.falling = function(t, e) { for (var i = 1; i < e + 1; ++i) if (t.get(i) < t.get(0)) return 0; return 1 }, w.timepart = function(t, e, i) { var o = b.utc_to_cal(t.timezone, i || t.bartime()); return b.get_part(o, e) }, w.rsi = function(t, e) { return w.isZero(e) ? 100 : w.isZero(t) ? 0 : 100 - 100 / (1 + t / e) }, w.sum = function(t, e, i) { var o = i.new_var(), n = w.nz(t.get()) + w.nz(o.get(1)) - w.nz(t.get(e)); return o.set(n), n }, w.sma = function(t, e, i) { var o = w.sum(t, e, i); return w.na(t.get(e - 1)) ? NaN : o / e }, w.rma = function(t, e, i) { var o = w.sum(t, e, i), n = e - 1, r = t.get(n), s = i.new_var(), a = s.get(1), l = t.get(), c = w.na(r) ? NaN : w.na(a) ? o / e : (l + a * n) / e; return s.set(c), c }, w.fixnan = function(t, e) { var i = e.new_var(); return isNaN(t) ? i.get(1) : (i.set(t), t) }, w.tr = function(t, e) { var i, o, n; return 1 === arguments.length && (e = t, t = void 0), i = void 0 !== t && !!t, o = e.new_var(w.close(e)), n = o.get(1), i && isNaN(n) && (n = w.close(e)), w.max(w.max(w.high(e) - w.low(e), w.abs(w.high(e) - n)), w.abs(w.low(e) - n)) }, w.atr = function(t, e) { var i = e.new_var(w.tr(e)); return w.sma(i, t, e) }, w.ema = function(t, e, i) { var o = w.sum(t, e, i), n = i.new_var(), r = t.get(0), s = t.get(e - 1), a = n.get(1), l = w.na(s) ? NaN : w.na(a) ? o / e : 2 * (r - a) / (e + 1) + a; return n.set(l), l }, w.wma = function(t, e, i) { var o, n, r = 0; for (e = Math.round(e), o = e; o >= 0; o--) n = e - o, r += n * t.get(o); return 2 * r / (e * (e + 1)) }, w.vwma = function(t, e, i) { var o = i.new_var(w.volume(i)), n = i.new_var(t.get(0) * w.volume(i)); return w.sma(n, e, i) / w.sma(o, e, i) }, w.swma = function(t, e) { return (t.get(0) + 2 * t.get(1) + 2 * t.get(2) + t.get(3)) / 6 }, w.lowestbars = function(e, i, o) { return -t(e, i, o, function(t, e) { return w.lt(t, e) }, Number.MAX_VALUE).index }, w.lowest = function(e, i, o) { return t(e, i, o, function(t, e) { return w.lt(t, e) }, Number.MAX_VALUE).value }, w.highestbars = function(e, i, o) { return -t(e, i, o, function(t, e) { return w.gt(t, e) }, Number.MIN_VALUE).index }, w.highest = function(e, i, o) { return t(e, i, o, function(t, e) { return w.gt(t, e) }, Number.MIN_VALUE).value }, w.cum = function(t, e) { var i = e.new_var(), o = w.nz(i.get(1)) + t; return i.set(o), o }, w.accdist = function(t) { var e = w.high(t), i = w.low(t), o = w.close(t), n = w.volume(t); return w.cum(o === e && o === i || e === i ? 0 : n * (2 * o - i - e) / (e - i), t) }, w.correlation = function(t, e, i, o) { var n = w.sma(t, i, o), r = w.sma(e, i, o), s = o.new_var(t.get() * e.get()); return (w.sma(s, i, o) - n * r) / Math.sqrt(w.variance2(t, n, i) * w.variance2( e, r, i)) }, w.stoch = function(t, e, i, o, n) { var s = w.highest(e, o), a = w.lowest(i, o); return w.fixnan(r(t.get() - a, s - a), n) }, w.tsi = function(t, e, i, o) { var n = o.new_var(w.change(t)), r = o.new_var(w.abs(w.change(t))), s = o.new_var(w.ema(n, i, o)), a = o.new_var(w.ema(r, i, o)); return w.ema(s, e, o) / w.ema(a, e, o) }, w.cross = function(t, e, i) { function o(t) { return t < 0 ? -1 : 0 === t ? 0 : 1 } if (isNaN(t) || isNaN(e)) return !1; var n = i.new_var(o(t - e)); return !isNaN(n.get(1)) && n.get(1) !== n.get() }, w.linreg = function(t, e, i) { var o, n, r, s, a, l, c = 0, h = 0, u = 0, d = 0; for (o = 0; o < e; ++o) n = t.get(o), r = e - 1 - o, s = r + 1, c += s, h += n, u += s * s, d += n * s; return a = (e * d - c * h) / (e * u - c * c), l = h / e, l - a * c / e + a + a * (e - 1 - i) }, w.sar = function(t, e, i, o) { function n(e, i) { var o = m.get(); return g.set(e), m.set(i), v.set(1e3 * t), y.set(o), o } var r, s, a = w.high(o), l = w.low(o), c = w.close(o), h = o.new_var(a), u = o.new_var(l), d = o.new_var(c), p = d.get(1), _ = u.get(1), f = h.get(1), m = o.new_var(), g = o.new_var(), v = o.new_var(), y = o.new_var(), b = y.get(1); if (isNaN(p)) return NaN; if (r = 1e-7, isNaN(b) && (w.ge(c, p) ? (g.set(1), m.set(Math.max(a, f)), b = Math.min(l, _)) : (g.set(-1), b = Math.max(a, f), m.set(Math.min(l, _))), v.set(1e3 * t)), 1 === g.get()) { if (w.gt(a, m.get()) && (m.set(a), v.set(Math.min(v.get() + 1e3 * e, 1e3 * i))), w.le(l, b)) return n(-1, l) } else if (w.lt(l, m.get()) && (m.set(l), v.set(Math.min(v.get() + 1e3 * e, 1e3 * i))), w.ge(a, b)) return n(1, a); return s = b + v.get() * (m.get() - b) / 1e3, 1 === g.get() ? w.ge(s, l) && (s = l - r) : w.le(s, a) && (s = a + r), y.set(s), s }, w.alma = function(t, e, i, o) { var n, r, s, a = Math.floor(i * (e - 1)), l = e / o * (e / o), c = [], h = 0; for (n = 0; n < e; ++n) r = Math.exp(-1 * Math.pow(n - a, 2) / (2 * l)), h += r, c.push(r); for (n = 0; n < e; ++n) c[n] /= h; for (s = 0, n = 0; n < e; ++n) s += c[n] * t.get(e - n - 1); return s }, w.wvap = function(t, e) { return t.get() - t.get(1) }, w.change = function(t) { return t.get() - t.get(1) }, w.roc = function(t, e) { var i = t.get(e); return 100 * (t.get() - i) / i }, w.dev = function(t, e, i) { var o = w.sma(t, e, i); return w.dev2(t, e, o) }, w.dev2 = function(t, e, i) { var o, n, r, s = 0; for (o = 0; o < e; o++) n = t.get(o), r = w.abs(n - i), s += r; return s / e }, w.stdev = function(t, e, i) { var o = w.variance(t, e, i); return w.sqrt(o) }, w.variance = function(t, e, i) { var o = w.sma(t, e, i); return w.variance2(t, o, e) }, w.variance2 = function(t, e, i) { var o, n, r, s = 0; for (o = 0; o < i; o++) n = t.get(o), r = w.abs(n - e), s += r * r; return s / i }, w.percentrank = function(t, e) { var i, o, n, r; if (w.na(t.get(e - 1))) return NaN; for (i = 0, o = t.get(), n = 1; n < e; n++) r = t.get(n), w.ge(o, r) && i++; return 100 * i / e }, w.createNewSessionCheck = function(t) { var e = u.newBarBuilder(t.symbol.period, t.symbol.session); return function(t) { return e.indexOfBar(t) === S.POST_SESSION && (e.moveTo(t), !0) } }, s.LOW = 0, s.HIGH = 1, s.prototype.isPivotFound = function() { return -1 !== this._pivotIndex.get() }, s.prototype.pivotIndex = function() { return this._pivotIndex.get() }, s.prototype.currentValue = function() { return this._currentValue.get() }, s.prototype.pivotType = function() { return this._pivotType }, s.prototype.reset = function() { this._currentValue.set(NaN), this._currentIndex.set(0), this._pivotIndex.set(-1) }, s.prototype.isRightSideOk = function(t) { return t - this._currentIndex.get() === this._areaRight }, s.prototype.isViolate = function(t, e) { if (t < 1 || isNaN(this._currentValue.get())) return !0; var i = this._series.get(this._index - t); return !!isNaN(i) || (i === this._currentValue.get() ? e : this._pivotType === s .HIGH ? i > this._currentValue.get() : i < this._currentValue.get()) }, s.prototype.processPoint = function(t) { this.isViolate(t, !1) && (this._currentValue.set(this._series.get()), this ._currentIndex.set(t)) }, s.prototype.isRestartNeeded = function(t) { return t - this._currentIndex.get() > this._areaRight }, s.prototype.update = function() { var t, e; if (this._isNewBar && this.isPivotFound() && this.reset(), this.processPoint( this._index), this.isRightSideOk(this._index)) { if (-1 === this._pivotIndex.get()) { for (t = !0, e = 0; e < this._areaLeft; ++e) if (this.isViolate(this._currentIndex.get() - 1 - e, !0)) { t = !1; break } t && this._pivotIndex.set(this._currentIndex.get()) } } else -1 !== this._pivotIndex.get() && this._pivotIndex.set(-1); if (this.isRestartNeeded(this._index)) for (this.reset(), e = 0; e <= this._areaRight; ++e) this.processPoint(this ._index - this._areaRight + e) }, a.prototype.addPivot = function(t, e, i) { this._lastIndex.set(t), this._lastVal.set(e), this._lastType.set(i) }, a.prototype.updatePivot = function(t, e) { this._lastIndex.set(t), this._lastVal.set(e) }, a.prototype.lastPrice = function() { return this._lastVal.get() }, a.prototype.lastIndex = function() { return this._lastIndex.get() }, a.prototype.addPoint = function(t, e, i) { var o; return isNaN(this._lastVal.get()) ? void this.addPivot(t, e, i) : (o = this ._lastVal.get(), this._lastType.get() === i ? void((i === s.HIGH ? e > o : e < o) && this.updatePivot(t, e)) : void(Math.abs(o - e) / e > this._deviation && this.addPivot(t, e, i))) }, a.prototype.processPivot = function(t) { t.update(), this._isBarClosed && t.isPivotFound() && this.addPoint(t .pivotIndex(), t.currentValue(), t.pivotType()) }, w.zigzag = function(t, e, i) { return new a(t, e, i).lastPrice() }, w.zigzagbars = function(t, e, i) { var o = new a(t, e, i); return -1 === o.lastIndex() ? NaN : o.lastIndex() - w.n(i) }, l.prototype.new_sym = function(t, e, i, o) { return this.symbol.script.add_sym(t, e, i, void 0, o) }, l.prototype.select_sym = function(t) { this.symbol = this.symbol.script.get_sym(t) }, l.prototype.new_var = function(t) { var e, i = this.vars; return i.length <= this.vars_index && i.push(new c(this.symbol)), e = i[this .vars_index++], arguments.length > 0 && e.set(t), e }, l.prototype.new_ctx = function() { return this.ctx.length <= this.ctx_index && this.ctx.push(new l(this.symbol)), this.ctx[this.ctx_index++] }, l.prototype.prepare = function(t) { var e, i; for (this.ctx_index = 0, this.vars_index = 0, e = 0; e < this.vars.length; e++) this.vars[e].prepare(t); for (i = 0; i < this.ctx.length; i++) this.ctx[i].prepare(t) }, l.prototype.stop = function() { this.symbol = null, this.vars = null }, c.prototype.valueOf = function() { return this.get(0) }, c.prototype.get = function(t) { return isNaN(t) && (t = 0), t = t || 0, this.hist ? t >= this.hist.length ? ( console.error("not enough depth: " + this), NaN) : this._get(t) : (this .mindepth = w.max(this.mindepth, t), NaN) }, c.prototype._get = function(t) { var e = this.hist_pos - t; return e < 0 && (e += this.hist.length), this.hist[e] }, c.prototype.set = function(t) { this.hist && (this.hist[this.hist_pos] = t, this.modified = !0) }, c.prototype.prepare = function(t) { t === this.symbol && (t.isNewBar ? (this.original = this.get(0), !this .modified && this.hist || this.add_hist()) : this.set(this .original), this.modified = !1) }, c.prototype.add_hist = function() { var t, e, i; if (!this.hist) { for (t = w.na(this.mindepth) ? w.max_series_size : w.min(this.mindepth + 1, w.max_series_size), t = Math.round(t), e = Array(t), i = 0; i < t; i++) e[i] = NaN; this.hist = e, this.hist_pos = -1 } this.hist_pos = Math.min(this.hist_pos + 1, this.hist.length), this.hist_pos === this.hist.length && (this.hist_pos = this.hist.length - 1, this.hist .shift(), this.hist.push(NaN)), this.hist[this.hist_pos] = this.original }, c.prototype.adopt = function(t, e, i) { var o, n, r, s; return this.hist || (this.mindepth = NaN), o = e.get(), n = t.indexOf(o), 0 !== i && (r = e.get(1), w.na(r) || (s = t.indexOf(r), n = n === s ? -1 : n)), n < 0 ? NaN : this._get(n) }, c.prototype.indexOf = function(t) { var e, i, n, r; return this.hist ? w.na(t) ? -1 : (e = this.hist.length, i = this.symbol.index + 1, n = Math.min(e, i), r = o.upperbound_int(this.hist, t, 0, n), 0 === r ? -1 : n - r) : (this.mindepth = NaN, -1) }, u.parseTicker = function(t) { var e = t.indexOf(":"); return -1 === e ? t : t.substr(e + 1) }, u.parsePeriod = function(t) { var e, i, o, n, r, s, a, l; return t += "", e = t.slice(0), i = e.indexOf(",") >= 0, i && (n = e.split(","), o = u.parsePeriod(n[1]), e = n[0]), r = !1, s = !1, a = e[e.length - 1], -1 === "DWM".indexOf(a) && ("S" === a ? s = !0 : (r = !0, a = "")), l = parseInt(r ? e : e.length > 1 ? e.slice(0, e.length - 1) : 1), { resolution: a, interval: l, pureResolution: "" + l + a, isIntraday: r, isSeconds: s, range: o } }, u.newBarBuilder = function(t, e, i) { var o = u.parsePeriod(t); return S.newBarBuilder(o.resolution, o.interval, e, i) }, u.newSession = function(t, e) { var i = b.get_timezone(t); return (new S.Session).init(i, e) }, u.prototype.set_symbolinfo = function(t) { t || console.error("WARN: symbolinfo isn't defined for " + this.tickerid), this .info = t, this.timezone = b.get_timezone(t.timezone), this.session.init( this.timezone, t.session); for (var e in this.other_sessions) this.other_sessions.hasOwnProperty(e) && this .other_sessions[e].init(this.timezone, e) }, u.prototype.get_session = function(t) { if (!t) return this.session; var e = this.other_sessions[t]; return e || (e = new S.Session, this.other_sessions[t] = e), e }, u.prototype.isdwm = function() { return "" !== this.resolution && "S" !== this.resolution }, u.prototype.enable_dwm_aligning = function(t, e) { this.dwm_aligner = u.newBarBuilder(this.period, t, e) }, u.prototype.bartime = function(t, e) { var i, o, n, r, s = this.time; return t && (i = t, e && (i += e), o = this.bb_cache[i], o || (n = this .get_session(e), o = u.newBarBuilder(t, n), this.bb_cache[i] = o), s = o.alignTime(s)), !this.isdwm() || isNaN(s) ? s : (r = b.utc_to_cal( this.timezone, s), this.session.spec.correctTradingDay(r, this .timezone), b.cal_to_utc(this.timezone, r)) }, u.prototype.lastbar = function(t) { var e, i; isNaN(t.time) || (e = t.time, this.dwm_aligner && (this.dwm_aligner.moveTo(e), e = this.dwm_aligner.startOfBar(0)), i = this.time !== e, i && this .index >= 0 && !this.isBarClosed && (this.isNewBar = !1, this .isBarClosed = !0, this.script.calc(this)), this.time = e, this .open = t.open, this.high = t.high, this.low = t.low, this.close = t .close, this.volume = t.volume, this.updatetime = t.updatetime, this .isNewBar = i, this.isBarClosed = t.isBarClosed, this.isLastBar = t .isLastBar, this.isNewBar && this.index++, this.script.calc(this)) }, d.prototype.calc = function(t) { var e, i, o = this.ctx, n = this.body; o.prepare(t), e = n.main(o, this.inputCallback), i = this, this.out && e && (! isNaN(o.symbol.time) || e.nonseries) && (e.nonseries ? ("projection" === e.type && (e.projectionTime = o.symbol.time), this.nonseriesOut(o .symbol, e)) : e.bars ? e.bars.forEach(function(t) { i.out(o.symbol, t) }) : this.out(o.symbol, e)) }, d.prototype.init = function() { var t = this.ctx, e = this.body; e.init && e.init(t, this.inputCallback), e.main(t, this.inputCallback) }, d.prototype.add_sym = function(t, e, i, o, n) { var r = this.runner.add_sym(t, e, i, this, o, n); return this.symbols.push(r), r.isdwm() && this.symbols.length > 1 && r .enable_dwm_aligning(this.symbols[0].session, r.session), r }, d.prototype.stop = function() { this.symbols = null, this.ctx.stop(), this.ctx = null }, d.prototype.get_sym = function(t) { return this.symbols[t] }, p.prototype.add_sym = function(t, e, i, o, n, r) { var s = new u(t, e, i, o, n, r); return this.symbols.push(s), s }, p.prototype.get_sym = function(t) { return this.symbols[t] }, p.prototype.out = function(t, e) { if (this.nonseriesUpdate) { var i = $.extend({}, this.nonseriesUpdate); e.splice(0, 0, t.time), i.lastBar = e, this.host.nonseriesOut(t, i) } else this.host.out(t, e) }, p.prototype.start = function() { function t(t, o) { var n = p.feed.subscribe(t.tickerid, t.period, t.periodBase, t .periodForInitialRange, function(i) { "series" == (i.nonseries ? "nonseries" : "series") ? e.update(o, i): i.lastBar ? (e.nonseriesUpdate = i, i.lastBar .isLastBar = !0, e.symbols[0].lastbar(i.lastBar), e .nonseriesUpdate = null) : r.nonseriesOut(t, i) }, r.onErrorCallback, r.symbolInfo, r.sessionId, r.rangeExtension); i.push(n) } var e, i, o, n, r = this.host; for (this._script = new d(r.tickerid, r.period, r.periodBase || r.period, this, r.body, this.out.bind(this), r.input, r.symbolInfo.minmov / r.symbolInfo .pricescale, r.nonseriesOut), e = this, i = [], o = this.symbols, n = 0; n < o.length; n++) t(o[n], n); this.subscription = i }, p.prototype.stop = function() { var t, e = this.subscription; if (!e && !this._script) return void console.warn( "Recurring script engine stop happened."); for (t = 0; t < e.length; t++) p.feed.unsubscribe(e[t]); this.subscription = null, this._script.stop(), this._script = null, this .symbols = null }, p.prototype.update = function(t, e) { var i, o; if (!e) return void console.error("Unexpected barset = null"); i = this.symbols[t], this.isRecalculated ? (o = e.bar(e.count() - 1), o .isBarClosed = e.isLastBarClosed(), o.isLastBar = !0, i.lastbar(o)) : this.barsets[t] || (this.barsets[t] = e, i.set_symbolinfo(e.symbolinfo()), this.recalc()) }, p.prototype.recalc = function() { var t, e, i, o, n, r, s, a = this.symbols; for (t = 0; t < a.length; t++) if (!this.barsets[t]) return; for (e = a.length - 1; e >= 0; e--) for (i = a[e], o = this.barsets[e], n = o.count(), r = 0; r < n; r++) s = o .bar(r), s.isLastBar = r === n - 1, s.isBarClosed = !s.isLastBar || o .isLastBarClosed(), i.lastbar(s); this.isRecalculated = !0, this.barsets[0] && this.barsets[0].endOfData && this .host.setNoMoreData(), this.host.recalc(this, { endOfData: this.barsets[0].endOfData, nextTime: this.barsets[0].nextTime }) }, p.feed = { subscribe: function(t, e, i, o) { console.error("must be initialized with setupFeed") }, unsubscribe: function(t) { console.error("must be initialized with setupFeed") } }, f.prototype.stop = function() { this.runner.stop() }, m.prototype.symbolinfo = function() { return this.info }, m.prototype.isLastBarClosed = function() { return this.isBarClosed }, m.prototype.setLastBarClosed = function(t) { this.isBarClosed = t }, m.prototype.bar = function(t) { return this.bars[t] }, m.prototype.count = function() { return this.bars.length }, m.prototype.add = function(t, e) { var i = t, o = this.bars, n = o.length, r = i.time, s = 0 === n ? NaN : o[n - 1].time; 0 === n || s < r ? o.push(i) : s === r ? o[n - 1] = i : console.error( "time order violation, prev: " + new Date(s).toUTCString() + ", cur: " + new Date(r).toUTCString()), this.isBarClosed = !!e }, g.prototype.init = function(t) { this.bb = u.newBarBuilder(this.period, t.symbol.session), this.bbEmptyBars = this.generateEmptyBars ? u.newBarBuilder(this.period, t.symbol.session) : void 0 }, g.prototype.extrapolate = function(t, e) { return isNaN(t) || isNaN(e) ? void 0 : S.extrapolateBarsFrontToTime(this .bbEmptyBars, t, e) }, g.prototype.main = function(t) { var e = t.symbol.time, i = this.bb.alignTime(e), o = t.new_var(i), n = w.na(i), r = o.get(1), s = w.na(r) ? 1 : w.neq(i, r), a = t.new_var(), l = t.new_var(), c = t.new_var(), h = t.new_var(), u = a.get(1), d = l.get(1), p = c.get(1), _ = h.get(1), f = n ? NaN : s ? w.open(t) : u, m = n ? NaN : s ? w.high(t) : w.max(w.high(t), d), g = n ? NaN : s ? w.low(t) : w.min(w.low(t), p), v = n ? NaN : w.close(t), y = n ? NaN : s ? w.volume(t) : w.volume(t) + _, b = n ? NaN : e, S = t.symbol.isBarClosed && this.bb.isLastBar(0, e), T = this.generateEmptyBars && s ? this.extrapolate(r, i) : void 0, C = t.new_var(w.close(t)), x = C.get(1), P = T instanceof Array ? x : NaN; return a.set(f), l.set(m), c.set(g), h.set(y), [i, f, m, g, v, y, b, S, T, P] }, v.prototype.main = function(t) { return [w.open(t), w.high(t), w.low(t), w.close(t), w.volume(t), w.updatetime( t)] }, { Std: w, Series: c, Symbol: u, SymbolInfo: h, StudyEngine: f, BarSet: m, OHLCV: v, BarBuilder: g, setupFeed: _ } }(); t.exports = r }).call(e, i(78)) }, function(t, e, i) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }), e.STATUS_OFFLINE = 0, e.STATUS_RESOLVING = 1, e.STATUS_LOADING = 2, e.STATUS_READY = 3, e .STATUS_INVALID_SYMBOL = 4, e.STATUS_SNAPSHOT = 5, e.STATUS_EOD = 6, e.STATUS_PULSE = 7, e .STATUS_DELAYED = 8, e.STATUS_DELAYED_STREAMING = 9, e.STATUS_NO_BARS = 10, e.STATUS_REPLAY = 11, e .STYLE_BARS = 0, e.STYLE_CANDLES = 1, e.STYLE_LINE = 2, e.STYLE_LINE_TYPE_MARKERS = 0, e .STYLE_LINE_TYPE_STEP = 1, e.STYLE_LINE_TYPE_SIMPLE = 2, e.STYLE_AREA = 3, e.STYLE_RENKO = 4, e .STYLE_KAGI = 5, e.STYLE_PNF = 6, e.STYLE_PB = 7, e.STYLE_HEIKEN_ASHI = 8, e.STYLE_HOLLOW_CANDLES = 9, e.STYLE_BASELINE = 10, e.STYLE_SHORT_NAMES = {}, e.STYLE_SHORT_NAMES[e.STYLE_BARS] = "bar", e .STYLE_SHORT_NAMES[e.STYLE_CANDLES] = "candle", e.STYLE_SHORT_NAMES[e.STYLE_HOLLOW_CANDLES] = "hollowCandle", e.STYLE_SHORT_NAMES[e.STYLE_LINE] = "line", e.STYLE_SHORT_NAMES[e.STYLE_AREA] = "area", e.STYLE_SHORT_NAMES[e.STYLE_RENKO] = "renko", e.STYLE_SHORT_NAMES[e.STYLE_PB] = "pb", e .STYLE_SHORT_NAMES[e.STYLE_KAGI] = "kagi", e.STYLE_SHORT_NAMES[e.STYLE_PNF] = "pnf", e .STYLE_SHORT_NAMES[e.STYLE_HEIKEN_ASHI] = "ha", e.STYLE_SHORT_NAMES[e.STYLE_BASELINE] = "baseline", e.SYMBOL_STRING_DATA = {}, e.SYMBOL_STRING_DATA[e.STYLE_RENKO] = { type: "BarSetRenko@tv-prostudies" }, e.SYMBOL_STRING_DATA[e.STYLE_PB] = { type: "BarSetPriceBreak@tv-prostudies" }, e.SYMBOL_STRING_DATA[e.STYLE_KAGI] = { type: "BarSetKagi@tv-prostudies" }, e.SYMBOL_STRING_DATA[e.STYLE_PNF] = { type: "BarSetPnF@tv-prostudies" }, e.SYMBOL_STRING_DATA[e.STYLE_HEIKEN_ASHI] = { type: "BarSetHeikenAshi@tv-basicstudies" } }, function(t, e, i) { "use strict"; function o(t) { var e, i, o, n, r, s; if ("Asia/Bahrain" === t && (t = "Asia/Kuwait"), this._name = t, e = u[t], e || (e = { time: [], offset: [] }, this._invalid = !0), e.time.length !== e.offset.length && (e = { time: [], offset: [] }, this._invalid = !0), !e.time_utc) { for (i = e.time, o = e.offset, n = i.length, r = Array(n), s = 0; s < n; s++) i[s] *= 1e3, o[ s] *= 1e3, r[s] = i[s] - o[s]; e.time_utc = r } this.tz = e } function n(t, e) { var i, o, n, s = t.length; if (0 === s) return -1; if (isNaN(e)) throw Error("Key is NaN"); for (i = 0, o = s - 1, n = r((i + o) / 2);;) { if (t[n] > e) { if ((o = n - 1) < i) return n } else if (i = n + 1, o < i) return n < s - 1 ? n + 1 : -1; n = r((i + o) / 2) } } var r, s, a, l, c, h, u = i(806).tzData; o.prototype.offset_utc = function(t) { return o._offset(this.tz.time_utc, this.tz.offset, t) }, o.prototype.offset_loc = function(t) { return o._offset(this.tz.time, this.tz.offset, t) }, o.prototype.is_valid = function() { return !this._invalid }, o._offset = function(t, e, i) { var o = n(t, i); return -1 === o ? 0 : e[o] }, r = function(t) { return 0 | t }, s = function(t) { return 60 * t * 1e3 }, a = function(t) { return 1e3 * t }, l = function(t, e) { return r((r(t / 1e3) - r(e / 1e3)) / 60) }, c = function(t, e) { return r(r(t / 1e3) - r(e / 1e3)) }, h = { SUNDAY: 1, MONDAY: 2, TUESDAY: 3, WEDNESDAY: 4, THURSDAY: 5, FRIDAY: 6, SATURDAY: 7, JANUARY: 0, DECEMBER: 11, YEAR: 1, MONTH: 2, WEEK_OF_YEAR: 3, DAY_OF_MONTH: 5, DAY_OF_YEAR: 6, DAY_OF_WEEK: 7, HOUR_OF_DAY: 11, MINUTE: 12, SECOND: 13, minutesPerDay: 1440, secondsPerDay: s(1440), get_minutes_from_hhmm: function(t) { return -1 !== t.indexOf(":") && (t = t.split(":").join("")), t % 100 + 60 * r(t / 100) }, get_year: function(t) { return t.getUTCFullYear() }, get_month: function(t) { return t.getUTCMonth() }, get_hours: function(t) { return t.getUTCHours() }, get_minutes: function(t) { return t.getUTCMinutes() }, get_seconds: function(t) { return t.getUTCSeconds() }, get_day_of_month: function(t) { return t.getUTCDate() }, get_day_of_week: function(t) { return t.getUTCDay() + 1 }, get_day_of_year: function(t) { var e = Date.UTC(t.getUTCFullYear(), 0, 1, 0, 0, 0, 0); return r((t.getTime() - e) / h.secondsPerDay) + 1 }, get_week_of_year: function(t) { var e = Date.UTC(t.getUTCFullYear(), 0, 1, 0, 0, 0, 0), i = h.clone(t); return h.set_hms(i, 0, 0, 0, 0), i.setUTCDate(i.getUTCDate() + 4 - (i.getUTCDay() || 7)), r(((i.getTime() - e) / h.secondsPerDay + 1) / 7) }, get_minutes_from_midnight: function(t) { return 60 * h.get_hours(t) + h.get_minutes(t) }, set_hms: function(t, e, i, o, n) { t.setUTCHours(e), t.setUTCMinutes(i), t.setUTCSeconds(o), t.setUTCMilliseconds(n) }, add_days_considering_dst: function(t, e, i) { var o, n = t.offset_utc(e), r = this.clone(e); return this.add_date(r, i), o = t.offset_utc(r), r.setTime(r.getTime() + n - o), r }, add_date: function(t, e) { t.setTime(t.getTime() + e * h.secondsPerDay) }, clone: function(t) { return new Date(t.getTime()) }, get_days_per_year: function(t) { var e = t.getUTCFullYear(); return this.days_per_year(e) }, days_per_year: function(t) { return t % 4 != 0 || t % 100 == 0 && t % 400 != 0 ? 365 : 366 }, get_part: function(t, e) { switch (e) { case h.YEAR: return h.get_year(t); case h.MONTH: return h.get_month(t); case h.DAY_OF_MONTH: return h.get_day_of_month(t); case h.WEEK_OF_YEAR: return h.get_week_of_year(t); case h.DAY_OF_WEEK: return h.get_day_of_week(t); case h.HOUR_OF_DAY: return h.get_hours(t); case h.MINUTE: return h.get_minutes(t); case h.DAY_OF_YEAR: return h.get_day_of_year(t); case h.SECOND: return h.get_seconds(t); default: return t.getTime() } }, time_minutes: s, time_seconds: a, time_minutes_diff: l, time_seconds_diff: c, utc_to_cal: function(t, e) { var i = t.offset_utc(e); return new Date(e + i) }, get_cal: function(t, e, i, o) { var n = new Date(Date.UTC(e, i, o)), r = t.offset_utc(+n); return new Date(n.valueOf() - r) }, get_cal_utc: function(t, e, i) { return new Date(Date.UTC(t, e, i)) }, cal_to_utc: function(t, e) { var i = e.getTime(); return i - t.offset_loc(i) }, get_timezone: function(t) { return new o(t) }, shift_day: function(t, e) { var i = t - 1; return i += e, i > 6 ? i %= 7 : i < 0 && (i = (7 + i % 7) % 7), i + 1 } }, t.exports = h }, , function(t, e, i) { "use strict"; (function(t) { function o(e) { e || (e = {}), this.checkable = e.checkable || !1, this.checked = e.checked || null, this .enabled = void 0 === e.enabled || e.enabled, this.visible = e.visible || !0, this .active = !0, this.font = e.font || "Arial", this.icon = e.icon || null, this.iconText = e.iconText || null, this.iconVisibleInMenu = e.iconVisibleMenu || !0, this .deleteButton = e.deleteButton || null, this.shortcut = null, this.setShortCut(e .shortcut, e.doNotBindShortcut), this.statusTip = e.statusTip || null, this.text = e .text || null, this.toolTip = e.toolTip || null, this.htmlclass = e.htmlclass || null, this.statName = e.statName || null, this._callbackContext = e.callbackContext || this, this._callbacks = new t, this.subActions = e.subActions || [] } function n() { o.call(this), this.font = null, this.subActions = null, this.htmlclass = "action-separator" } function r(t) { o.call(this), this.deferred = t } var s = i(147); o.prototype.callbacks = function() { return this._callbacks }, o.prototype.callbackContext = function() { return this._callbackContext }, o.prototype.setCallbackContext = function(t) { this._callbackContext = t }, o.prototype.hasSubActions = function() { return this.subActions && this.subActions.length }, o.prototype.setChecked = function(t) { this.checked = t }, o.prototype._toggleChecked = function() { this.checked = !this.checked }, o.prototype.setVisible = function(t) { this.visible = t }, o.prototype.setEnabled = function(t) { this.enabled = t }, o.prototype.disable = function() { this.setEnabled(!1) }, o.prototype.enable = function() { this.setEnabled(!0) }, o.prototype.setActive = function(t) { this.active !== t && (this.active = t, this.shortcut && !this.doNotBindShortcut && (t ? this._bindShortCut() : this._unbindShortCut())) }, o.prototype.setShortCut = function(t, e) { t && (this.shortcut = t, !0 !== e && this._bindShortCut()) }, o.prototype._bindShortCut = function() { s.bind(this.shortcut, function(t) { if (t.preventDefault(), this.enabled) return this.executeCallback(), !1 }.bind(this)) }, o.prototype._unbindShortCut = function() { s.unbind(this.shortcut) }, o.prototype.setIconVisible = function(t) { this.iconVisibleInMenu = t }, o.prototype.executeCallback = function(t) { this._lastEvent = t, this._toggleChecked(), this._callbacks.fire(this) }, inherit(n, o), inherit(r, o), e.Action = o, e.ActionSeparator = n, e.ActionPlaceholder = r }).call(e, i(10)) }, function(t, e, i) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var o = function() { function t() { this._renderers = [], this._globalAlpha = 1 } return t.prototype.setGlobalAlpha = function(t) { this._globalAlpha = t }, t.prototype.append = function(t) { this._renderers.push(t) }, t.prototype.insert = function(t, e) { this._renderers.splice(e, 0, t) }, t.prototype.draw = function(t) { for (var e = 0; e < this._renderers.length; e++) t.save(), t.globalAlpha = this ._globalAlpha, this._renderers[e].draw(t), t.restore() }, t.prototype.drawBackground = function(t) { var e, i; for (t.save(), t.globalAlpha = this._globalAlpha, e = 0; e < this._renderers .length; e++) i = this._renderers[e], i.drawBackground && i.drawBackground(t); t.restore() }, t.prototype.hitTest = function(t) { var e, i, o = null; for (e = this._renderers.length - 1; e >= 0; e--) null !== (i = this._renderers[e] .hitTest(t)) && (null === o || i.result() > o.result()) && (o = i); return o }, t }(); e.CompositeRenderer = o }, function(t, e, i) { "use strict"; function o(t, e) { return t <= e } function n(t, e) { return t >= e } function r(t, e, i) { return Math.min(Math.max(t, e), i) } function s(t) { return t < 0 ? -1 : t > 0 ? 1 : 0 } function a(t) { if (t < 0) return f.logDebug("MathEx.isBaseDecimal: argument less zero"), !1; for (var e = t; e > 1; e /= 10) if (e % 10 != 0) return !1; return !0 } function l(t, e, i) { return e - t <= i } function c(t, e, i) { return Math.abs(t - e) < i } function h(t) { return t <= 0 ? (f.logDebug("MathEx.log10: argument less or equal zero"), NaN) : Math.log(t) / Math .log(10) } function u(t, e) { return t < e ? -1 : t > e ? 1 : 0 } function d(t, e) { var i, o; if (void 0 === e && (e = u), t.length < 1) throw Error("array is empty"); for (i = t[0], o = 0; o < t.length; ++o) e(t[o], i) < 0 && (i = t[o]); return i } function p(t, e) { var i, o; if (void 0 === e && (e = u), t.length < 1) throw Error("array is empty"); for (i = t[0], o = 0; o < t.length; ++o) e(t[o], i) > 0 && (i = t[o]); return i } var _, f; Object.defineProperty(e, "__esModule", { value: !0 }), _ = i(7), f = _.getLogger("Common.MathEx"), e.lessThan = o, e.greaterThan = n, e.clamp = r, e .sign = s, e.isBaseDecimal = a, e.greaterOrEqual = l, e.equal = c, e.log10 = h, e.defComparator = u, e.min = d, e.max = p }, , function(t, e, i) { "use strict"; function o(t) { this.items = t.items, this.height = t.height || t.width, this.width = t.width || t.height, this ._color = t.color, this._borderColor = t.borderColor, this._vertOffset = t.vertOffset || 0, t .textCache && (this._textCache = t.textCache, this._textColor = t.textColor, this ._textVertOffset = this._vertOffset > 0 ? this.height : -this.height, this._textImageWidth = this._textCache.textImageWidth, this._textImageHeight = this._textCache.textImageHeight) } var n = i(8).Point, r = i(11); o.prototype.draw = function(t) { this.drawShape(t), this.drawText(t) }, o.prototype.drawShape = function(t) { throw Error("Not implemented") }, o.prototype.drawText = function(t) { var e, i, o, n, r, s; if (this._textCache) for (e = 0, i = this.items.length; e < i; e++) o = this.items[e], n = o.x, r = o.y + this ._vertOffset + this._textVertOffset, s = o.style && null != o.style.textColor ? o.style .textColor : this._textColor, this._textCache.paintTo(t, s, n, r, "center", this ._vertOffset > 0 ? "top" : "bottom") }, o.prototype.hitTest = function(t, e) { var i, o, s, a, l, c, h, u, d, p, _, f, m, g = Math.max(this.height, this.width), v = this._vertOffset, y = this._textVertOffset; for (e = e || r.REGULAR, o = 0; o < this.items.length; ++o) if (s = this.items[o]) { if (i = new n(s.x, s.y + v), i.subtract(t).length() <= g) return new r(e, {}); if (this._textCache && (a = this._textImageWidth / 2, l = s.y + v + y, c = v > 0 ? 0 : - this._textImageHeight, h = v > 0 ? this._textImageHeight : 0, u = t.x, d = t.y, p = s.x - a, _ = l + c, f = s.x + a, m = l + h, u > p && u < f && d > _ && d < m )) return new r(e, {}) } return null }, e.PaneRendererAbstractShape = TradingView.PaneRendererAbstractShape = o }, function(t, e, i) { "use strict"; for (var o = { LineToolFibRetracement: i(808).LineToolFibRetracement, LineToolFibChannel: i(811).LineToolFibChannel, LineToolFibSpeedResistanceArcs: i(812).LineToolFibSpeedResistanceArcs, LineToolProjection: i(813).LineToolProjection, LineToolTrendBasedFibExtension: i(814).LineToolTrendBasedFibExtension, LineToolElliott: i(104).LineToolElliott, LineToolFibCircles: i(815).LineToolFibCircles, LineToolTrading: i(224), LineStudyMtp: i(105).LineStudyMtp, LineToolVertLine: i(816).LineToolVertLine, LineToolBarsPattern: i(818).LineToolBarsPattern, LineToolTrendBasedFibTime: i(819).LineToolTrendBasedFibTime, LineToolFibTimeZone: i(820).LineToolFibTimeZone, LineToolCircleLines: i(821).LineToolCircleLines, LineToolDateRange: i(822).LineToolDateRange, LineToolPriceRange: i(823).LineToolPriceRange, LineToolDateAndPriceRange: i(824).LineToolDateAndPriceRange, LineToolParallelChannel: i(825).LineToolParallelChannel, LineToolTrendAngle: i(826).LineToolTrendAngle, LineToolTrendLine: i(159).LineToolTrendLine, LineToolArrowMark: i(129).LineToolArrowMark, LineToolExecution: i(334).LineToolExecution, LineToolPitchfan: i(827).LineToolPitchfan, LineToolGannSquare: i(828).LineToolGannSquare, LineToolFibSpeedResistanceFan: i(829).LineToolFibSpeedResistanceFan, LineToolGannComplex: i(830).LineToolGannComplex, LineToolGannFixed: i(831).LineToolGannFixed, LineToolGannFan: i(832).LineToolGannFan, LineToolFibWedge: i(333).LineToolFibWedge, LineToolPitchfork: i(161).LineToolPitchfork, LineToolDisjointAngle: i(833).LineToolDisjointAngle, LineToolFlatBottom: i(834).LineToolFlatBottom, LineToolIcon: i(835).LineToolIcon, LineToolRotatedRectangle: i(836).LineToolRotatedRectangle, LineToolFibSpiral: i(837).LineToolFibSpiral, LineToolHeadAndShoulders: i(838).LineToolHeadAndShoulders, LineToolTriangle: i(839).LineToolTriangle, LineToolTrianglePattern: i(840).LineToolTrianglePattern, LineTool5PointsPattern: i(336).LineTool5PointsPattern, LineToolThreeDrivers: i(841).LineToolThreeDrivers, LineToolABCD: i(842).LineToolABCD, LineToolRiskReward: i(225).LineToolRiskReward, LineToolPolyline: i(844).LineToolPolyline, LineToolPrediction: i(845).LineToolPrediction, LineToolPriceLabel: i(846).LineToolPriceLabel, LineToolNote: i(337).LineToolNote, LineToolNoteAbsolute: i(337).LineToolNoteAbsolute, LineToolBrush: i(847).LineToolBrush, LineToolArc: i(848).LineToolArc, LineToolCallout: i(849).LineToolCallout, LineToolBalloon: i(850).LineToolBalloon, LineToolText: i(338).LineToolText, LineToolHorzLine: i(851).LineToolHorzLine, LineToolHorzRay: i(852).LineToolHorzRay, LineToolRectangle: i(853).LineToolRectangle, LineToolEllipse: i(854).LineToolEllipse, LineToolTimeCycles: i(855).LineToolTimeCycles, LineToolSineLine: i(856).LineToolSineLine, LineToolGhostFeed: i(857).LineToolGhostFeed, LineToolBezierQuadro: i(858).LineToolBezierQuadro, LineToolBezierCubic: i(859).LineToolBezierCubic, LineToolArrow: i(860).LineToolArrow, LineToolRay: i(861).LineToolRay, LineToolExtended: i(862).LineToolExtended, LineToolSchiffPitchfork: i(863).LineToolSchiffPitchfork, LineToolSchiffPitchfork2: i(864).LineToolSchiffPitchfork2, LineToolInsidePitchfork: i(865).LineToolInsidePitchfork, LineToolTextAbsolute: i(338).LineToolTextAbsolute, LineToolArrowMarkLeft: i(129).LineToolArrowMarkLeft, LineToolArrowMarkRight: i(129).LineToolArrowMarkRight, LineToolArrowMarkUp: i(129).LineToolArrowMarkUp, LineToolArrowMarkDown: i(129).LineToolArrowMarkDown, LineToolFlagMark: i(866).LineToolFlagMark, LineToolCypherPattern: i(867).LineToolCypherPattern, LineToolElliottImpulse: i(104).LineToolElliottImpulse, LineToolElliottTriangle: i(104).LineToolElliottTriangle, LineToolElliottTripleCombo: i(104).LineToolElliottTripleCombo, LineToolElliottCorrection: i(104).LineToolElliottCorrection, LineToolElliottDoubleCombo: i(104).LineToolElliottDoubleCombo, LineToolRiskRewardLong: i(225).LineToolRiskRewardLong, LineToolRiskRewardShort: i(225).LineToolRiskRewardShort, LineToolPosition: i(868).LineToolPosition, LineToolOrder: i(869).LineToolOrder }, n = Object.keys(o), r = n.length; r--;) TradingView[n[r]] = o[n[r]]; t.exports = o }, function(t, e, i) { "use strict"; (function(e) { var o = i(411).ExchangeSession, n = function() { function t(t, e, i, o) { return "" === t ? new h(60 * e, i) : "S" === t ? new h(e, i) : new u(i, o, e, n(t, i)) } function n(t, e) { switch (t) { case "D": return new S(e); case "W": return new w(e); case "M": return new T(e) } return console.error("unknown dwm resolution: " + t), null } function r(t, e, i, o, n) { var r, s, a, l, c, h, u, d = (new x).init("Etc/UTC", t), p = "" !== e; return p ? (s = i * E[e], r = E.D) : (s = 60 * i * 1e3, r = 60 * d.spec .findSessionEntry(0, 0).length() * 1e3), a = r / s, l = p ? 7 : 7 - d.spec .weekEndsCount(), c = l * a, o < c ? (h = o / a, n - h * E.D) : (u = o / c, n - u * E.W) } function s(t, e, i, o) { if ("number" != typeof i || "number" != typeof e || isNaN(i) || isNaN(e)) throw Error("Cannot extrapolate from " + e + " to " + i); return l(t, e, function(t, e) { return e > i || o && t.length > o }) } function a(t, e, i) { return l(t, e, function(t, e) { return t.length >= i }) } function l(t, e, i) { var o, n, r, s, a, l = e; for (t.moveTo(l), o = [], n = 0, r = 0; !i(o, l);) { if (n > 5) throw console.trace(["0x10", new Date(e), "->", new Date(l)]), Error( "Internal error 0x10 while extrapolating."); if ((s = t.indexOfBar(l)) === I) l = t.startOfBar(0); else if (s === k) l = t.startOfBar(k); else { if ((a = t.startOfBar(s)) !== e) { if (r && r === a) throw console.trace(["0x11", new Date(e), "->", new Date(a) ]), Error("Internal error 0x11 while extrapolating."); r = a, n = 0, o.push(a) } l = t.startOfBar(s + 1) } t.moveTo(l), n++ } return o } function c(t) { if (isNaN(t)) return NaN; var e = this.indexOfBar(t); return e === k && (this.moveTo(t), e = this.indexOfBar(t)), e < 0 ? NaN : this .startOfBar(e) } function h(t, e) { this.period = t, this.session = e, this.sessionStart = Number.MIN_VALUE, this .sessionEnd = Number.MIN_VALUE } function u(t, e, i, o) { this.period = i, this.sessionTgt = t, this.sessionSrc = e || t, this.builder = o, this.periodStart = -Number.MAX_VALUE, this.periodEnd = -Number.MAX_VALUE, this .periodLastBarStart = -Number.MAX_VALUE } function d(t, e, i) { var o = M.clone(i); return e.alignToSessionStart(o, t), M.cal_to_utc(t, o) } function p(t, e) { var i = M.get_day_of_week(e) - t.firstDayOfWeek(); return i < 0 ? i + 7 : i } function _(t, e) { var i = e + t.firstDayOfWeek(); return i > M.SATURDAY ? i - M.SATURDAY : i } function f(t, e) { var i = M.get_day_of_year(e) - 1, o = p(t, e) - i % 7; return 0 === o ? C(i / 7) : (o >= 0 && (o -= 7), C((o + i) / 7)) } function m(t, e, i) { var o, n = 0; for (o = e; o < i; ++o) n += t.isWeekEnd(_(t, o)) ? 1 : 0; return n } function g(t, e) { var i = new Date(Date.UTC(e, 11, 31, 23, 59)), o = M.days_per_year(e) - v(t, i); return t.isWeekEnd(M.get_day_of_week(i)) && o--, o } function v(t, e) { var i, o, n = M.get_day_of_year(e) - 1, r = p(t, e), s = r - n % 7; return s < 0 && (s += 7), i = 0, n < 7 - s ? i += m(t, s, r) : (o = 0 === s ? 0 : m( t, s, 7), i += m(t, 0, r) + o), i + f(t, e) * t.weekEndsCount() } function y() {} function b(t) { this.sessionsSpec = t } function S(t) { this.session = t } function w(t) { this.session = t } function T(t) { this.session = t } function C(t) { return 0 | t } function x() {} function P(t, e, i) { var o, n, r, s, a = t.length; if (0 === a) return -1; for (o = 0, n = a - 1, r = C((o + n) / 2);;) { if (0 === (s = i(t[r], e)) || s > 0) { if ((n = r - 1) < o) return r } else if (o = r + 1, n < o) return r < a - 1 ? r + 1 : -1; r = C((o + n) / 2) } } function L(t, e) { var i = M.utc_to_cal(e.timezone, +t), o = M.get_day_of_week(i), n = M.get_minutes_from_midnight(i), r = e.spec.findSessionEntry(o, n); return r.isOvernight() && n > r.start() + r.length() && o === r.dayOfWeek() - 1 && ( o++, n -= 1440), o === r.dayOfWeek() && n >= r.start() && n < r.start() + r .length() } var I = -1, k = -2, A = "undefined" != typeof window ? window : e, M = A.PineJsCalendar ? A.PineJsCalendar : i(50), E = { S: 1e3, D: 864e5, W: 6048e5, M: 2592e6 }; return h.prototype.alignTime = c, h.prototype.alignTimeIfPossible = function(t) { var e = this.alignTime(t); return isNaN(e) ? t : e }, h.prototype.indexOfBar = function(t) { return t < this.sessionStart ? I : t >= this.sessionEnd ? k : C(M .time_seconds_diff(t, this.sessionStart) / this.period) }, h.prototype.startOfBar = function(t) { if (t === k) return this.sessionEnd; if (t < 0) throw Error("Negative offset is not supported"); return this.sessionStart + M.time_seconds(this.period * t) }, h.prototype.isLastBar = function(t, e) { return e >= this.sessionStart + M.time_seconds(this.period * (t + 1) - 1) }, h.prototype.moveTo = function(t) { var e = this.session.timezone, i = M.utc_to_cal(e, t), o = this.session.spec, n = o.alignToSessionStart(i, this.session.timezone); this.sessionStart = M.cal_to_utc(e, i), this.sessionEnd = this.sessionStart + M .time_minutes(n) }, u.prototype.alignTime = c, u.prototype.alignTimeIfPossible = function(t) { return this.tradingDayToSessionStart(t) }, u.prototype.tradingDayToSessionStart = function(t) { return this.moveTo(t), this.startOfBar(0) }, u.prototype.indexOfBar = function(t) { return t < this.periodStart ? I : t >= this.periodEnd ? k : 0 }, u.prototype.startOfBar = function(t) { if (t === k || t > 0) return this.periodEnd; if (t === I) throw Error("PRE_SESSION is not supported"); return this.periodStart }, u.prototype.isLastBar = function(t, e) { return e >= this.periodLastBarStart }, u.prototype.moveTo = function(t) { var e, i, o, n, r, s, a, l, c = M.utc_to_cal(this.sessionSrc.timezone, t); c = this.sessionSrc.spec.correctTradingDay(c, this.sessionSrc.timezone), e = this.sessionTgt.timezone, i = this.builder.indexOfPeriod(c, e), o = C(i / this.period) * this.period, n = M.get_year(c), r = this.sessionTgt.spec, s = this.builder.startOfPeriod(e, o, n), this.periodStart = d(e, r, s), a = o + this.period, l = this.builder.startOfPeriod(e, a, n), this.periodEnd = d(e, r, l), M.add_date(l, -1), this.moveToPrevWorkDay(r, l), this .periodLastBarStart = d(e, r, l), (this.periodLastBarStart < this .periodStart || this.periodLastBarStart === this.periodEnd) && (this .periodLastBarStart = this.periodStart) }, u.prototype.moveToPrevWorkDay = function(t, e) { for (; t.isWeekEnd(M.get_day_of_week(e));) M.add_date(e, -1) }, y.prototype.indexOfPeriod = function(t) { return M.get_day_of_year(t) - 1 }, y.prototype.startOfPeriod = function(t, e, i) { var o = M.get_cal(t, i, M.JANUARY, 1), n = M.add_days_considering_dst(t, o, e); return M.utc_to_cal(t, +n) }, b.prototype.uber = new y, b.prototype.indexOfPeriod = function(t) { return this.uber.indexOfPeriod(t) - v(this.sessionsSpec, t) }, b.prototype.startOfPeriod = function(t, e, i) { function o(t, e) { this.weekEnds = m(t, e, 7), this.calendarDays = 7 - e, this.businessDays = this.calendarDays - this.weekEnds } function n(t, e) { var i, o = 0; for (i = t; i < 7 && (s.sessionsSpec.isWeekEnd(_(s.sessionsSpec, i)) || !(-- e < 0)); ++i) o++; return o } function r(t, e, i) { var o, n, r, a, l, c, h = 0, u = i % (7 - s.sessionsSpec.weekEndsCount()); for (o = 0, n = u - (0 === t ? 0 : e.businessDays); o < 7 && n > 0; ++o) r = s.sessionsSpec.isWeekEnd(_(s.sessionsSpec, o)), h += r ? 1 : 0, n -= r ? 0 : 1; return a = e.weekEnds + h, l = C((i - e.businessDays) / (7 - s.sessionsSpec .weekEndsCount())), c = a + s.sessionsSpec.weekEndsCount() * l, i + c } var s, a, l, c, h; return e >= g(this.sessionsSpec, i) && (i++, e = 0), s = this, a = new Date(Date .UTC(i, M.JANUARY, 1)), l = p(this.sessionsSpec, a), c = new o(this .sessionsSpec, l), h = e < c.businessDays ? n(l, e) : r(l, c, e), this .uber.startOfPeriod(t, h, i) }, S.prototype.indexOfPeriod = function(t) { return this.builder().indexOfPeriod(t) }, S.prototype.startOfPeriod = function(t, e, i) { return this.builder().startOfPeriod(t, e, i) }, S.prototype.builder = function() { return this._builder || (this._builder = this.session.spec.hasWeekEnds() ? new b(this.session.spec) : new y), this._builder }, w.prototype.indexOfPeriod = function(t, e) { var i = f(this.session.spec, t); return 0 === i && t < this.startOfPeriod(e, 0, M.get_year(t)) && (i = -1), i }, w.prototype.startOfPeriod = function(t, e, i) { var o, n, r = new Date(Date.UTC(i, M.JANUARY, 1)), s = p(this.session.spec, r), a = 0 === s ? 7 * e : 7 * (e + 1) - s, l = M.get_days_per_year(r); return a > l ? this.startOfPeriod(t, 0, i + C(a / l)) : (o = M.get_cal(t, i, M .JANUARY, 1), n = M.add_days_considering_dst(t, o, a), M.utc_to_cal( t, +n)) }, T.prototype.indexOfPeriod = function(t) { return M.get_month(t) }, T.prototype.startOfPeriod = function(t, e, i) { var o, n, r, s; return e < 0 ? (o = C((11 - e) / 12), i -= o, e += 12 * o) : e > M.DECEMBER && ( i++, e = M.JANUARY), n = M.get_cal_utc(i, e, 1), r = p(this.session .spec, n), r > 4 && (s = 7 - r, M.add_date(n, s)), n }, x.prototype.init = function(t, e) { return this.timezone = "string" == typeof t ? M.get_timezone(t) : t, this.spec = new o(e), this }, { PRE_SESSION: I, POST_SESSION: k, LASTBAR_SESSION: -3, newBarBuilder: t, Session: x, alignPeriodsBack: r, extrapolateBarsFrontByCount: a, extrapolateBarsFrontToTime: s, lower_bound: P, isTradingNow: L, numberOfFullWeeks: f, numberOfWeekEndsSinceYearStart: v, BusinessDaysBuilder: b, alignExchangeTimeToSessionStartAndReturnUTC: d } }(); t.exports = n }).call(e, i(78)) }, function(t, e, i) { "use strict"; function o(t) { var e = t.className, i = t.icon, o = void 0 === i ? "" : i, r = t.onClick, s = t.title; return n.createElement("span", { title: s, className: e, dangerouslySetInnerHTML: { __html: o }, onClick: r }) } Object.defineProperty(e, "__esModule", { value: !0 }); var n = i(2); e.Icon = o }, function(t, e, i) { "use strict"; function o(t, e) { var i = e.edge; return i.A * t.x + i.B * t.y + i.C > 0 === e.isPositive } function n(t, e, i, o) { var n = e.add(i).scaled(.5), r = n.add(o).scaled(.5), s = l.intersectLineSegments(e, i, r, t); return null === s && (null === (s = l.intersectLineSegments(i, o, r, t)) && null === (s = l .intersectLineSegments(o, e, r, t))) } function r(t, e, i) { return t.x >= e.x && t.x <= i.x && t.y >= e.y && t.y <= i.y } function s(t, e) { var i, o, n, r = e.length - 1, s = !1, a = t.x, l = t.y; for (i = 0; i < e.length; i++) o = e[i], n = e[r], (o.y < l && n.y >= l || n.y < l && o.y >= l) && o .x + (l - o.y) / (n.y - o.y) * (n.x - o.x) < a && (s = !s), r = i; return s } function a(t, e, i) { return (t.x - e.x) * (t.x - e.x) + (t.y - e.y) * (t.y - e.y) <= i * i } Object.defineProperty(e, "__esModule", { value: !0 }); var l = i(132); e.pointInHalfplane = o, e.pointInTriangle = n, e.pointInRectangle = r, e.pointInPolygon = s, e .pointInCircle = a }, function(t, e, i) { "use strict"; function o() { return s.replace(/[xy]/g, function(t) { var e = 16 * Math.random() | 0; return ("x" === t ? e : 3 & e | 8).toString(16) }) } function n() { return r(12) } function r(t) { var e, i, o = ""; for (e = 0; e < t; ++e) i = Math.round(Math.random() * (a.length - 1)), o += a[i]; return o } var s, a; Object.defineProperty(e, "__esModule", { value: !0 }), s = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx", a = "0123456789abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", e.guid = o, e.randomHash = n, e .randomHashN = r }, , , function(t, e, i) { "use strict"; (function(e) { function i() { return /on-features-page=1/i.test(window.location.search) } var o = window.TradingView = window.TradingView || {}; o.className = function(t) { for (var e in this) if (o[e] === t) return e; return null }, o.isOnFeaturePage = i(), o.wrapUrl = function(t) { return e.enabled("charting_library_base") && (t = t.replace("/static/", "")), t }, o.isMobile = function() { var t = /Android/i.test(navigator.userAgent), e = /BlackBerry/i.test(navigator.userAgent), i = /iPhone|iPad|iPod/i.test(navigator.userAgent), o = /Opera Mini/i.test(navigator.userAgent), n = t || e || i || o; return { Android: function() { return t }, BlackBerry: function() { return e }, iOS: function() { return i }, Opera: function() { return o }, any: function() { return n } } }(), o.supportTouch = function() { return Modernizr.touch || o.isMobile.any() }, o.onWidget = function() { var t, e, i = ["^widgetembed/?$", "^cmewidgetembed/?$", "^([0-9a-zA-Z-]+)/widgetembed/?$", "^([0-9a-zA-Z-]+)/widgetstatic/?$", "^([0-9a-zA-Z-]+)?/?miniwidgetembed/?$", "^([0-9a-zA-Z-]+)?/?mediumwidgetembed/?$", "^embed(-static)?/([0-9a-zA-Z]{8})/?$", "^widgetpopup/?$", "^extension/?$", "^chatwidgetembed/?$", "^ideaswidgetembed/?$", "^ideas-widget/?$", "^view-idea-widget/([0-9a-zA-Z]{8})/?$", "^user-info-widget/?$", "^user-info-widget-get/(.+?)?/?$", "^embed-quotes-provider/?$", "^idea-popup/?$", "^hotlistswidgetembed/?$", "^marketoverviewwidgetembed/?$", "^([0-9a-zA-Z-]+)/marketoverviewwidgetembed/?$", "^eventswidgetembed/?$", "^tickerswidgetembed/?$", "^forexcrossrateswidgetembed/?$", "^forexheatmapwidgetembed/?$", "^marketquoteswidgetembed/?$", "^screenerwidget/?$", "^cryptomktscreenerwidget/?$", "^([0-9a-zA-Z-]+)/cryptomktscreenerwidget/?$", "^([0-9a-zA-Z-]+)/marketquoteswidgetembed/?$" ], o = window.location.pathname.replace(/^\//, ""); for (e = i.length - 1; e >= 0; e--) if (t = RegExp(i[e]), t.test(o)) return !0; return !1 }, o.onOrder = function() { return "/order/" === window.location.pathname }, t.exports.CheckMobile = o.isMobile, t.exports.isOnFeaturePage = i, t.exports.onWidget = o .onWidget, t.exports.supportTouch = o.supportTouch }).call(e, i(5)) }, function(t, e, i) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var o = i(584); e.createDialog = o.createDialog }, function(t, e, i) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }), i(13), i(12), e.lineToolsInfo = { LineTool5PointsPattern: { icon: i(622), localizedName: $.t("XABCD Pattern") }, LineToolABCD: { icon: i(623), localizedName: $.t("ABCD Pattern") }, LineToolArc: { icon: i(624), localizedName: $.t("Arc") }, LineToolArrow: { icon: i(625), localizedName: $.t("Arrow") }, LineToolArrowMarkDown: { icon: i(626), localizedName: $.t("Arrow Mark Down") }, LineToolArrowMarkLeft: { icon: i(627), localizedName: $.t("Arrow Mark Left") }, LineToolArrowMarkRight: { icon: i(628), localizedName: $.t("Arrow Mark Right") }, LineToolArrowMarkUp: { icon: i(629), localizedName: $.t("Arrow Mark Up") }, LineToolBalloon: { icon: i(630), localizedName: $.t("Balloon") }, LineToolBarsPattern: { icon: i(631), localizedName: $.t("Bars Pattern") }, LineToolBezierCubic: { icon: i(632), localizedName: $.t("Double Curve") }, LineToolBezierQuadro: { icon: i(633), localizedName: $.t("Curve") }, LineToolBrush: { icon: i(634), localizedName: $.t("Brush") }, LineToolCallout: { icon: i(635), localizedName: $.t("Callout") }, LineToolCircleLines: { icon: i(636), localizedName: $.t("Cyclic Lines") }, LineToolCypherPattern: { icon: i(637), localizedName: $.t("Cypher Pattern") }, LineToolDateAndPriceRange: { icon: i(638), localizedName: $.t("Date and Price Range") }, LineToolDateRange: { icon: i(639), localizedName: $.t("Date Range") }, LineToolDisjointAngle: { icon: i(640), localizedName: $.t("Disjoint Angle") }, LineToolElliottCorrection: { icon: i(641), localizedName: $.t("Elliott Correction Wave (ABC)") }, LineToolElliottDoubleCombo: { icon: i(642), localizedName: $.t("Elliott Double Combo Wave (WXY)") }, LineToolElliottImpulse: { icon: i(643), localizedName: $.t("Elliott Impulse Wave (12345)") }, LineToolElliottTriangle: { icon: i(644), localizedName: $.t("Elliott Triangle Wave (ABCDE)") }, LineToolElliottTripleCombo: { icon: i(645), localizedName: $.t("Elliott Triple Combo Wave (WXYXZ)") }, LineToolEllipse: { icon: i(646), localizedName: $.t("Ellipse") }, LineToolExtended: { icon: i(647), localizedName: $.t("Extended") }, LineToolFibChannel: { icon: i(648), localizedName: $.t("Fib Channel") }, LineToolFibCircles: { icon: i(649), localizedName: $.t("Fib Circles") }, LineToolFibRetracement: { icon: i(650), localizedName: $.t("Fib Retracement") }, LineToolFibSpeedResistanceArcs: { icon: i(651), localizedName: $.t("Fib Speed Resistance Arcs") }, LineToolFibSpeedResistanceFan: { icon: i(652), localizedName: $.t("Fib Speed Resistance Fan") }, LineToolFibSpiral: { icon: i(653), localizedName: $.t("Fib Spiral") }, LineToolFibTimeZone: { icon: i(654), localizedName: $.t("Fib Time Zone") }, LineToolFibWedge: { icon: i(655), localizedName: $.t("Fib Wedge") }, LineToolFlagMark: { icon: i(656), localizedName: $.t("Flag Mark") }, LineToolFlatBottom: { icon: i(657), localizedName: $.t("Flat Top/Bottom") }, LineToolGannComplex: { icon: i(305), localizedName: $.t("Gann Square") }, LineToolGannFixed: { icon: i(305), localizedName: $.t("Gann Square Fixed") }, LineToolGannFan: { icon: i(658), localizedName: $.t("Gann Fan") }, LineToolGannSquare: { icon: i(659), localizedName: $.t("Gann Box") }, LineToolGhostFeed: { icon: i(660), localizedName: $.t("Ghost Feed") }, LineToolHeadAndShoulders: { icon: i(661), localizedName: $.t("Head and Shoulders") }, LineToolHorzLine: { icon: i(662), localizedName: $.t("Horizontal Line") }, LineToolHorzRay: { icon: i(663), localizedName: $.t("Horizontal Ray") }, LineToolIcon: { icon: "icon", localizedName: $.t("Font Icons") }, LineToolInsidePitchfork: { icon: i(664), localizedName: $.t("Inside Pitchfork") }, LineToolNote: { icon: i(665), localizedName: $.t("Note") }, LineToolNoteAbsolute: { icon: i(666), localizedName: $.t("Anchored Note") }, LineToolParallelChannel: { icon: i(667), localizedName: $.t("Parallel Channel") }, LineToolPitchfan: { icon: i(668), localizedName: $.t("Pitchfan") }, LineToolPitchfork: { icon: i(669), localizedName: $.t("Pitchfork") }, LineToolPolyline: { icon: i(670), localizedName: $.t("Polyline") }, LineToolPrediction: { icon: i(671), localizedName: $.t("Forecast") }, LineToolPriceLabel: { icon: i(672), localizedName: $.t("Price Label") }, LineToolPriceRange: { icon: i(673), localizedName: $.t("Price Range") }, LineToolProjection: { icon: i(674), localizedName: $.t("Projection") }, LineToolRay: { icon: i(675), localizedName: $.t("Ray") }, LineToolRectangle: { icon: i(676), localizedName: $.t("Rectangle") }, LineToolRegressionTrend: { icon: i(677), localizedName: $.t("Regression Trend") }, LineToolRiskRewardLong: { icon: i(678), localizedName: $.t("Long Position") }, LineToolRiskRewardShort: { icon: i(679), localizedName: $.t("Short Position") }, LineToolRotatedRectangle: { icon: i(680), localizedName: $.t("Rotated Rectangle") }, LineToolSchiffPitchfork: { icon: i(681), localizedName: $.t("Modified Schiff Pitchfork") }, LineToolSchiffPitchfork2: { icon: i(682), localizedName: $.t("Schiff Pitchfork") }, LineToolSineLine: { icon: i(683), localizedName: $.t("Sine Line") }, LineToolText: { icon: i(684), localizedName: $.t("Text") }, LineToolTextAbsolute: { icon: i(685), localizedName: $.t("Anchored Text") }, LineToolThreeDrivers: { icon: i(686), localizedName: $.t("Three Drives Pattern") }, LineToolTimeCycles: { icon: i(687), localizedName: $.t("Time Cycles") }, LineToolTrendAngle: { icon: i(688), localizedName: $.t("Trend Angle") }, LineToolTrendBasedFibExtension: { icon: i(689), localizedName: $.t("Trend-Based Fib Extension") }, LineToolTrendBasedFibTime: { icon: i(690), localizedName: $.t("Trend-Based Fib Time") }, LineToolTrendLine: { icon: i(691), localizedName: $.t("Trend Line") }, LineToolTriangle: { icon: i(692), localizedName: $.t("Triangle") }, LineToolTrianglePattern: { icon: i(693), localizedName: $.t("Triangle Pattern") }, LineToolVertLine: { icon: i(694), localizedName: $.t("Vertical Line") }, SyncDrawing: { icon: i(695), iconActive: i(696), localizedName: $.t("Sync drawings to all charts") }, arrow: { icon: i(697), localizedName: $.t("Arrow") }, cursor: { icon: i(698), localizedName: $.t("Cross") }, dot: { icon: i(699), localizedName: $.t("Dot") }, drawginmode: { icon: i(700), iconActive: i(701), localizedName: $.t("Stay in Drawing Mode") }, eraser: { icon: i(702), localizedName: $.t("Eraser") }, group: { icon: i(703), localizedName: $.t("Show Hidden Tools") }, hideAllDrawings: { icon: i(302), iconActive: i(704), localizedName: $.t("Hide All Drawing Tools") }, lockAllDrawings: { icon: i(705), iconActive: i(706), localizedName: $.t("Lock All Drawing Tools") }, magnet: { icon: i(707), localizedName: $.t("Magnet Mode pulls the points of drawings to symbol values") }, measure: { icon: i(708), localizedName: $.t("Measure (Shift + Click on the chart)") }, removeAllDrawingTools: { icon: i(709), localizedName: $.t("Remove All Drawing Tools") }, showObjectsTree: { icon: i(710), localizedName: $.t("Show Objects Tree") }, zoom: { icon: i(711), localizedName: $.t("Zoom In") }, "zoom-out": { icon: i(712), localizedName: $.t("Zoom Out") } } }, function(t, e, i) { "use strict"; var o, n, r; Object.defineProperty(e, "__esModule", { value: !0 }), o = i(32), n = i(788), r = function() { function t() { this._rendererData = { text: "", coordinate: 0, fixedCoordinate: 0, color: "#FFF", background: "#000", visible: !1 }, this._renderer = new n.PriceAxisViewRenderer(this._rendererData), this ._invalidated = !0 } return t.prototype.text = function() { return this._rendererData.text }, t.prototype.background = function() { return this._rendererData.background }, t.prototype.color = function() { return this.generateTextColor(this.background()) }, t.prototype.generateTextColor = function(t) { return "black" === o.rgbToBlackWhiteString(o.parseRgb(t), 160) ? "white" : "black" }, t.prototype.coordinate = function() { return this._updateRendererDataIfNeeded(), this._rendererData.coordinate }, t.prototype.floatCoordinate = function() { return this._updateRendererDataIfNeeded(), this._rendererData.floatCoordinate || this ._rendererData.coordinate }, t.prototype.update = function() { this._invalidated = !0 }, t.prototype.height = function(t, e) { return void 0 === e && (e = !1), this._renderer.height(t, e) }, t.prototype.getFixedCoordinate = function() { return this._rendererData.fixedCoordinate || 0 }, t.prototype.setFixedCoordinate = function(t) { this._rendererData.fixedCoordinate = t }, t.prototype.isVisible = function() { return this._rendererData.visible }, t.prototype.renderer = function() { return this._updateRendererDataIfNeeded(), this._renderer.setData(this._rendererData), this._renderer }, t.prototype._updateRendererDataIfNeeded = function() { this._invalidated && (this._updateRendererData(this._rendererData), this ._invalidated = !1) }, t }(), e.PriceAxisView = r }, , , function(t, e, i) { "use strict"; function o(t) { return s.createElement(t.href ? "a" : "div", t) } function n(t) { t.stopPropagation() } var r, s, a, l, c, h; Object.defineProperty(e, "__esModule", { value: !0 }), r = i(0), s = i(2), a = i(14), l = i(85), c = i(731), h = function(t) { function e() { var e = null !== t && t.apply(this, arguments) || this; return e._handleClick = function(t) { var i = e.props, o = i.dontClosePopup, n = i.isDisabled, r = i.onClick, s = i.onClickArg; n || (r && r(s, t), o || l.globalClosePopupMenu()) }, e } return r.__extends(e, t), e.prototype.render = function() { var t, e, i = this.props, r = i.className, l = i.forceShowHint, h = i.hint, u = i.icon, d = i.isActive, p = i.isDisabled, _ = i.isHovered, f = i.appearAsDisabled, m = i.label, g = i.link, v = i.showToolboxOnHover, y = i.target, b = i.toolbox, S = i.theme, w = void 0 === S ? c : S; return s.createElement(o, { className: a(r, w.item, u && w.withIcon, (t = {}, t[w.isActive] = d, t[w .isDisabled] = p || f, t[w.hovered] = _, t)), href: g, target: y, onClick: this._handleClick }, void 0 !== u && s.createElement("div", { className: w.icon, dangerouslySetInnerHTML: { __html: u } }), s.createElement("div", { className: w.labelRow }, s.createElement("div", { className: w.label }, m)), (void 0 !== h || l) && s.createElement("div", { className: w.hint }, h), void 0 !== b && s.createElement("div", { onClick: n, className: a(w.toolbox, (e = {}, e[w.showOnHover] = v, e)) }, b)) }, e }(s.PureComponent), e.PopupMenuItem = h }, function(t, e, i) { "use strict"; (function(e) { function o() { if ("undefined" == typeof tradingService) return null; var t = tradingService(); return t && t.connectStatus() === CONNECTSTATUSES.CONNECTED ? t.activeBroker() : null } function n() { var t = o(); if (t && t.metainfo().configFlags.supportSymbolSearch) return t.metainfo().symbolSearchId || t.metainfo().id.toLowerCase() } var r = i(122).isIntervalAvailable, s = i(76), a = i(764), l = i(121), c = i(172).unifiedSpinner, h = i(144), u = i(200).regExpEscape, d = i(765), p = i(148).isFeatureEnabled, _ = i(123), f = function() { function t(i) { var o, n, r, s; if (!(this instanceof t)) throw new TypeError("SymbolSearch is a constructor"); if (i = i || {}, o = !i.dontUseInputParser && e.enabled( "symbol_search_parser_mixin") && t.canShowSpreadActions(), this ._inputParserMixin = o ? new SymbolSearchInputParserMixin(this) : void 0, this ._inputElement = $(i.input).get(0), !this._inputElement) throw new TypeError( "options.input must be a DOM element, jQuery object or selector"); if (this.$list = $(i.list).eq(0), 0 === this.$list.size() && delete this.$list, void 0 !== i.callback) { if ("function" != typeof i.callback) throw new TypeError( "options.callback must be function"); this._callback = i.callback } if (void 0 !== i.onValueChanged) { if ("function" != typeof i.onValueChanged) throw new TypeError( "options.onValueChanged must be function"); this._onValueChanged = i.onValueChanged } if (void 0 !== i.onEmptyApply) { if ("function" != typeof i.onEmptyApply) throw new TypeError( "options.onEmptyApply must be function"); this._onEmptyApply = i.onEmptyApply } if (i.ignoreInterval && (this._ignoreInterval = !0), t.resetStoredInterval(), i .hidePro && (this._hidePro = !0), i.allowMultipleSymbols && (this ._allowMultipleSymbols = !0), void 0 !== i.onParse) { if ("function" != typeof i.onParse) throw new TypeError( "options.onParse must be function"); this._onParse = i.onParse } for (this._state = {}, this._resolveViaSymbolSearchId = null, this.acceptEmpty = !!i .acceptEmpty, $(this._inputElement).data("symbol-search-instance", this), n = this._boundListener = this._eventListener.bind(this), r = this .boundTimeoutListener = function(t) { setTimeout(function() { n(t) }, 0) }, s = 0; s < w.length; s++) w[s].immediate ? $(this._inputElement).on(w[s] .name, n) : $(this._inputElement).on(w[s].name, r); this._boundOnKeyDown = this._onKeyDown.bind(this), this._boundOnKeyPress = this ._onKeyPress.bind(this), $(this._inputElement).on("keydown", this ._boundOnKeyDown).on("keypress", this._boundOnKeyPress), this ._eventListener(), i.autoFocus && t.registerAutoFocus(this) } function o(t, e) { var i, o = ChartApiInstance.supportedSymbolsTypes(); return n() && (o = o.filter(function(t) { return "quandl" !== t.value && "economic" !== t.value })), i = TVSettings.getValue("symboledit.filter"), !o.some(function(t) { return t.value === i }) && o.length > 0 && (i = o[0].value), 0 !== o.length && (o.forEach(function( o) { var n = o.value, r = $('').attr("href", "#" + n).text($.t( o.name)); n === i && r.addClass("active"), r.on("click", function(i) { i.preventDefault(), e.find(".type-filter").removeClass( "active"), $(this).addClass("active"), t .typeFilter(n), TVSettings.setValue( "symboledit.filter", n) }), r.appendTo(e) }), t.typeFilter(i), !0) } function f(t, i) { var o, n, r, s = ChartApiInstance.supportedExchangesList(); if (s = a.displayedExchangesFilter(s), s = a.sortExchangesListByFlagIfNeeded(s), o = TVSettings.getValue("symboledit.exchangefilter"), "bovespa" !== TradingView.widgetCustomer) return !s.some(function(t) { return t.value === o }) && s.length > 0 && (o = s[0].value), 0 !== s.length && (n = $( '
').appendTo(i), r = $("
' + i(596) + $.t( "NEW") + '
' + i(597) + '
' + $.t("Created ") + '. ' + $.t( "Last edited ") + '
', textNotesWidgetItem: '
{{title}}
{{#symbol}}
' + i(598) + '{{symbol}}
{{/symbol}}
{{description}}
', tvDataTable: '{{#columns}}{{/columns}}{{#bodies}}{{#strokes}}{{#cells}}{{/cells}}{{/strokes}}{{/bodies}}
{{{label}}}
{{#contain}}{{{contain}}}{{/contain}}
', tvDataTableRow: '{{#columns}}{{#contain}}{{{contain}}}{{/contain}}{{/columns}}', tvDataTableCell: '{{#contain}}{{{contain}}}{{/contain}}' } }, function(t, e, i) { "use strict"; function o(t) { var e = t.split(":"); return { name: e[0], type: 2 === e.length ? e[1] : null } } function n(t, e, i, n) { var r, s, a, l, c, p, _, f, m, g, v, y, b, S, w, T = i.split("."); if (0 !== T.length && 0 !== T[0].length) { if (r = o(T[0]), s = r.name, a = r.type, l = null !== a, c = !l || "plot" === a, p = !l || "band" === a, _ = !l || "area" === a, f = !l || "input" === a, m = c ? d.getPlotIdByTitle(t, s) : null, g = p ? d.getBandIndexByName(t, s) : null, v = _ ? d.getFilledAreaIdByTitle( t, s) : null, y = f ? d.getInputByName(t, s) : null, b = e.hasOwnProperty(s), (null !== m ? 1 : 0) + (null !== g ? 1 : 0) + (null !== v ? 1 : 0) + (null !== y ? 1 : 0) + (b ? 1 : 0) > 1) return void h.logWarn("Study '" + t.description + "' has ambiguous identifier '" + s + "'"); if (S = T[1], null !== m) { if (1 === T.length) return void h.logWarn("Path of sub-property of '" + s + "' plot for study '" + t.description + "' must be not empty"); w = T.slice(1), u.applyPlotProperty(t, e, m, w, n) } else if (null !== y) u.applyInputValue(e, y, n); else if (null !== g) { if (void 0 === S) return void h.logWarn("Property name of '" + s + "' band for study '" + t .description + "' must be set"); u.applyBandProperty(e, g, S, n) } else if (null !== v) { if (void 0 === S) return void h.logWarn("Property name of '" + s + "' area for study '" + t .description + "' must be set"); u.applyFilledAreaProperty(e, v, S, n) } else b ? u.setRootProperty(e, T, n) : h.logWarn("Study '" + t.description + "' has no plot or input '" + s + "'") } } function r(t, e) { var i, o, r = t.properties(), s = r.state(); for (i in e) e.hasOwnProperty(i) && n(t.metaInfo(), s, i, e[i]); r.merge(s), o = r.precision, void 0 !== o ? o.listeners().fire(o) : r.listeners().fire(r) } function s(t, e, i) { var o, r, s, a, l; for (o in t) t.hasOwnProperty(o) && -1 !== (r = o.indexOf(".")) && (s = o.substr(0, r), a = d .getMetaInfoByDescription(e, s), null !== a ? (l = i(a.id), null !== l ? n(a, l, o.substr( r + 1), t[o]) : h.logWarn("Cannot apply overrides for study " + s)) : h.logWarn( "There is no such study " + s)) } var a, l, c, h, u, d; Object.defineProperty(e, "__esModule", { value: !0 }), a = i(111), l = i(9), c = i(7), h = c.getLogger("Chart.Model.StudyPropertiesOverrider"), function(t) { function e(t) { return "colorer" === t.type } function i(t, i, o) { var n, r, s, a; if (void 0 === t.plots) return null; for (n = 0, r = t.plots; n < r.length; n++) if (s = r[n], e(s) && void 0 !== i.palettes && (a = i.palettes[s.palette], s.target === o && void 0 !== a)) return a; return null } function o(t, e, i, o, n) { return void 0 === t.styles ? void h.logWarn("Study does not have styles") : null === e && ! isNaN(o) && o > 0 ? void h.logWarn("Study plot does not have color #" + o) : ((0 === o || isNaN(o)) && (l.ensureDefined(t.styles[i]).color = n + "", o = 0), void( null !== e && (l.ensureDefined(e.colors[o]).color = n + ""))) } function n(t, e, n, r, s) { var a, l, c, u, p; if (void 0 === e.styles) return void h.logWarn("Study does not have styles"); if ("color" === (a = r[0])) return l = i(t, e, n), c = r.length > 1 ? parseInt(r[1]) : NaN, void o(e, l, n, c, s); if (void 0 === (u = e.styles[n]) || !u.hasOwnProperty(a)) return void h.logWarn( "Study plot does not have property '" + a + "'"); if ("plottype" === a) { if (void 0 === (p = d[s + ""])) return void h.logWarn( "Unsupported plot type for plot: " + s); s = p } u[a] = s } function r(t, e, i, o) { var n, r; if (void 0 === t.bands) return void h.logWarn("Study does not have bands"); if (void 0 === (n = t.bands[e]) || !n.hasOwnProperty(i)) return void h.logWarn( "Study band does not have property '" + i + "'"); if ("plottype" === i) { if (void 0 === (r = d[o + ""])) return void h.logWarn( "Unsupported plot type for band: " + o); o = r } n[i] = o } function s(t, e, i, o) { if (void 0 === t.filledAreasStyle) return void h.logWarn("Study does not have areas"); var n = t.filledAreasStyle[e]; if (void 0 === n || !n.hasOwnProperty(i)) return void h.logWarn( "Study area does not have property '" + i + "'"); n[i] = o } function c(t, e, i) { if (void 0 === t.inputs || !t.inputs.hasOwnProperty(e)) return void h.logWarn( "Study does not have input '" + e + "'"); t.inputs[e] = i } function u(t, e, i) { var o, n, r, s, a; if (0 !== e.length) { for (o = t, n = 0, r = e.slice(0, -1); n < r.length && (s = r[n], null != o && t .hasOwnProperty(s)); n++) o = t[s]; if (a = e[e.length - 1], null == o || !o.hasOwnProperty(a)) return void h.logWarn( "Study does not have property " + e.join(".")); o[a] = i } } var d = { line: a.PlotType.Line, histogram: a.PlotType.Histogram, cross: a.PlotType.Cross, area: a.PlotType.Area, columns: a.PlotType.Columns, circles: a.PlotType.Circles, line_with_breaks: a.PlotType.LineWithBreaks, area_with_breaks: a.PlotType.AreaWithBreaks }; t.applyPlotProperty = n, t.applyBandProperty = r, t.applyFilledAreaProperty = s, t .applyInputValue = c, t.setRootProperty = u }(u || (u = {})), function(t) { function e(t, e) { var i, o, n; if (void 0 === t.inputs) return null; for (e = e.toLowerCase(), i = 0, o = t.inputs; i < o.length; i++) if (n = o[i], n.name.toLowerCase() === e) return n.id; return null } function i(t, e) { var i, o, n; if (void 0 === t.styles) return null; e = e.toLowerCase(); for (i in t.styles) if (o = t.styles[i], n = void 0 !== o && void 0 !== o.title ? o.title : i, n .toLowerCase() === e) return i; return null } function o(t, e) { var i, o, n; if (void 0 === t.filledAreas) return null; for (e = e.toLowerCase(), i = 0, o = t.filledAreas; i < o.length; i++) if (n = o[i], n.title.toLowerCase() === e) return n.id; return null } function n(t, e) { if (void 0 === t.bands) return null; e = e.toLowerCase(); for (var i = 0; i < t.bands.length; ++i) if (t.bands[i].name.toLowerCase() === e) return i; return null } function r(t, e) { var i, o, n; for (e = e.toLowerCase(), i = 0, o = t; i < o.length; i++) if (n = o[i], n.description.toLowerCase() === e || n.shortDescription.toLowerCase() === e) return n; return null } t.getInputByName = e, t.getPlotIdByTitle = i, t.getFilledAreaIdByTitle = o, t .getBandIndexByName = n, t.getMetaInfoByDescription = r }(d || (d = {})), e.applyOverridesToStudy = r, e.applyOverridesToStudyDefaults = s }, function(t, e, i) { "use strict"; function o(t, e, i) { var o, n, r, s, a = null, l = 0; return i = i || {}, s = function() { l = !1 === i.leading ? 0 : Date.now(), a = null, r = t.apply(o, n), a || (o = n = null) }, function() { var c, h = Date.now(); return l || !1 !== i.leading || (l = h), c = e - (h - l), o = this, n = arguments, c <= 0 || c > e ? (a && (clearTimeout(a), a = null), l = h, r = t.apply(o, n), a || (o = n = null)) : a || !1 === i.trailing || (a = setTimeout(s, c)), r } } Object.defineProperty(e, "__esModule", { value: !0 }), e.default = o, t.exports = e.default }, function(t, e, i) { "use strict"; var o, n, r, s, a, l, c, h, u; Object.defineProperty(e, "__esModule", { value: !0 }), o = i(0), i(43), n = i(2), r = i(14), s = i(59), a = i(85), l = i(151), c = i(722), h = i(392), u = function(t) { function e(e) { var i = t.call(this, e) || this; return i._toggleDropdown = function(t) { i.setState({ isOpened: void 0 !== t ? t : !i.state.isOpened }) }, i._handleClose = function() { i._toggleDropdown(!1) }, i._getDropdownPosition = function() { if (!i._control) return { x: 0, y: 0 }; var t = i._control.getBoundingClientRect(); return { x: t.left + t.width + 1, y: t.top - 6 } }, i._handleClickArrow = function() { i._toggleDropdown() }, i._handleTouchStart = function() { i.props.onClickButton(), i._toggleDropdown() }, i._handlePressStart = function() { if (Modernizr.touch) i._longPressDelay || i.props.onClickButton(); else { if (i._doubleClickDelay) return clearTimeout(i._doubleClickDelay), delete i ._doubleClickDelay, void i._toggleDropdown(!0); i._doubleClickDelay = setTimeout(function() { delete i._doubleClickDelay, i._longPressDelay || i.props .onClickButton() }, 175) } i._longPressDelay = setTimeout(function() { delete i._longPressDelay, i._toggleDropdown(!0) }, 300) }, i._handlePressEnd = function() { i._longPressDelay && (clearTimeout(i._longPressDelay), delete i._longPressDelay, i .state.isOpened ? i._toggleDropdown(!1) : i.state.isOpened || !i.props .isActive || Modernizr.touch || i._toggleDropdown(!0)) }, i.state = { isOpened: !1 }, i } return o.__extends(e, t), e.prototype.render = function() { var t, e = this, i = this.props, o = i.buttonActiveClass, u = i.buttonClass, d = i.buttonIcon, p = i.buttonTitle, _ = i.children, f = i.isActive, m = i.isGrayed, g = i.onClickWhenGrayed, v = this.state.isOpened; return n.createElement("div", { className: r(c.dropdown, "apply-common-tooltip common-tooltip-vertical", ( t = {}, t[c.isGrayed] = m, t[c.isActive] = f, t[c.isOpened] = v, t)), onClick: m ? g : void 0, title: p, "data-tooltip-delay": 1500 }, n.createElement("div", { ref: function(t) { return e._control = t }, className: c.control }, n.createElement("div", { className: c.buttonWrap, onMouseDown: m || Modernizr.touch ? void 0 : this._handlePressStart, onMouseUp: m || Modernizr.touch ? void 0 : this._handlePressEnd, onClick: !m && Modernizr.touch ? this._handleTouchStart : void 0 }, n.createElement(l.ToolButton, { activeClass: o, className: u, icon: d, isActive: f, isGrayed: m, isTransparent: !0 })), !m && !Modernizr.touch && n.createElement("div", { className: c.arrow, onClick: this._handleClickArrow }, n.createElement(s.Icon, { className: c.arrowIcon, icon: h }))), !m && n.createElement(a.PopupMenu, { doNotCloseOn: this, isOpened: v, onClose: this._handleClose, position: this._getDropdownPosition }, _)) }, e }(n.PureComponent), e.ToolDropdown = u }, function(t, e) { t.exports = '' }, function(t, e) { t.exports = '' }, function(t, e, i) { "use strict"; function o(t) { return n.createDialog(Object.assign({}, a, t)) } var n, r, s, a; Object.defineProperty(e, "__esModule", { value: !0 }), i(12), n = i(65), r = { key: 13, name: "yes", text: $.t("Yes"), type: "success" }, s = { method: "close", name: "no", text: $.t("No"), type: "default" }, a = { actions: [r, s], actionsWrapTemplate: '
', content: $.t("Are you sure?"), contentWrapTemplate: '

', destroyOnClose: !0, title: $.t("Confirmation"), width: 400 }, e.createConfirmDialog = o }, function(t, e, i) { "use strict"; var o, n, r, s; Object.defineProperty(e, "__esModule", { value: !0 }), o = i(9), n = i(19), function(t) { t[t.FromLeft = -1] = "FromLeft", t[t.FromRight = 1] = "FromRight" }(r = e.TimePointIndexSearchMode || (e.TimePointIndexSearchMode = {})), s = function() { function t(t) { this.m_bars = new n.PlotList(t), this.m_nsBars = new n.PlotList(t) } return t.prototype.bars = function() { return this.m_bars }, t.prototype.nsBars = function() { return this.m_nsBars }, t.prototype.size = function() { return this.m_bars.size() + this.m_nsBars.size() }, t.prototype.each = function(t) { this.m_bars.each(t), this.m_nsBars.each(t) }, t.prototype.clear = function() { this.m_bars.clear(), this.m_nsBars.clear(), this.lastProjectionPrice = void 0 }, t.prototype.isEmpty = function() { return this.m_bars.isEmpty() && this.m_nsBars.isEmpty() }, t.prototype.first = function() { return this.m_bars.isEmpty() ? this.m_nsBars.first() : this.m_bars.first() }, t.prototype.last = function() { return this.m_nsBars.isEmpty() ? this.m_bars.last() : this.m_nsBars.last() }, t.prototype.search = function(t, e) { return this.nsBars().isEmpty() ? this.bars().search(t, e) : this.bars().isEmpty() ? this .nsBars().search(t, e) : o.ensureNotNull(this.nsBars().firstIndex()) <= t ? this .nsBars().search(t, e) : this.bars().search(t, e) }, t.prototype.valueAt = function(t) { var e = this.search(t); return null !== e ? e.value : null }, t.prototype.plotValueToTimePointIndex = function(t, e, i) { var o, n, s, a; if (i === r.FromRight) return o = function(i, o) { var n = o[e]; return void 0 !== n && null !== n && t >= n }, null !== (n = this.m_bars.findLast(o)) ? n.index : (s = this.m_nsBars .findLast(o), null !== s ? s.index : this.m_bars.firstIndex()); if (i === r.FromLeft) return a = function(i, o) { var n = o[e]; return void 0 !== n && null !== n && t <= n }, null !== (n = this.m_bars.findFirst(a)) ? n.index : (s = this.m_nsBars .findFirst(a), null !== s ? s.index : this.m_bars.lastIndex()); throw Error("plotValueToTimePointIndex: unsupported search mode") }, t }(), e.SeriesData = s }, function(t, e, i) { "use strict"; var o, n; Object.defineProperty(e, "__esModule", { value: !0 }), o = i(15), n = function() { function t(t) { void 0 === t && (t = 1), this._precision = t } return t.prototype.format = function(t) { var e, i; return o.isNumber(t) || (t = parseFloat(t)), e = t.toFixed(this._precision), i = Math .pow(10, -this._precision), Math.max(parseFloat(e), i) + "" }, t }(), e.LimitedPrecisionNumericFormatter = n }, function(t, e) { t.exports = '' }, function(t, e, i) { "use strict"; var o, n, r; Object.defineProperty(e, "__esModule", { value: !0 }), o = i(9), n = i(17), i(13), r = function() { function t(t) { var e = this; this._alive = new n, this._body = new n, this._width = new n, this._height = new n, this ._fullscreen = new n, this._detachable = new n, this._visible = new n, this ._availWidth = new n, this._availHeight = new n, this._owner = new n, this ._ownersStack = [], this.owner = this._owner.readonly(), this._bridge = { alive: this._alive.readonly(), body: this._body.readonly(), width: this._width.readonly(), height: this._height.readonly(), fullscreen: this._fullscreen.readonly(), detachable: this._detachable.readonly(), visible: this._visible.readonly(), availWidth: this._availWidth.readonly(), availHeight: this._availHeight.readonly(), remove: function() { var t = e._owner.value(); t && t.remove && t.remove() }, negotiateWidth: function(t) { var i = e._owner.value(); i && i.negotiateWidth && i.negotiateWidth(t) }, negotiateHeight: function(t) { var i = e._owner.value(); i && i.negotiateHeight && i.negotiateHeight(t) }, requestFullscreen: function() { var t = e._owner.value(); t && t.requestFullscreen && t.requestFullscreen() }, exitFullscreen: function() { var t = e._owner.value(); t && t.exitFullscreen && t.exitFullscreen() }, detach: function(t) { var i = e._owner.value(); i && i.detach && i.detach(t) }, attach: function() { var t = e._owner.value(); t && t.attach && t.attach() } }, t && this.pushOwner(t) } return t.prototype.bridge = function() { return this._bridge }, t.prototype.pushOwner = function(t) { var e, i, o, n; if (t.alive.value()) { for (e = 0, i = this._ownersStack; e < i.length; e++) o = i[e], this ._unsubscribeOwner(o); n = { owner: t }, this._ownersStack.push(n), this._subscribeOwner(n) } }, t.prototype._subscribeOwner = function(t) { var e, i, o = this, n = t.owner; t.deathWatcher || (this._alive.setValue(!0), t.deathWatcher = n.alive.spawn(), t .deathWatcher.subscribe(function(e) { e || o._deadHandler(t) })), t.subscriptions || (e = t.subscriptions = [], this._visible.setValue(!1), i = function(t, i) { if (t) { var o = t.spawn(); e.push(o), o.subscribe(function(t) { i.setValue(t) }, { callWithLast: !0 }) } else i.deleteValue() }, i(n.body, this._body), i(n.width, this._width), i(n.height, this._height), i( n.fullscreen, this._fullscreen), i(n.detachable, this._detachable), i(n .availWidth, this._availWidth), i(n.availHeight, this._availHeight), i(n.visible, this._visible)), this._owner .setValue(n) }, t.prototype._unsubscribeOwner = function(t, e) { var i, o, n; if (t.subscriptions) { for (i = 0, o = t.subscriptions; i < o.length; i++) n = o[i], n.unsubscribe(); t.subscriptions = null } e && t.deathWatcher && (t.deathWatcher.unsubscribe(), t.deathWatcher = null) }, t.prototype._deadHandler = function(t) { var e, i = this._ownersStack.indexOf(t); for (o.assert(-1 !== i, "sanitized owner should be in stack"), e = this._ownersStack .length - 1; e >= i; e--) this._unsubscribeOwner(this._ownersStack[e], !0); this._ownersStack.length = i, i > 0 ? this._subscribeOwner(this._ownersStack[i - 1]) : ( this._alive.setValue(!1), this._owner.deleteValue()) }, t }(), e.ResizerDetacherState = r }, function(t, e, i) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }), e.layouts = { s: { title: "1 chart", count: 1, sizer: function(t, e, i, o) { return { width: e.width - o - o, height: e.height - o - o, top: o, left: o } } } } }, function(t, e, i) { "use strict"; function o() { this.backColorers = [] } function n(t) { o.call(this), this._series = t } function r(t, e) { o.call(this), this._study = t, this._plotIndex = e } var s = i(19).PlotRowSearchMode; o.prototype.barStyle = function(t, e, i) { var o, n = {}; for (o = this.backColorers.length - 1; o >= 0; o--) this.backColorers[o].applyBarStyle(t, e, n, i); return this.applyBarStyle(t, e, n, i), n }, o.prototype.pushBackBarColorer = function(t) { this.backColorers.push(t) }, o.prototype.applyBarStyle = function(t, e, i) { throw Error("This function is supposed to be reimplemented in a subclass") }, inherit(n, o), n.prototype.applyBarStyle = function(t, e, i, o) { var n, r, s, a, l, c, h, u, d, p, _, f, m, g, v; switch (i || (i = {}), i.barColor = null, i.barBorderColor = null, i.barWickColor = null, i .isBarHollow = null, i.isBarUp = null, i.upColor = null, i.downColor = null, i .isTwoColorBar = null, n = this._series.properties(), n.style.value()) { case TradingView.Series.STYLE_LINE: i.barColor = n.lineStyle.color.value(); break; case TradingView.Series.STYLE_AREA: i.barColor = n.areaStyle.linecolor.value(); break; case TradingView.Series.STYLE_BARS: r = n.barStyle.upColor.value(), s = n.barStyle.downColor.value(), a = r, l = s, c = this .findBar(t, !1, o), n.barStyle.barColorsOnPrevClose.value() ? (h = this.findPrevBar( t, !1, o), i.barColor = h[TradingView.CLOSE_PLOT] <= c[TradingView .CLOSE_PLOT] ? r : s, i.barBorderColor = h[TradingView.CLOSE_PLOT] <= c[ TradingView.CLOSE_PLOT] ? a : l) : (i.barColor = c[TradingView.OPEN_PLOT] <= c[ TradingView.CLOSE_PLOT] ? r : s, i.barBorderColor = c[TradingView .OPEN_PLOT] <= c[TradingView.CLOSE_PLOT] ? a : l); break; case TradingView.Series.STYLE_CANDLES: r = n.candleStyle.upColor.value(), s = n.candleStyle.downColor.value(), a = n .candleStyle.borderUpColor ? n.candleStyle.borderUpColor.value() : n.candleStyle .borderColor.value(), l = n.candleStyle.borderDownColor ? n.candleStyle .borderDownColor.value() : n.candleStyle.borderColor.value(), u = n.candleStyle .wickUpColor ? n.candleStyle.wickUpColor.value() : n.candleStyle.wickColor.value(), d = n.candleStyle.wickDownColor ? n.candleStyle.wickDownColor.value() : n .candleStyle.wickColor.value(), c = this.findBar(t, !1, o), n.candleStyle .barColorsOnPrevClose.value() ? (h = this.findPrevBar(t, !1, o), p = h[TradingView.CLOSE_PLOT] <= c[TradingView.CLOSE_PLOT]) : p = c[TradingView .OPEN_PLOT] <= c[TradingView.CLOSE_PLOT], i.barColor = p ? r : s, i .barBorderColor = p ? a : l, i.barWickColor = p ? u : d; break; case TradingView.Series.STYLE_HOLLOW_CANDLES: r = n.hollowCandleStyle.upColor.value(), s = n.hollowCandleStyle.downColor.value(), a = n.hollowCandleStyle.borderUpColor ? n.hollowCandleStyle.borderUpColor.value() : n .hollowCandleStyle.borderColor.value(), l = n.hollowCandleStyle.borderDownColor ? n .hollowCandleStyle.borderDownColor.value() : n.hollowCandleStyle.borderColor .value(), u = n.hollowCandleStyle.wickUpColor ? n.hollowCandleStyle.wickUpColor .value() : n.hollowCandleStyle.wickColor.value(), d = n.hollowCandleStyle .wickDownColor ? n.hollowCandleStyle.wickDownColor.value() : n.hollowCandleStyle .wickColor.value(), c = this.findBar(t, !1, o), h = this.findPrevBar(t, !1, o), h[ TradingView.CLOSE_PLOT] <= c[TradingView.CLOSE_PLOT] ? (i.barColor = r, i .barBorderColor = a, i.barWickColor = u) : (i.barColor = s, i.barBorderColor = l, i.barWickColor = d), c[TradingView.OPEN_PLOT] <= c[TradingView.CLOSE_PLOT] ? i.isBarHollow = !0 : i.isBarHollow = !1; break; case TradingView.Series.STYLE_HEIKEN_ASHI: r = n.haStyle.upColor.value(), s = n.haStyle.downColor.value(), a = n.haStyle .borderUpColor.value(), l = n.haStyle.borderDownColor.value(), u = n.haStyle .wickUpColor.value(), d = n.haStyle.wickDownColor.value(), c = this.findBar(t, e, o), n.haStyle.barColorsOnPrevClose.value() ? (h = this.findPrevBar(t, e, o), p = h[ TradingView.CLOSE_PLOT] <= c[TradingView.CLOSE_PLOT]) : p = c[TradingView .OPEN_PLOT] <= c[TradingView.CLOSE_PLOT], i.barColor = p ? r : s, i .barBorderColor = p ? a : l, i.barWickColor = p ? u : d; break; case TradingView.Series.STYLE_RENKO: c = this.findBar(t, e, o), p = c[TradingView.OPEN_PLOT] <= c[TradingView.CLOSE_PLOT], r = e ? n.renkoStyle.upColorProjection.value() : n.renkoStyle.upColor.value(), s = e ? n.renkoStyle.downColorProjection.value() : n.renkoStyle.downColor.value(), a = e ? n.renkoStyle.borderUpColorProjection.value() : n.renkoStyle.borderUpColor .value(), l = e ? n.renkoStyle.borderDownColorProjection.value() : n.renkoStyle .borderDownColor.value(), u = n.renkoStyle.wickUpColor.value(), d = n.renkoStyle .wickDownColor.value(), i.barColor = p ? r : s, i.barBorderColor = p ? a : l, i .barWickColor = p ? u : d, i.isBarUp = p; break; case TradingView.Series.STYLE_PB: c = this.findBar(t, e, o), p = c[TradingView.OPEN_PLOT] <= c[TradingView.CLOSE_PLOT], r = e ? n.pbStyle.upColorProjection.value() : n.pbStyle.upColor.value(), s = e ? n .pbStyle.downColorProjection.value() : n.pbStyle.downColor.value(), a = e ? n .pbStyle.borderUpColorProjection.value() : n.pbStyle.borderUpColor.value(), l = e ? n.pbStyle.borderDownColorProjection.value() : n.pbStyle.borderDownColor.value(), i .barColor = p ? r : s, i.barBorderColor = p ? a : l, i.isBarUp = p; break; case TradingView.Series.STYLE_KAGI: i.upColor = e ? n.kagiStyle.upColorProjection.value() : n.kagiStyle.upColor.value(), i .downColor = e ? n.kagiStyle.downColorProjection.value() : n.kagiStyle.downColor .value(), _ = null, c = this.findBar(t, e, o), c[TradingView.LOW_PLOT] < c[ TradingView.ADT_PLOT] && c[TradingView.ADT_PLOT] < c[TradingView.HIGH_PLOT] ? ( _ = c[TradingView.OPEN_PLOT] <= c[TradingView.CLOSE_PLOT], i.isTwoColorBar = !0) : (_ = c[TradingView.OPEN_PLOT] <= c[TradingView .CLOSE_PLOT] ? c[TradingView.OPEN_PLOT] === c[TradingView.ADT_PLOT] : c[ TradingView.OPEN_PLOT] !== c[TradingView.ADT_PLOT], i.isTwoColorBar = !1), i .barColor = _ ? i.upColor : i.downColor, i.isBarUp = c[TradingView.OPEN_PLOT] <= c[ TradingView.CLOSE_PLOT]; break; case TradingView.Series.STYLE_PNF: c = this.findBar(t, e, o), p = c[TradingView.ADT_PLOT] > 0, r = e ? n.pnfStyle .upColorProjection.value() : n.pnfStyle.upColor.value(), s = e ? n.pnfStyle .downColorProjection.value() : n.pnfStyle.downColor.value(), i.isBarUp = p, i .barColor = p ? r : s; break; case TradingView.Series.STYLE_BASELINE: c = this.findBar(t, e, o), f = n.baselineStyle, m = this._series.priceScale(), g = Math .round(m.height() * (Math.abs(100 - f.baseLevelPercentage.value()) / 100)), v = m .coordinateToPrice(g), c[TradingView.CLOSE_PLOT] > v ? i.barColor = n.baselineStyle .topLineColor.value() : i.barColor = n.baselineStyle.bottomLineColor.value() } return i }, n.prototype.getSeriesBars = function(t) { return t ? this._series.nsBars() : this._series.bars() }, n.prototype._findBarFieldValue = function(t, e, i) { var o = this.getSeriesBars(i).valueAt(t); if (null !== o) return o[e] }, n.prototype.findBar = function(t, e, i) { return i ? i.value : this.getSeriesBars(e).valueAt(t) || [] }, n.prototype.findPrevBar = function(t, e, i) { var o, n; return i && i.previousValue ? i.previousValue : (o = this._series.bars(), n = o._search(t, s .Exact), null !== n && n > 0 ? this._series.bars()._valueAt(n - 1) : []) }, inherit(r, o), r.prototype.applyBarStyle = function(t, e, i) { var o, n, r, s, a, l, c, h, u, d, p, _, f; return i || (i = {}), e ? i : (o = this._study.properties(), o.visible.value() ? (n = this ._study.metaInfo(), (r = this._study.data()) && 0 !== r.size() ? (s = n.plots[this ._plotIndex], this._study.getMinFirstBarIndexForPlot(s.id) > t ? i : (a = o .styles[s.id], a.visible && !a.visible.value() ? i : (l = this._study .offset(s.id), null === (c = r.valueAt(t - l)) ? i : null == (h = c[this ._plotIndex + 1]) ? i : (h = Math.round(h), u = n.plots[this ._plotIndex].palette, d = o.palettes, p = d[u], _ = n.palettes[ u].valToIndex ? n.palettes[u].valToIndex[h] : h, f = p.colors[_] .color.value(), i.barColor = f, i.upColor = f.color, i.downColor = f .color, i)))) : i) : i) }, e.SeriesBarColorer = n, e.StudyBarColorer = r }, function(t, e, i) { "use strict"; function o(t) { this.items = t.items, this.barSpacing = t.barSpacing, this.colorUp = t.colorup, this.colorDn = t .colordown, this.colorBorderUp = t.colorBorderUp, this.colorBorderDown = t.colorBorderDown, this .width = this._calculateWidth(t.barSpacing), this.minHeight = t.minHeight, this.vertOffset = this._calculateVerticalOffset(t.barSpacing) } function n(t, e, i, o) { this.x = t, this.y = e, this.height = i, this.isUp = o } var r = i(8).Point, s = i(11); o.prototype._calculateVerticalOffset = function(t) { return Math.round((t || 0) / 4) }, o.prototype._calculateMinHeight = function(t) { return this.width || this._calculateWidth(t) }, o.prototype._calculateWidth = function(t) { var t = t || this.barSpacing; return Math.round(t / 2) }, o.prototype.draw = function(t) { var e, i, o, n, r, s, a, l = this.width, c = l < 4, h = Math.max(parseInt(l / 2), 1), u = Math.round(this.width / 2), d = Math.round(this.width); for (t.translate(1, 1), e = 0, i = this.items.length; e < i; e++) o = this.items[e], n = o .isUp ? -1 : 1, r = Math.abs(o.height), s = o.y - n * this.vertOffset, t.beginPath(), t.translate(o.x, s), c ? (t.moveTo(0, 0), t.lineTo(-u, -u * n), t.moveTo(0, 0), t.lineTo(u, -u * n), t.moveTo(0, 0), t.lineTo(0, -r * n), t.moveTo(-u, -r * n), t.lineTo(u, -r * n), t.lineWidth = h, t.strokeStyle = o.isUp ? this.colorUp : this.colorDn, t .stroke()) : (t.moveTo(0, 0), r < d ? (t.lineTo(l, -r * n), t.lineTo(-l, -r * n)) : (t .lineTo(l, -d * n), t.lineTo(u, -d * n), t.lineTo(u, -r * n), t.lineTo(-u, -r * n), t.lineTo(-u, -d * n), t.lineTo(-l, -d * n)), t.lineTo(0, 0), a = o.isUp ? this .colorBorderUp : this.colorBorderDown, t.strokeStyle = a, t.stroke(), t.fillStyle = o .isUp ? this.colorUp : this.colorDn, t.fill()), t.translate(-o.x, -s); t.translate(-1, -1) }, o.prototype.hitTest = function(t) { var e, i, o, n, r, a, l, c, h, u = Math.round(this.width / 2), d = Math.round(this.width); for (e = 0; e < this.items.length; ++e) if ((i = this.items[e]) && void 0 !== i.x && null !== i.x && !TradingView.isNaN(i.x) && void 0 !== i.y && null !== i.y && !TradingView.isNaN(i.y) && (o = Math.abs(i.height), n = i.isUp ? -1 : 1, r = o + d, a = i.y - n * this.vertOffset, l = a - n * r, c = i .x - u, h = i.x + u, c < t.x && t.x < h && (i.isUp ? a < t.y && t.y < l : l < t.y && t.y < a))) return new s(s.REGULAR); return null }, inherit(n, r), e.PaneRendererArrowsUpDown = TradingView.PaneRendererArrowsUpDown = o, e .PaneRendererArrowsUpDownItem = TradingView.PaneRendererArrowsUpDownItem = n }, function(t, e, i) { "use strict"; function o(t) { this._graphics = o.emptyGraphics(), n(!!t, "Study metaInfo is absent!"), this._metaInfo = t } var n = i(9).assert, r = i(7).getLogger("Chart.StudyGraphics"); o.emptyGraphics = function() { return { indexes: [] } }, o.prototype.isEmpty = function() { var t = Object.keys(this._graphics).length > 1; return 0 === this._graphics.indexes.length && !t }, o.prototype.graphics = function() { return this._graphics }, o.prototype.setGraphics = function(t) { this._graphics = t, this._postProcessGraphicsData() }, o.prototype.process = function(t) { if ("" !== t.d) return t.d.indexes_replace ? void this.replaceIndexes(t) : void(t.d .graphicsCmds && (this.processEraseCmds(t.d.graphicsCmds.erase), this .processCreateCmds(t.d.graphicsCmds.create, t.indexes))) }, o.prototype.replaceIndexes = function(t) { "" !== t.d && (n(!!t.d.indexes_replace), this._graphics.indexes = t.indexes) }, o.prototype.processEraseCmds = function(t) { var e, i, r, s, a; if (t) for (n(!!this._graphics, "_graphics object doesn't exist in the study!"), n(!!this._graphics .indexes, "_graphics.indexes array doesn't exist in the study!"), e = 0; e < t .length; ++e) if (i = t[e], "all" === i.action) this._graphics = o.emptyGraphics(); else { if ("one" !== i.action) throw Error("Unknown graphics command " + i.action); for (r in this._graphics[i.type]) s = this._graphics[i.type][r], (a = o ._findGraphicsObjIndexById(s.data, i.id)) >= 0 && s.data.splice(a, 1) } }, o._findGraphicsObjIndexById = function(t, e) { for (var i = 0; i < t.length; ++i) if (t[i].id === e) return i; return -1 }, o.prototype.processCreateCmds = function(t, e) { var i, o, r, s, a, l; if (t) { n(!!e, "indexes are missing in the study nonseries response!"), n(!!this._graphics, "_graphics object doesn't exist in the study!"), n(!!this._graphics.indexes, "_graphics.indexes array doesn't exist in the study!"); for (i in t) { n(i in this._metaInfo.graphics, "There is a '" + i + "' in study response, but it doesn't present in metaInfo!"); for (o = 0; o < t[i].length; ++o) { r = t[i][o], s = r.styleId, n(s in this._metaInfo.graphics[i]), this._graphics[i] || (this._graphics[ i] = []), a = null; for (l = 0; l < this._graphics[i].length; ++l) if (this._graphics[i][l].styleId === s) { a = this._graphics[i][l]; break } null === a && (a = { styleId: s, data: [] }, this._graphics[i].push(a)), a.data = a.data.concat(r.data) } } "nochange" === e || (n(Array.isArray(e)), this._graphics.indexes = e), this ._postProcessGraphicsData() } }, o.prototype._postProcessGraphicsData = function() { this._graphics && this._splitHHistItems() }, o.prototype._splitHHistItems = function() { var t, e, i, n, r, s, a, l, c, h, u, d; if (void 0 !== this._graphics.hhists) { for (t in this._graphics.hhists) e = this._graphics.hhists[t], o._sortHHistItemsByPrice(e .data), i = this._graphics.indexes, e.dataObj = o._splitHHistItemsBySession(e.data, i); if (n = this._graphics.hhists[0], r = this._graphics.hhists[1], n && r && n.dataObj && r .dataObj) for (s in n.dataObj) if (a = n.dataObj[s], l = r.dataObj[s], a && l) { for (c = l[0], h = l[l.length - 1], u = 0; u < a.length; u++) d = a[u], (d .priceHigh >= c.priceHigh || d.priceLow >= c.priceLow) && (d .priceHigh <= h.priceHigh || d.priceLow <= h.priceLow) && (d.va = !0); n.shortDataObj || (n.shortDataObj = {}), n.shortDataObj[s] = a.slice() } } }, o._sortHHistItemsByPrice = function(t) { t.sort(function(t, e) { return t.priceLow - e.priceLow }) }, o._splitHHistItemsBySession = function(t, e) { var i, o, n, s = {}; for (i = 0; i < t.length; ++i) o = t[i], n = e[o.firstBarTime], void 0 !== n ? (n in s || (s[ n] = []), s[n].push(o)) : r.logError("Cannot find index " + o.firstBarTime + " in study timescale indexes"); return s }, t.exports = o }, function(t, e, i) { "use strict"; function o() {} var n = i(9).assert, r = i(57), s = i(870); o.isValid = function(t) { return !(!r[t] && !s[t]) }, o.create = function(t, e, i, a, l) { var c; return n(o.isValid(t), "Unknown line tool: " + t), c = r[t] || s[t], "LineToolVbPFixed" === t ? new c(e, i, a, l) : "LineToolRegressionTrend" === t ? new c(e, i, a) : [ "LineStudyMtpAnalysis", "LineStudyMtpDecisionPoint", "LineStudyMtpRiskReward", "LineStudyMtpElliotWaveMain", "LineStudyMtpElliotWaveMajor", "LineStudyMtpElliotWaveMinor", "LineStudyMtpDownWave1OrA", "LineStudyMtpDownWave2OrB", "LineStudyMtpDownWave3", "LineStudyMtpDownWave4", "LineStudyMtpDownWave5", "LineStudyMtpDownWaveC", "LineStudyMtpUpWave1OrA", "LineStudyMtpUpWave2OrB", "LineStudyMtpUpWave3", "LineStudyMtpUpWave4", "LineStudyMtpUpWave5", "LineStudyMtpUpWaveC" ].indexOf(t) >= 0 ? new c(e, i, a) : new c(e, i) }, t.exports = o }, function(t, e, i) { "use strict"; var o, n, r, s, a; Object.defineProperty(e, "__esModule", { value: !0 }), o = i(0), n = i(9), r = i(67), s = i(15), a = function(t) { function e(e, i) { var o = t.call(this) || this; return o._activeBackground = "#0F6DBF", o._background = "#5592C9", o._active = !1, o ._source = e, o._data = i, o } return o.__extends(e, t), e.prototype.setActive = function(t) { this._active = t }, e.prototype.setBackground = function(t) { this._background = t }, e.prototype._updateRendererData = function(t) { var e, i, o, r, a, l, c, h; if (t.visible = !1, e = this._source.model(), e.timeScale() && !e.timeScale() .isEmpty() && null !== (i = this._source.priceScale()) && !i.isEmpty() && (e .selectedSource() === this._source || this._source.isForcedDrawPriceAxisLabel() ) && null !== e.timeScale().visibleBars() && (o = this._source.axisPoints(), r = this._data.pointIndex, !(o.length <= r) && (a = o[r], isFinite(a.price)))) { if (i.isPercent()) { if (!(l = this._source.ownerSource())) return; if (c = l.firstValue(), !s.isNumber(c)) return; a.price = n.ensureNotNull(i.priceRange()).convertToPercent(a.price, c) } h = this._active ? this._activeBackground : this._background, this._data .backgroundProperty && (h = this._data.backgroundProperty.value()), t .background = h, t.borderColor = "#2E84A6", t.color = this.generateTextColor(h), t.coordinate = i.priceToCoordinate(a.price), t.text = i.formatter().format(a .price), t.visible = !0 } }, e }(r.PriceAxisView), e.LineToolPriceAxisView = a }, function(t, e, i) { "use strict"; var o, n; Object.defineProperty(e, "__esModule", { value: !0 }), o = i(32), n = function() { function t() { this._text = "", this._background = "#585858", this._coordinate = 0 } return t.prototype.text = function() { return this._text }, t.prototype.background = function() { return this._background }, t.prototype.color = function() { return "black" === o.rgbToBlackWhiteString(o.parseRgb(this._background), 150) ? "white" : "black" }, t.prototype.coordinate = function() { return this._coordinate }, t }(), e.TimeAxisView = n }, function(t, e, i) { "use strict"; function o() { this._data = null } var n = /[1-9]/g; o.prototype.setData = function(t) { this._data = t }, o.prototype.draw = function(t, e) { var i, o, r, s, a, l, c, h, u, d, p, _, f, m, g, v, y, b, S; null != this._data && !1 !== this._data.visible && 0 !== this._data.text.length && (t.font = e .font, (i = Math.round(e.widthCache.measureText(t, this._data.text, n))) <= 0 || (o = e .paddingHorizontal, r = i + 2 * o, s = r / 2, a = this._data.width, l = this._data .coordinate, c = Math.floor(l - s) + .5, c < 0 ? (l += Math.abs(0 - c), c = Math .floor(l - s) + .5) : c + r > a && (l -= Math.abs(a - (c + r)), c = Math.floor( l - s) + .5), h = c, u = h + r, d = u, p = Math.round(this._data.coordinate + 1), _ = p, f = .5, m = f + e.borderSize + e.tickLength + e.paddingTop + e .fontSize + e.paddingBottom, g = m, v = f, y = v, b = y + e.borderSize + e.tickLength, S = m - e .baselineOffset - e.paddingBottom, t.fillStyle = this._data.background, t .lineWidth = 1, t.beginPath(), t.strokeStyle = this._data.color, t.moveTo(c, f), t .lineTo(h, m), t.lineTo(u, g), t.lineTo(d, v), t.fill(), t.beginPath(), t.moveTo(p, y), t.lineTo(_, b), t.stroke(), t.textAlign = "left", t.fillStyle = this._data .color, t.fillText(this._data.text, c + o, S))) }, t.exports = o }, function(t, e, i) { "use strict"; function o(t, e) { this.customization = { forcePriceAxisLabel: !0, disableSelection: !0, disableErasing: !0 }, n.call(this, t, e) } var n = i(1).LineDataSource; inherit(o, n), o.POINTS_COUNT = 1, o.prototype.pointsCount = function() { return o.POINTS_COUNT }, o.prototype.hasContextMenu = function() { return !1 }, o.prototype.state = function() { return null }, o.prototype.startMoving = function() { n.prototype.startMoving.apply(this, arguments), this._cursorMoved = !1 }, o.prototype.endMoving = function() { n.prototype.endMoving.apply(this, arguments), this._cursorMoved = !1 }, o.prototype.correctPoints = function(t) { var e, i, o, n, r; for (this._currentMovingPoint && this._startMovingPoint ? this._currentMovingPoint.price - this ._startMovingPoint.price && (this._cursorMoved = !0) : this._cursorMoved = !1, e = this .priceScale(), i = e.mainSource().base(), o = 1 / i, n = 0; n < t.length; n++) r = t[n], this._cursorMoved && (r.price = this._currentMovingPoint.price), r.price = o * Math.round(r .price / o), t[n] = r }, o.prototype.userEditEnabled = function() { return !0 }, o.prototype.canBeHidden = function() { return !1 }, o.prototype.isUserDeletable = function() { return !1 }, o.prototype.showInObjectTree = function() { return !1 }, o.prototype.getInputsPropertyPage = function() { return null }, t.exports = o }, function(t, e, i) { "use strict"; (function(t) { function o(e, n) { var r, s, c, d, p, _, f, m, g, v, y = n || new h("linetoolriskreward"); a.call(this, e, y), this._properties.addExclusion && (this._properties.addExclusion( "stopLevel"), this._properties.addExclusion("profitLevel")), n.stopLevel || n .profitLevel || (r = e.timeScale().visibleBars(), s = r.firstBar(), c = r.lastBar(), d = e.mainSeries().priceRange(s, c), p = e.mainSeries().priceScale(), p.isLog() && (_ = p.logicalToPrice(d.minValue()), f = p.logicalToPrice(d.maxValue()), d = new t(_, f)), p.isPercent() && (m = e.mainSeries().firstValue(), _ = p.priceRange() .convertFromPercent(d.minValue(), m), f = p.priceRange().convertFromPercent(d .maxValue(), m), d = new t(_, f)), d && !d.isEmpty() && (g = Math.round(.2 * d.length() * e.mainSeries().base()), y.merge({ stopLevel: g, profitLevel: g }))), v = this, y.stopLevel.listeners().subscribe(this, this.recalculate), y .stopLevel.listeners().subscribe(null, function() { v.properties().stopPrice._listeners.fire(v.properties().stopPrice) }), y.profitLevel.listeners().subscribe(this, this.recalculate), y.profitLevel .listeners().subscribe(null, function() { v.properties().targetPrice._listeners.fire(v.properties().targetPrice) }), y.addChild("entryPrice", new o.PriceProperty(this, 0)), y.addChild("stopPrice", new o.StopPriceProperty(this)), y.addChild("targetPrice", new o.TargetPriceProperty( this)), y.addProperty("riskSize", 250), y.addProperty("qty", 0), y.addProperty( "amountTarget", y.accountSize.value()), y.addProperty("amountStop", y.accountSize .value()), this._riskInPercentsFormatter = new u(2), this._riskInMoneyFormatter = new u, y.risk.subscribe(this, this._recalculateRiskSize), y.accountSize.subscribe(this, this._recalculateRiskSize), y.riskDisplayMode.subscribe(this, this ._recalculateRisk), y.riskDisplayMode.subscribe(this, this._recalculateRiskSize), y .entryPrice.subscribe(this, this._recalculateRiskSize), y.stopPrice.subscribe(this, this ._recalculateRiskSize), y.profitLevel.subscribe(this, this._recalculateRiskSize), y .stopLevel.subscribe(this, this._recalculateRiskSize), y.qty.subscribe(this, this ._recalculateRiskSize), "percents" === y.riskDisplayMode.value() && y.risk.value() > 100 && y.riskDisplayMode.setValueSilently("money"), this._syncStateExclusions = [ "entryPrice", "stopPrice", "targetPrice", "riskSize", "qty", "amountTarget", "amountStop", "risk", "accountSize" ], this.version = o.version, this._entryPriceAxisView = new l(this, { colorProperty: y.linecolor, priceProperty: y.entryPrice }), this._stopPriceAxisView = new l(this, { colorProperty: y.stopBackground, priceProperty: y.stopPrice }), this._profitPriceAxisView = new l(this, { colorProperty: y.profitBackground, priceProperty: y.targetPrice }), i.e(1).then(function(t) { var e = i(1170).RiskRewardPaneView; this._setPaneViews([new e(this, this._model)]) }.bind(this).bind(null, i)).catch(i.oe) } function n(t, e) { var i, n; this._constructor = "LineToolRiskRewardShort", i = e || new h("linetoolriskrewardshort"), o .call(this, t, i), n = this.properties(), n.entryPrice.subscribe(this, this._recalculateQty), n.stopPrice.subscribe(this, this ._recalculateQty), n.riskSize.subscribe(this, this._recalculateQty), n.entryPrice .subscribe(this, this._recalculateAmount), n.profitLevel.subscribe(this, this ._recalculateAmount), n.stopLevel.subscribe(this, this._recalculateAmount), n .accountSize.subscribe(this, this._recalculateAmount), n.riskSize.subscribe(this, this ._recalculateAmount), n.qty.subscribe(this, this._recalculateAmount) } function r(t, e) { var i, n; this._constructor = "LineToolRiskRewardLong", i = e || new h("linetoolriskrewardlong"), o .call(this, t, i), n = this.properties(), n.entryPrice.subscribe(this, this ._recalculateQty), n.stopPrice.subscribe(this, this._recalculateQty), n.riskSize .subscribe(this, this._recalculateQty), n.entryPrice.subscribe(this, this ._recalculateAmount), n.profitLevel.subscribe(this, this._recalculateAmount), n .stopLevel.subscribe(this, this._recalculateAmount), n.accountSize.subscribe(this, this ._recalculateAmount), n.riskSize.subscribe(this, this._recalculateAmount), n.qty .subscribe(this, this._recalculateAmount) } var s = i(9).ensureNotNull, a = i(1).LineDataSource, l = i(843).LineToolRiskRewardPriceAxisView, c = i(26), h = i(6).DefaultProperty, u = i(89).NumericFormatter, d = i(3).propertyPages, p = i(408).RiskRewardPointIndex; inherit(o, a), o.prototype.riskFormatter = function(t) { return "percents" === t ? this._riskInPercentsFormatter : this._riskInMoneyFormatter }, o.prototype.getRiskStep = function(t) { return "percents" === t ? .01 : 1 }, o.prototype._roundValue = function(t) { return parseFloat(t.toFixed(2)) }, o.prototype._recalculateRisk = function() { var t = this.properties(), e = t.riskDisplayMode.value(), i = t.riskSize.value(), o = t.accountSize.value(), n = t.risk.value(); n = "percents" === e ? this._roundValue(i / o * 100) : this._roundValue(o / 100 * n), this._riskInChange = !0, t.risk.setValue(this.riskFormatter(e).format(n)), this ._riskInChange = !1 }, o.prototype._recalculateRiskSize = function() { var t, e, i, o; this._riskInChange || (t = this.properties(), e = t.risk.value(), i = t.riskDisplayMode .value(), o = t.accountSize.value(), "percents" === i ? t.riskSize.setValue(e / 100 * o) : e > o ? (t.risk.setValue(o), t.riskSize.setValue(o)) : t.riskSize .setValue(e)) }, o.version = 2, o.prototype.i18nCache = { title: $.t("Risk/Reward") }, o.prototype.lastBarData = function() { var t, e, i, o, n, r = this._model.mainSeries().bars().firstIndex(), a = this._model.mainSeries().bars().lastIndex(); return null === r || null === a || isNaN(r) || isNaN(a) ? null : (t = this.points(), 4 === t.length ? (e = t[p.ActualClose], e.index < r ? null : { closePrice: e.price, index: Math.min(a, e.index) }) : (i = t[p.Close], i.index < r ? null : (o = Math.min(a, i.index), n = s(this ._model.mainSeries().bars().valueAt(o)), { closePrice: n[TradingView.CLOSE_PLOT], index: o }))) }, o.prototype.migrateVersion = function(t, e, i) { var o, n, r, s; 1 === t && this._points.length >= 1 && (o = [], o.push(this._points[0]), n = this ._points[0], n = { price: n.price, index: n.index + 50 }, o.push(n), this._points[1] && o.push(this._points[1]), this._points[2] && o .push(this._points[2]), this._points = o, this._timePoint.length >= 1 && ( r = [], n = this._timePoint[0], r.push(n), s = { price: n.price, time_t: n.time_t, offset: n.offset + 50 }, r.push(s), this._timePoint[1] && o.push(this._points[1]), this._timePoint[2] && o.push( this._points[2]), this._timePoint = r)) }, o.prototype.checkAlert = function() { this.recalculate() }, o.prototype.priceAxisViews = function(t, e) { return this.isSourceHidden() ? null : e !== this.priceScale() || this._model .paneForSource(this) !== t ? null : [this._entryPriceAxisView, this ._stopPriceAxisView, this._profitPriceAxisView ] }, o.prototype.updateAllViews = function() { this.isActualSymbol() && this._properties.visible.value() && (c.hideAllDrawings() .value() && this.userEditEnabled() || (a.prototype.updateAllViews.call(this), this._entryPriceAxisView.update(), this._stopPriceAxisView.update(), this ._profitPriceAxisView.update())) }, o.prototype.setPoint = function(t, e) { var i, o = this.priceScale(); switch (o.isPercent() && (i = this.ownerSource().firstValue(), e.price = o.priceRange() .convertFromPercent(e.price, i)), t) { case 0: e.price = this._roundPrice(e.price), o.isPercent() && (e.price = o.priceRange() .convertToPercent(e.price, i)), a.prototype.setPoint.call(this, t, e), this.recalculate(); break; case 1: this.isActualSymbol() && this.properties().stopPrice.setValue(this .preparseStopPrice(e.price)); break; case 2: this.isActualSymbol() && this.properties().targetPrice.setValue(this .preparseProfitPrice(e.price)); break; case 3: e.price = this._roundPrice(e.price), o.isPercent() && (e.price = o.priceRange() .convertToPercent(e.price, i)), a.prototype.setPoint.call(this, 1, e), this.recalculate() } }, o.PriceProperty = function(t, e) { a.PointPriceProperty.call(this, t, e) }, inherit(o.PriceProperty, a.PointPriceProperty), o.PriceProperty.prototype.setValue = function(t) { var e = this._lineSource.points()[this._pointIndex]; e.price = parseFloat(t), this._lineSource.setPoint(this._pointIndex, e), this ._lineSource.recalculate(), this._lineSource._model.updateSource(this._lineSource), this._listeners.fire(this), this._lineSource.endChanging(), this._lineSource ._syncMultichartState() }, o.StopPriceProperty = function(t) { o.PriceProperty.call(this, t, 1) }, inherit(o.StopPriceProperty, o.PriceProperty), o.StopPriceProperty.prototype.value = function() { var t = this._lineSource.stopPrice(), e = this._lineSource.ownerSource().formatter(), i = e.parse(e.format(t)); return i.price ? i.price : i.value }, o.StopPriceProperty.prototype.setValue = function(t) { var e = Math.round(Math.abs(t - this._lineSource.entryPrice()) * this._lineSource._model .mainSeries().base()); this._lineSource.properties().stopLevel.setValue(e), this._lineSource.properties() .stopLevel.listeners().fire(this._lineSource.properties().stopLevel) }, o.TargetPriceProperty = function(t) { o.PriceProperty.call(this, t, 2) }, inherit(o.TargetPriceProperty, o.PriceProperty), o.TargetPriceProperty.prototype.value = function() { var t = this._lineSource.profitPrice(), e = this._lineSource.ownerSource().formatter(), i = e.parse(e.format(t)); return i.price ? i.price : i.value }, o.TargetPriceProperty.prototype.setValue = function(t) { var e = Math.round(Math.abs(t - this._lineSource.entryPrice()) * this._lineSource._model .mainSeries().base()); this._lineSource.properties().profitLevel.setValue(e), this._lineSource.properties() .profitLevel.listeners().fire(this._lineSource.properties().profitLevel) }, o.prototype.pointsCount = function() { return 1 }, o.prototype.title = function() { return this.i18nCache.title }, o.prototype.addPoint = function(t) { var e, i; return t.price = this._roundPrice(t.price), a.prototype.addPoint.call(this, t, null, ! 0), e = { price: t.price, index: t.index + 50 }, a.prototype._addPointIntenal.call(this, e, null, !0), i = this .calculateActualEntry(t, e), i && (a.prototype._addPointIntenal.call(this, i, null, !0), (e = this.findClosePoint(i, e)) && a.prototype._addPointIntenal.call( this, e, null, !0)), this._lastPoint = null, this.normalizePoints(), this .createServerPoints(), !0 }, o.prototype._roundPrice = function(t) { var e = this._model.mainSeries().base(); return Math.round(t * e) / e }, o.prototype.recalculate = function() { var t, e, i, o, n; this.properties().interval.value() === this._model.mainSeries().interval() && 0 !== this .points().length && (t = this.properties().targetPrice.value(), e = this .properties().stopPrice.value(), i = [this._points[0], this._points[1]], o = this.calculateActualEntry(this.points()[0], this.points()[1]), o && (i.push(o), (n = this.findClosePoint(o, this.points()[1])) && i.push(n)), this._points = i, t !== this.properties().targetPrice.value() && this.properties().targetPrice ._listeners.fire(this.properties().targetPrice), e !== this.properties() .stopPrice.value() && this.properties().stopPrice._listeners.fire(this .properties().stopPrice)) }, o.prototype.start = function() { a.prototype.start.call(this), this.recalculate() }, o.prototype.startMoving = function(t) { t.price = this._roundPrice(t.price), a.prototype.startMoving.call(this, t) }, o.prototype.move = function(t) { t.price = this._roundPrice(t.price), a.prototype.move.call(this, t), this.recalculate(), this._entryPriceAxisView.update() }, o.prototype.correctPoints = function(t) { return !!this.isActualSymbol() && a.prototype.correctPoints.call(this, [t[0], t[1]]) }, o.prototype.entryPrice = function() { return this.points()[0].price }, o.prototype.findClosePoint = function(t, e) { var i, o, n, r = this._model.mainSeries().bars(), a = s(r.firstIndex()), l = Math.max(t.index, a), c = s(r.lastIndex()); for (i = l; i <= Math.min(c, e.index); i++) if (o = s(r.valueAt(i)), null != (n = this.checkStopPrice(o))) return { index: i, price: n }; return null }, o.prototype.calculateActualEntry = function(t, e) { var i, o, n = this._model.mainSeries().bars(), r = s(n.firstIndex()), a = Math.max(t.index, r), l = t.price, c = s(n.lastIndex()); for (i = a; i <= Math.min(c, e.index); i++) if (o = s(n.valueAt(i)), o[TradingView.HIGH_PLOT] >= l && o[TradingView.LOW_PLOT] <= l) return { index: i, price: l }; return null }, o.prototype.axisPoints = function() { var t, e, i; if (!this._points[p.ActualEntry]) return []; if (t = this._points[p.ActualEntry], e = null, 4 === this._points.length) e = this ._points[p.ActualClose]; else { if (!(i = this.lastBarData())) return []; e = { index: i.index, price: i.closePrice } } return [t, e] }, o.prototype.getInputsPropertyPage = function() { return d.LineToolRiskRewardInputsPropertyPage }, o.prototype.getStylesPropertyPage = function() { return d.LineToolRiskRewardStylesPropertyPage }, inherit(n, o), n.prototype.i18nCache = { title: $.t("Risk/Reward short") }, n.prototype._recalculateQty = function() { var t, e, i, o, n; 0 !== this.points().length && (t = this.properties(), e = t.entryPrice.value(), i = t .stopPrice.value(), o = t.riskSize.value(), n = Math.floor(o / Math.abs(i - e)), t.qty.setValue(n)) }, n.prototype._recalculateAmount = function() { var t, e, i, o, n, r, s, a; 0 !== this.points().length && (t = this.properties(), e = t.accountSize.value(), i = t .entryPrice.value(), o = t.qty.value(), n = t.stopPrice.value(), r = t .targetPrice.value(), s = this._roundValue(e + (i - r) * o), a = this ._roundValue(e - (n - i) * o), t.amountTarget.setValue(s), t.amountStop .setValue(a)) }, n.prototype.title = function() { return this.i18nCache.title }, n.prototype.stopPrice = function() { return this.entryPrice() + this.properties().stopLevel.value() / this._model .mainSeries().base() }, n.prototype.profitPrice = function() { return this.entryPrice() - this.properties().profitLevel.value() / this._model .mainSeries().base() }, n.prototype.calculatePL = function(t) { return this.entryPrice() - t }, n.prototype.preparseStopPrice = function(t) { t = this._roundPrice(t); var e = this.entryPrice() + 1 / this._model.mainSeries().base(); return Math.max(t, e) }, n.prototype.preparseProfitPrice = function(t) { t = this._roundPrice(t); var e = this.entryPrice() - 1 / this._model.mainSeries().base(); return Math.min(t, e) }, n.prototype.checkStopPrice = function(t) { var e = this.stopPrice(), i = this.profitPrice(); return t[TradingView.HIGH_PLOT] >= e ? this.stopPrice() : t[TradingView.LOW_PLOT] <= i ? this.profitPrice() : null }, r.prototype.i18nCache = { title: $.t("Risk/Reward long") }, inherit(r, o), r.prototype._recalculateQty = function() { var t, e, i, o, n; 0 !== this.points().length && (t = this.properties(), e = t.entryPrice.value(), i = t .stopPrice.value(), o = t.riskSize.value(), n = Math.floor(o / Math.abs(e - i)), t.qty.setValue(n)) }, r.prototype._recalculateAmount = function() { var t, e, i, o, n, r, s, a; 0 !== this.points().length && (t = this.properties(), e = t.accountSize.value(), i = t .entryPrice.value(), o = t.qty.value(), n = t.stopPrice.value(), r = t .targetPrice.value(), s = this._roundValue(e + (r - i) * o), a = this ._roundValue(e - (i - n) * o), t.amountTarget.setValue(s), t.amountStop .setValue(a)) }, r.prototype.stopPrice = function() { return this.entryPrice() - this.properties().stopLevel.value() / this._model .mainSeries().base() }, r.prototype.profitPrice = function() { return this.entryPrice() + this.properties().profitLevel.value() / this._model .mainSeries().base() }, r.prototype.calculatePL = function(t) { return t - this.entryPrice() }, r.prototype.preparseStopPrice = function(t) { t = this._roundPrice(t); var e = this.entryPrice() - 1 / this._model.mainSeries().base(); return Math.min(t, e) }, r.prototype.preparseProfitPrice = function(t) { t = this._roundPrice(t); var e = this.entryPrice() + 1 / this._model.mainSeries().base(); return Math.max(t, e) }, r.prototype.checkStopPrice = function(t) { var e = this.stopPrice(), i = this.profitPrice(); return t[TradingView.LOW_PLOT] <= e ? this.stopPrice() : t[TradingView.HIGH_PLOT] >= i ? this.profitPrice() : null }, r.prototype.title = function() { return this.i18nCache.title }, e.LineToolRiskReward = o, e.LineToolRiskRewardLong = r, e.LineToolRiskRewardShort = n }).call(e, i(73)) }, function(t, e, i) { "use strict"; function o(t, e) { this._formatter = t, this._maxSize = e || 50, this._actualSize = 0, this._cache = {}, this ._usageTick = 1, this._oldestTick = 1, this._tick2Labels = {} } o.prototype.format = function(t) { var e, i; return this._cache[t] ? this._cache[t].string : (this._actualSize === this._maxSize && (e = this ._tick2Labels[this._oldestTick], delete this._tick2Labels[this._oldestTick], delete this._cache[e], this._oldestTick++, this._actualSize--), i = this._formatter( t), this._cache[t] = { string: i, tick: this._usageTick }, this._tick2Labels[this._usageTick] = t, this._actualSize++, this._usageTick++, i) }, t.exports = o }, function(t, e, i) { "use strict"; function o(t, e, i) { a.call(this, t, e, i) } function n(t, e, i) { o.call(this, t, e, i) } function r(t, e, i) { o.call(this, t, e, i) } function s(t, e, i) { o.call(this, t, e, i) } var a = i(105).LineStudyMtp; inherit(o, a), o.prototype.pointsCount = function() { return 1 }, o.prototype._studyInputs = function() { var t, e, i = this.points(); return i.length < this.pointsCount() ? null : (t = i[0].index, e = this._model.mainSeries() .bars().valueAt(t), null === e ? null : [this.properties().inputs.displayZoneLabels .value(), 1e3 * e[TradingView.TIME_PLOT] ]) }, inherit(n, o), n.prototype._mtpStudyId = function() { return "mtp_ew_main" }, inherit(r, o), r.prototype._mtpStudyId = function() { return "mtp_ew_major" }, inherit(s, o), s.prototype._mtpStudyId = function() { return "mtp_ew_minor" }, e.LineStudyMtpElliotWaveMinor = s, e.LineStudyMtpElliotWaveMajor = r, e .LineStudyMtpElliotWaveMain = n, e.LineStudyMtpElliotWave = o }, function(t, e, i) { "use strict"; (function(e) { function o(t, i, n) { var r, s; this.m_timeScale = t, r = i.rightAxisProperties.state(), r.autoScale = !0, this .m_rightPriceScale = new c(n.properties().scalesProperties, r), s = i.leftAxisProperties .state(), s.autoScale = !0, this.m_leftPriceScale = new c(n.properties() .scalesProperties, s), this.m_dataSources = [], this.m_height = 0, this.m_width = 0, this.m_mainDataSource = null, this._properties = i, this._model = n, this._tagsChanged = new e, this._leftPriceScaleRatioChanged = new e, this._rightPriceScaleRatioChanged = new e, this._leftPriceScaleRatioChanged.subscribe(this, this ._mainSeriesPaneScaleRatioOnChange), this._rightPriceScaleRatioChanged.subscribe( this, this._mainSeriesPaneScaleRatioOnChange), this.m_timeScale.barSpacingChanged() .subscribe(this, this._recalculatePriceScaleByScaleRatio), this.m_leftPriceScale .internalHeightChanged().subscribe(this, this._recalculatePriceScaleByScaleRatio), this .m_rightPriceScale.internalHeightChanged().subscribe(this, this ._recalculatePriceScaleByScaleRatio), this.m_leftPriceScale.priceRangeChanged() .subscribe(this, this._recalculateTimeScaleByLeftScaleRatio), this.m_rightPriceScale .priceRangeChanged().subscribe(this, this._recalculateTimeScaleByRightScaleRatio), this .m_leftPriceScale.priceRangeChanged().subscribe(this, this ._onLeftPriceScaleSetMinMaxPriceRange), this.m_rightPriceScale.priceRangeChanged() .subscribe(this, this._onRightPriceScaleSetMinMaxPriceRange), this ._lastLeftPriceScaleRatio = h(this.m_timeScale, this.m_leftPriceScale), this ._lastRightPriceScaleRatio = h(this.m_timeScale, this.m_rightPriceScale), i.topMargin .listeners().subscribe(this, o.prototype._updateMargins), i.bottomMargin.listeners() .subscribe(this, o.prototype._updateMargins), this._updateMargins(), this ._stretchFactor = o.DEFAULT_STRETCH_FACTOR, this._isInInsertManyDataSourcesState = !1, this._lastLineDataSourceZOrder = null, this._maximized = !1, this._isMainPane = !1 } var n = i(334).ExecutionsPositionController, r = i(1).LineDataSource, s = i(73), a = i(46).PriceDataSource, l = i(7).getLogger("Chart.Pane"), c = i(229), h = i(160).scaleRatio, u = i(160).priceRangeByScaleRatio, d = i(160).barSpacingByScaleRatio; o.DEFAULT_STRETCH_FACTOR = 1e3, o.PANE_ANIMATION_DURATION = 500, o.sortSourcesPreOrdered = { "Volume@tv-basicstudies": 0, ChartEventsSource: 1, "ESD$TV_DIVIDENDS@tv-scripting": 2, "ESD$TV_SPLITS@tv-scripting": 3, "ESD$TV_EARNINGS@tv-scripting": 4, LineToolOrder: 5, LineToolPosition: 6, LineToolExecution: 7 }, o.prototype.destroy = function() { var t, e; for (this._leftPriceScaleRatioChanged.unsubscribe(this, this ._mainSeriesPaneScaleRatioOnChange), this._rightPriceScaleRatioChanged .unsubscribe(this, this._mainSeriesPaneScaleRatioOnChange), this.m_rightPriceScale .priceRangeChanged().unsubscribe(this, this._recalculateTimeScaleByRightScaleRatio), this.m_leftPriceScale.priceRangeChanged().unsubscribe(this, this ._recalculateTimeScaleByLeftScaleRatio), this.m_timeScale.barSpacingChanged() .unsubscribe(this, this._recalculatePriceScaleByScaleRatio), this.m_leftPriceScale .internalHeightChanged().unsubscribe(this, this._recalculatePriceScaleByScaleRatio), this.m_rightPriceScale.internalHeightChanged().unsubscribe(this, this ._recalculatePriceScaleByScaleRatio), this.m_leftPriceScale.priceRangeChanged() .unsubscribe(this, this._onLeftPriceScaleSetMinMaxPriceRange), this .m_rightPriceScale.priceRangeChanged().unsubscribe(this, this ._onRightPriceScaleSetMinMaxPriceRange), this._properties.topMargin.listeners() .unsubscribe(this, o.prototype._updateMargins), this._properties.bottomMargin .listeners().unsubscribe(this, o.prototype._updateMargins), t = 0; t < this .m_dataSources.length; t++) e = this.m_dataSources[t], e.destroy && e.destroy() }, o.prototype.setPaneSize = function(t) { var e = { large: 1, medium: .6, small: .3, tiny: .15 }; if (!e[t]) throw Error("Unknown size enum value: " + t); this._stretchFactor = e[t] * o.DEFAULT_STRETCH_FACTOR }, o.sortSources = function(t) { return t.map(function(t) { var e, i, n = t._constructor; return isFunction(t.metaInfo) && (n = t.metaInfo().id), i = o .sortSourcesPreOrdered[n] || 0, e = i > 0 ? 1 / 0 : i < 0 ? -1 / 0 : t .zorder(), [t, i, e] }).sort(function(t, e) { return t[1] - e[1] || t[2] - e[2] }).map(function(t) { return t[0] }) }, o.prototype._updateMargins = function() { var t, e, i = .01 * this._properties.topMargin.value(), o = .01 * this._properties.bottomMargin.value(); for (this.m_leftPriceScale.setTopMargin(i), this.m_leftPriceScale.setBottomMargin(o), this.m_rightPriceScale.setTopMargin(i), this.m_rightPriceScale.setBottomMargin(o), t = 0; t < this.m_dataSources.length; t++)(e = this.m_dataSources[ t]) instanceof TradingView.Study && this.isOverlay(e) && "Volume" !== e .metaInfo() .shortId && e.priceScale() && e.priceScale() !== this.m_leftPriceScale && e .priceScale() === this.m_rightPriceScale && (e.priceScale().setTopMargin(i), e .priceScale().setBottomMargin(o), this.recalculatePriceScale(e.priceScale())); this.recalculatePriceScale(this.m_leftPriceScale), this.recalculatePriceScale(this .m_rightPriceScale), this.updateAllViews() }, o.prototype.model = function() { return this._model }, o.prototype.width = function() { return this.m_width }, o.prototype.height = function() { return this.m_height }, o.prototype.setWidth = function(t) { this.m_width = t, this.updateAllViews() }, o.prototype.setHeight = function(t) { var e, i; for (this.m_height = t, this.m_leftPriceScale.setHeight(t), this.m_rightPriceScale .setHeight(t), e = 0; e < this.m_dataSources.length; e++) i = this.m_dataSources[e], this.isOverlay(i) && i.priceScale() && i.priceScale().setHeight(t); this.updateAllViews() }, o.prototype.leftPriceScale = function() { return this.m_leftPriceScale }, o.prototype.rightPriceScale = function() { return this.m_rightPriceScale }, o.prototype.timeScale = function() { return this.m_timeScale }, o.prototype.dataSources = function() { return this.m_dataSources }, o.prototype.isOverlay = function(t) { return t._isOverlay }, o.prototype._processMainSourceChange = function() { var t, e, i, n, s, l, c; if (null === this.m_mainDataSource) for (e = 0; e < this.m_dataSources.length; e++) if (i = this.m_dataSources[e], TradingView.isInherited(i.constructor, a) && ! this.isOverlay(i) && (!i.properties().linkedToSeries || !i.properties() .linkedToSeries.value())) { this.m_mainDataSource = i, t = !0; break } if (this.m_mainDataSource && t) { for (n = [], e = 0; e < this.m_dataSources.length; e++) i = this.m_dataSources[e], TradingView.isInherited(i.constructor, r) && n.push(i); for (n = o.sortSources(n), e = 0; e < n.length; e++) this.move(n[e], this .m_mainDataSource.priceScale(), !0) } else if (!this.m_mainDataSource || this.isOverlay(this.m_mainDataSource) && 0 === this .nonOverlayPricesSourcesCount()) for (e = 0; e < this.m_dataSources.length; e++) if (i = this.m_dataSources[e], TradingView.isInherited(i.constructor, a) && this .isOverlay(i) && i.showInObjectTree()) { for (this.m_mainDataSource = i, this.m_rightPriceScale.addDataSource(i), i .setPriceScale(this.m_rightPriceScale), s = this._model.children(i), c = 0; c < s.length; c++) l = s[c], this.m_rightPriceScale.addDataSource(l), l.setPriceScale(this.m_rightPriceScale), l._isOverlay = !1; this.recalculatePriceScale(this.m_rightPriceScale), i._isOverlay = !1; break } }, o.prototype._newZOrderForLineTool = function() { var t, e, i, o = null; for (t = 0; t < this.m_dataSources.length; ++t)(e = this.m_dataSources[ t]) instanceof r && (i = e.zorder(), (null === o || i > o) && (o = i)); return null === o && (o = this.getZOrderMinMax().minZOrder - 1), this.m_dataSources .forEach(function(t) { t.zorder() > o && t.setZorder(t.zorder() + 1) }), o + 1 }, o.prototype.beginInsertManyLineDataSources = function() { this._isInInsertManyDataSourcesState = !0, this._lastLineDataSourceZOrder = null }, o.prototype.endInsertManyLineDataSources = function() { this._isInInsertManyDataSourcesState = !1, this._lastLineDataSourceZOrder = null }, o.prototype.addDataSource = function(t, e, i) { var o; t instanceof r && !i ? (o = null !== this._lastLineDataSourceZOrder ? this ._lastLineDataSourceZOrder : this._newZOrderForLineTool(), this ._isInInsertManyDataSourcesState && (this._lastLineDataSourceZOrder = o)) : o = this.getZOrderMinMax().minZOrder - 1, this.insertDataSource(t, e, o) }, o.prototype.insertDataSource = function(t, e, i) { var n, r, s; this.m_dataSources.push(t), n = !1, t === this._model.mainSeries() ? (this .m_mainDataSource = t, n = !0) : null === this.m_mainDataSource && (this .m_mainDataSource = t, n = !0), t._isOverlay = !1, null !== e || this.canHaveMoreNoScaleSources() || (e = this.rightPriceScale()), null === e && (r = this.m_rightPriceScale.topMargin(), s = this.m_rightPriceScale .bottomMargin(), t.metaInfo && "Volume@tv-basicstudies" === t.metaInfo().id && ( r = .75, s = 0), e = new c(this._model.properties().scalesProperties), e .setHeight(this.m_height), e.setTopMargin(r), e.setBottomMargin(s), t ._isOverlay = !0), e.addDataSource(t, this._isInInsertManyDataSourcesState), t .setPriceScale(e), t.onTagsChanged && t.onTagsChanged().subscribe(this, o.prototype .onSourceTagsChanged), t.setZorder(i), n && this._processMainSourceChange(), this._tagsChanged.fire(), TradingView.isInherited(t.constructor, a) && this .recalculatePriceScale(e), this.invalidateSourcesCache() }, o.prototype.removeDataSource = function(t, e) { var i, n = this.m_dataSources.indexOf(t); if (-1 === n) return void l.logDebug("removeDataSource: invalid data source"); t._isOverlay = !1, this.m_dataSources.splice(n, 1), t !== this.m_mainDataSource || e || (this.m_mainDataSource = null), i = null, -1 !== this.m_leftPriceScale.dataSources() .indexOf(t) ? (this.m_leftPriceScale.removeDataSource(t), i = this .m_leftPriceScale) : -1 !== this.m_rightPriceScale.dataSources().indexOf(t) && ( this .m_rightPriceScale.removeDataSource(t), i = this.m_rightPriceScale), t .onTagsChanged && t.onTagsChanged().unsubscribe(this, o.prototype .onSourceTagsChanged), TradingView.isInherited(t.constructor, a) && this ._processMainSourceChange(), this._tagsChanged.fire(), i && TradingView.isInherited( t.constructor, a) && this.recalculatePriceScale(i), this .invalidateSourcesCache() }, o.prototype.startScalePrice = function(t, e) { t.startScale(e) }, o.prototype.scalePriceTo = function(t, e) { t.scaleTo(e), this.updateAllViews() }, o.prototype.endScalePrice = function(t) { t.endScale() }, o.prototype.startScrollPrice = function(t, e) { t.startScroll(e) }, o.prototype.scrollPriceTo = function(t, e) { t.scrollTo(e), this.updateAllViews() }, o.prototype.endScrollPrice = function(t) { t.endScroll() }, o.prototype.setPriceAutoScale = function(t, e) { if (t.setAutoScale(e), this.timeScale().isEmpty()) return void t.setPriceRange(null); this.recalculatePriceScale(t) }, o.prototype.restorePriceScaleState = function(t, e) { t.restoreState(e), this.updateAllViews() }, o.prototype.updateAllViews = function() { for (var t = 0; t < this.m_dataSources.length; t++) this.m_dataSources[t] .updateAllViews() }, o.prototype.defaultPriceScale = function() { var t = this.m_mainDataSource ? this.m_mainDataSource.priceScale() : this .rightPriceScale(); return void 0 === t && (t = new c(this._model.properties().scalesProperties)), t }, o.prototype._priceScaleIsPrice = function(t) { var e = t.mainSource(); return !!e && (!!TradingView.isInherited(e.constructor, TradingView.Series) || !! TradingView.isInherited(e.constructor, TradingView.Study) && e.metaInfo() .is_price_study) }, o.prototype.findSuitableScale = function(t) { if (TradingView.isInherited(t.constructor, TradingView.Study) && "Volume@tv-basicstudies" === t.metaInfo().id) return this.m_rightPriceScale .mainSource() || this.m_leftPriceScale.mainSource() ? null : this .m_rightPriceScale; var e = !1; if (TradingView.isInherited(t.constructor, TradingView.Study) ? e = t.metaInfo() .is_price_study : TradingView.isInherited(t.constructor, TradingView.Series) && ( e = !0), e) { if (this._priceScaleIsPrice(this.m_rightPriceScale)) return this.m_rightPriceScale; if (this._priceScaleIsPrice(this.m_leftPriceScale)) return this.m_leftPriceScale } return this.m_rightPriceScale.mainSource() ? this.m_leftPriceScale.mainSource() ? null : this.m_leftPriceScale : this.m_rightPriceScale }, o.prototype.mainDataSource = function() { return this.m_mainDataSource }, o.prototype.recalculatePriceScale = function(t) { var e, i; t && (e = t.sourcesForAutoscale(), t.isAutoScale() && e && e.length > 0 && !this .timeScale().isEmpty() && (i = this.timeScale().visibleBars(), t .recalculatePriceRange(i)), t.updatePaneViews()) }, o.prototype.resetPriceScale = function(t) { var e = this.timeScale().visibleBars(); t.isLockScale() || t.setAutoScale(!0), t.recalculatePriceRange(e), this.updateAllViews() }, o.prototype.recalculate = function() { var t, e; for (this.recalculatePriceScale(this.m_rightPriceScale), this.recalculatePriceScale(this .m_leftPriceScale), t = 0; t < this.m_dataSources.length; t++) e = this .m_dataSources[t], !this.isOverlay(e) || e instanceof r || this .recalculatePriceScale(e.priceScale()); this.updateAllViews(), this._model.updatePane(this) }, o.prototype.isEmpty = function() { return null === this.m_mainDataSource }, o.prototype.move = function(t, e, i) { var o = this.m_dataSources.slice(), n = null !== e; this.removeDataSource(t, n), this.addDataSource(t, e, i), this.m_dataSources = o, this .invalidateSourcesCache() }, o.prototype.dataSourceForId = function(t) { for (var e = 0; e < this.m_dataSources.length; e++) if (this.m_dataSources[e].id() === t) return this.m_dataSources[e]; return null }, o.prototype.priceScaleForSource = function(t) { return -1 !== this.rightPriceScale().dataSources().indexOf(t) ? this.rightPriceScale() : -1 !== this.leftPriceScale().dataSources().indexOf(t) ? this.leftPriceScale() : null }, o.prototype.sourceById = function(t) { for (var e = 0; e < this.m_dataSources.length; e++) if (this.m_dataSources[e].id() === t) return this.m_dataSources[e]; return null }, o.prototype.containsMainSeries = function() { return -1 !== this.m_dataSources.indexOf(this._model.mainSeries()) }, o.prototype.priceScaleByName = function(t) { return "left" === t ? this.m_leftPriceScale : "right" === t ? this.m_rightPriceScale : null }, o.prototype.priceScaleName = function(t) { return t === this.m_leftPriceScale ? "left" : t === this.m_rightPriceScale ? "right" : "" }, o.prototype.hitTestSources = function() { var t, e, i, o, n; if (this._cachedHitTestSources) return this._cachedHitTestSources; for (t = this.orderedSources(), e = [], i = [this._model.crossHairSource()], o = 0; o < t.length; o++) n = t[o], TradingView.isInherited(n.constructor, r) ? e.push(n) : i .push(n); return this._cachedHitTestSources = i.concat(e), this._cachedHitTestSources }, o.prototype.orderedSources = function() { var t, e, i, n; if (this._cachedOrderedSoruces) return this._cachedOrderedSoruces; for (t = [], e = 0, i = this.m_dataSources.length; e < i; e++) n = this.m_dataSources[ e], TradingView.isInherited(n.constructor, r) && !n.isActualSymbol() || t.push( n); return t = o.sortSources(t), this._cachedOrderedSoruces = t, t }, o.prototype.createDrawingsCaches = function() { n.recreateOrderedByBarsSourcesCache(this) }, o.prototype.clearDrawingCaches = function() { n.clearOrderedByBarsSourcesCache() }, o.prototype.invalidateSourcesCache = function() { this._cachedOrderedSoruces = null, this._cachedHitTestSources = null, this .m_leftPriceScale.invalidateSourcesCache(), this.m_rightPriceScale .invalidateSourcesCache() }, o.prototype.getZOrderMinMax = function() { var t, e, i, o, n = this.orderedSources(); if (0 === n.length) return { minZOrder: 0, maxZOrder: 0 }; for (t = n[0].zorder(), e = n[0].zorder(), i = 1; i < n.length; i++) o = n[i], o .zorder() < t && (t = o.zorder()), o.zorder() > e && (e = o.zorder()); return { minZOrder: t, maxZOrder: e } }, o.prototype.isZOrderAvailable = function(t) { var e, i; for (e = 0; e < this.m_dataSources.length; e++) if (i = this.m_dataSources[e], i.zorder() === t) return !1; return !0 }, o.prototype.sendToBack = function(t) { var e, i = this.getZOrderMinMax().minZOrder, o = Math.abs(t.zorder() - i); for (e = 0; e < o; e++) this.changeZOrder(t, -1) }, o.prototype.bringToFront = function(t) { var e, i = this.getZOrderMinMax().maxZOrder, o = Math.abs(t.zorder() - i); for (e = 0; e < o; e++) this.changeZOrder(t, 1) }, o.prototype.changeZOrder = function(t, e) { var i, o, n, r, s, a = this.orderedSources().filter(function(t) { return t.showInObjectTree() }), l = 0; for (i = 0, o = a.length; i < o; i++) if (a[i] === t) { l = i; break } l > 0 && e < 0 ? (n = a[l - 1].zorder(), r = t.zorder(), a[l - 1].setZorder(r), t .setZorder(n)) : l < a.length - 1 && e > 0 && (s = a[l + 1].zorder(), r = t .zorder(), a[l + 1].setZorder(r), t.setZorder(s)), this.invalidateSourcesCache() }, o.prototype.onSourceTagsChanged = function() { this._tagsChanged.fire() }, o.prototype.onTagsChanged = function() { return this._tagsChanged }, o.prototype.dumpPriceScale = function(t) { var e, i, o, n = t.dataSources(), r = []; for (e = 0; e < n.length; e++) if (i = n[e].priceAxisViews(this, t)) for (o = 0; o < i.length; o++) r.push(i[o].dump()); return r }, o.prototype.dumpViews = function() { var t, e, i, o, n, r = {}; for (r.paneViews = {}, t = this.orderedSources(), e = 0; e < t.length; e++) if (i = t[e], r.paneViews[e] = [], o = i.paneViews()) for (n = 0; n < o.size(); n++) r.paneViews[e].push(o.item(e).dump()); return r.leftAxis = this.dumpPriceScale(this.m_leftPriceScale), r.rightAxis = this .dumpPriceScale(this.m_rightPriceScale), r }, o.prototype.clearSeries = function() { for (var t = this.m_dataSources.length - 1; t >= 0; t--) TradingView.isInherited(this .m_dataSources[t].constructor, TradingView.Series) && this.m_dataSources.splice( t, 1) }, o.prototype.nonOverlayPricesSourcesCount = function() { return this.m_dataSources.filter(function(t) { return (!t.properties().linkedToSeries || !t.properties().linkedToSeries .value()) && (TradingView.isInherited(t.constructor, a) && t .showInObjectTree() && !t.isNoScale()) }).length }, o.prototype.canHaveMoreNoScaleSources = function() { return this.nonOverlayPricesSourcesCount() > 1 }, o.prototype.actionNoScaleIsEnabled = function(t) { return !(!this.isOverlay(t) && TradingView.isInherited(t.constructor, a)) || this .canHaveMoreNoScaleSources() }, o.prototype.executionsPositionController = function() { return this._executionsPositionController || (this._executionsPositionController = new n(this, this._model.timeScale())), this._executionsPositionController }, o.prototype.isLast = function() { var t = this._model.panes(); return t[t.length - 1] === this }, o.prototype.setMaximized = function(t) { this._maximized = t }, o.prototype.isMaximized = function() { return this._maximized }, o.prototype.isMainPane = function() { var t = this._model.mainSeries(), e = !1; return this.m_dataSources.forEach(function(i) { e || (e = i === t) }), this._isMainPane = e, e }, o.prototype.properties = function() { return this._properties }, o.prototype._mainSourceVisiblePriceRange = function(t) { var e = this.m_timeScale.visibleBars(); return null !== e ? t.mainSource().priceRange(e.firstBar(), e.lastBar()) : new s(-.5, .5) }, o.prototype.applyLeftPriceScaleRatio = function(t) { this._lastLeftPriceScaleRatio !== t && (this._setNewPriceRangeByScaleRatio(this .m_leftPriceScale, t, this._mainSourceVisiblePriceRange(this .m_leftPriceScale), !0, !0), this._tryToApplyNewLeftPriceScaleRatio(h( this.m_timeScale, this.m_leftPriceScale))) }, o.prototype.applyRightPriceScaleRatio = function(t) { this._lastRightPriceScaleRatio !== t && (this._setNewPriceRangeByScaleRatio(this .m_rightPriceScale, t, this._mainSourceVisiblePriceRange(this .m_rightPriceScale), !0, !0), this._tryToApplyNewRightPriceScaleRatio(h( this.m_timeScale, this.m_rightPriceScale))) }, o.prototype.isLeftPriceScaleLocked = function() { return !this.m_leftPriceScale.isLog() && this.m_leftPriceScale.isLockScale() }, o.prototype.isRightPriceScaleLocked = function() { return !this.m_rightPriceScale.isLog() && this.m_rightPriceScale.isLockScale() }, o.prototype.leftPriceScaleRatio = function() { return null === this._lastLeftPriceScaleRatio && (this._lastLeftPriceScaleRatio = h(this .m_timeScale, this.m_leftPriceScale)), this._lastLeftPriceScaleRatio }, o.prototype.rightPriceScaleRatio = function() { return null === this._lastRightPriceScaleRatio && (this._lastRightPriceScaleRatio = h( this.m_timeScale, this.m_rightPriceScale)), this._lastRightPriceScaleRatio }, o.prototype._mainSeriesPaneScaleRatioOnChange = function() { this.isMainPane() && (this._lastLeftPriceScaleRatio = null, this ._lastRightPriceScaleRatio = null, this._model .mainSeriesScaleRatioPropertyOnChanged()) }, o.prototype._applyOldScaleRatioToPriceScale = function(t, e) { if (this._isRecalculatingScales || null === e || void 0 === e) return !1; this._isRecalculatingScales = !0, this._setNewPriceRangeByScaleRatio(t, e, this ._mainSourceVisiblePriceRange(t)), this._isRecalculatingScales = !1 }, o.prototype._applyOldScaleRatioToTimeScale = function(t, e) { if (this._isRecalculatingScales || null === e || void 0 === e) return !1; this._isRecalculatingScales = !0, this._setNewBarSpacingByScaleRatio(t, e), this ._isRecalculatingScales = !1 }, o.prototype._tryToApplyNewLeftPriceScaleRatio = function(t) { if (this._lastLeftPriceScaleRatio === t) return !1; this._leftPriceScaleRatioChanged.fire(this._lastLeftPriceScaleRatio, t), this ._lastLeftPriceScaleRatio = t }, o.prototype._tryToApplyNewRightPriceScaleRatio = function(t) { if (this._lastRightPriceScaleRatio === t) return !1; this._rightPriceScaleRatioChanged.fire(this._lastRightPriceScaleRatio, t), this ._lastRightPriceScaleRatio = t }, o.prototype._recalculatePriceScaleByScaleRatio = function() { this.isMainPane() && (this.m_leftPriceScale.mainSource() && (this .isLeftPriceScaleLocked() && null !== this._lastLeftPriceScaleRatio ? this ._applyOldScaleRatioToPriceScale(this.m_leftPriceScale, this ._lastLeftPriceScaleRatio) : this._tryToApplyNewLeftPriceScaleRatio(h( this.m_timeScale, this.m_leftPriceScale))), this.m_rightPriceScale .mainSource() && (this.isRightPriceScaleLocked() && null !== this ._lastRightPriceScaleRatio ? this._applyOldScaleRatioToPriceScale(this .m_rightPriceScale, this._lastRightPriceScaleRatio) : this ._tryToApplyNewRightPriceScaleRatio(h(this.m_timeScale, this .m_rightPriceScale)))) }, o.prototype._recalculateTimeScaleByLeftScaleRatio = function() { this.isLeftPriceScaleLocked() && null !== this._lastLeftPriceScaleRatio ? this ._applyOldScaleRatioToTimeScale(this.m_leftPriceScale, this ._lastLeftPriceScaleRatio) : this._tryToApplyNewLeftPriceScaleRatio(h(this .m_timeScale, this.m_leftPriceScale)) }, o.prototype._recalculateTimeScaleByRightScaleRatio = function() { this.isRightPriceScaleLocked() && null !== this._lastRightPriceScaleRatio ? this ._applyOldScaleRatioToTimeScale(this.m_rightPriceScale, this ._lastRightPriceScaleRatio) : this._tryToApplyNewRightPriceScaleRatio(h(this .m_timeScale, this.m_rightPriceScale)) }, o.prototype._setNewPriceRangeByScaleRatio = function(t, e, i, o, n) { var r = u(t, this.m_timeScale.barSpacing(), e); t.setPriceRange(null !== r ? r : i, o, n) }, o.prototype._setMinMaxPriceRange = function(t, e) { var i = u(t, this.m_timeScale.maxBarSpacing(), e), o = u(t, this.m_timeScale.minBarSpacing(), e); null !== i && t.setMaxPriceRange(i), null !== o && t.setMinPriceRange(o) }, o.prototype._onLeftPriceScaleSetMinMaxPriceRange = function() { this._setMinMaxPriceRange(this.m_leftPriceScale, this._lastLeftPriceScaleRatio) }, o.prototype._onRightPriceScaleSetMinMaxPriceRange = function() { this._setMinMaxPriceRange(this.m_rightPriceScale, this._lastRightPriceScaleRatio) }, o.prototype._setNewBarSpacingByScaleRatio = function(t, e) { var i = this.m_timeScale.getValidBarSpacing(d(t, e)); this.m_timeScale.isValidBarSpacing(i) && this.m_timeScale.setBarSpacing(i) }, t.exports = o }).call(e, i(10)) }, function(t, e, i) { "use strict"; (function(e, o) { function n(t, e) { if (this.m_base = t, this.m_integralDividers = e, this.m_fractionalDividers = [], c .isBaseDecimal(this.m_base)) this.m_fractionalDividers = [2, 2.5, 2]; else for (var i = this.m_base; 1 !== i;) { if (i % 2 == 0) this.m_fractionalDividers.push(2), i /= 2; else { if (i % 5 != 0) throw new RangeError("unexpected base"); this.m_fractionalDividers.push(2), this.m_fractionalDividers.push(2.5), i /= 5 } if (this.m_fractionalDividers.length > 100) throw Error("something wrong with base") } } function r(t, e, i) { this.m_marks = [], this.m_base = e, this.m_priceScale = t, this._formatter = i, i && (this ._cache = new h(function(t) { return i.format(t) })), this._currentFormatBase = 0 } function s(t) { for (var e = 1; t * e !== Math.round(t * e);) e *= 10; return e } function a(t, i) { function n() { var t, e, i = s.m_dataSources; for (t = 0; t < i.length; t++) e = i[t], e.priceScaleChanged && e.priceScaleChanged .fire(s) } this._properties = new e(i || l), this._scalesProperties = t, this.m_height = 0, this ._internalHeightCache = null, this._internalHeightChanged = new o, this.m_priceRange = null, this._priceRangeChanged = new o, this.m_dataSources = [], this.m_topMargin = 0, this .m_bottomMargin = 0, this._studyTopMargin = 0, this._studyBottomMargin = 0, this .m_scrollStartPoint = null, this.m_scaleStartPoint = null, this.m_maxPriceRange = null, this.m_minPriceRange = null, this.m_priceRangeSnapshot = null, this ._invalidatedForRange = { isValid: !0 }, this.onMarksChanged = new o, this.m_markBuilder = new r(this, 100, new f(100)), this ._properties.percentage.listeners().subscribe(this, a.prototype.updateFormatter); var s = this; this._properties.log.listeners().subscribe(null, function(t) { var e, i, o, n; s.m_priceRange && (e = s.m_priceRange, t.value() ? (i = new g(s._toLog(e .minValue()), s._toLog(e.maxValue())), s.setPriceRange(i)) : (o = s ._fromLog(e.minValue()), n = s._fromLog(e.maxValue()), isFinite( o) && isFinite(n) ? (i = new g(o, n), s.setPriceRange(i)) : s .properties().autoScale.setValue(!0))) }), this._properties.percentage.listeners().subscribe(null, function() { s._properties.autoScale.setValue(!0) }), this._properties.percentage.listeners().subscribe(null, function() { var t, e, i; s._properties.autoScaleDisabled.setValue(s._properties.percentage.value()), t = s.priceRange(), s.mainSource() && !s.mainSource().model().timeScale() .isEmpty() && !s.mainSource().data().isEmpty() && s.isLockScale() && t && ( e = s.mainSource().model().timeScale().visibleBars(), i = s.mainSource() .data().search(e.firstBar(), _.NearestRight).value[TradingView .CLOSE_PLOT], null != t && void 0 !== i && (s._properties.percentage .value() ? s.setPriceRange(t.convertToPercents(i)) : s .setPriceRange(t.convertFromPercents(i)))) }), this._properties.lockScale.listeners().subscribe(null, function(t) { var e = t.value(); e && (s._properties.autoScale.setValue(!1), s._properties.percentage.setValue(! 1), s._properties.log.setValue(!1)), s._properties.percentageDisabled .setValue(e), s._properties.logDisabled.setValue(e) }), this._sourcesForAutoscale = null, this._sourcesToUpdateViews = null, this ._hasSeries = !1, this._properties.percentage.listeners().subscribe(null, n), this ._properties.log.listeners().subscribe(null, n), this._properties.listeners().subscribe( null, function() { s.mainSource() && s.mainSource().model() && s.mainSource().model().fullUpdate() }) } var l, c = i(54), h = i(226), u = i(1).LineDataSource, d = i(46).PriceDataSource, p = i(77), _ = i(19).PlotRowSearchMode, f = i(28).PriceFormatter, m = i(167).PercentageFormatter, g = i(73); n.prototype.TICK_SPAN_EPSILON = 1e-9, n.prototype.tickSpan = function(t, e, i) { var o, n = 0 === this.m_base ? 0 : 1 / this.m_base, r = this.TICK_SPAN_EPSILON, s = Math.pow(10, Math.max(0, Math.ceil(c.log10(t - e)))), a = 0; for (a = 0, o = this.m_integralDividers[0]; s > n + r && c.greaterOrEqual(s, n, r) && c .greaterOrEqual(s, i * o, r) && c.greaterOrEqual(s, 1, r); ++a, o = this .m_integralDividers[a % this.m_integralDividers.length]) s /= o; if (s <= n + r && (s = n), s = Math.max(1, s), this.m_fractionalDividers.length > 0 && c .equal(s, 1, r)) for (a = 0, o = this.m_fractionalDividers[0]; s > n + r && c.greaterOrEqual(s, i * o, r); ++a, o = this.m_fractionalDividers[a % this.m_fractionalDividers .length]) s /= o; return s }, r.prototype.TICK_DENSITY = 2.5, r.prototype.base = function() { return this.m_base }, r.prototype.setBase = function(t) { if (t < 0) throw new RangeError("base < 0"); this.m_base = t }, r.prototype.fontHeight = function() { return this.m_priceScale.fontSize() }, r.prototype.tickSpan = function(t, e) { var i, o, r, s, a, l, h; if (t < e) throw new RangeError("high < low"); return i = this.m_priceScale.height(), o = this.tickMarkHeight(), r = (t - e) * o / i, s = new n(this.m_base, [2, 2.5, 2]), a = new n(this.m_base, [2, 2, 2.5]), l = new n( this.m_base, [2.5, 2, 2]), h = [], h.push(s.tickSpan(t, e, r)), h.push(a .tickSpan(t, e, r)), h.push(l.tickSpan(t, e, r)), c.min(h) }, r.prototype.tickMarkHeight = function() { return Math.ceil(this.fontHeight() * this.TICK_DENSITY) }, r.prototype.rebuildTickMarks = function() { var t, e, i, o, n, r, a, l, c, u, d, p, _; if (null === this.m_priceScale) throw new TypeError("scale is null"); if (this.m_priceScale.isEmpty()) return void(this.m_marks = []); if (t = this.m_priceScale.height(), e = this.m_priceScale.coordinateToPrice(t - 1), i = this.m_priceScale.coordinateToPrice(0), o = i >= e ? 1 : -1, n = Math.max(i, e), r = Math.min(i, e), i = n, e = r, i !== e) for (a = this.tickSpan(i, e), l = i % a, l += l < 0 ? a : 0, this.m_marks = [], this ._formatter || (c = s(a), this._cache && this._currentFormatBase === c || (u = new f(c), this._cache = new h(function(t) { return u.format(t) }))), d = null, p = i - l; p > e; p -= a) _ = this.m_priceScale .priceToCoordinate(p), null !== d && Math.abs(_ - d) < this.tickMarkHeight() || (this.m_marks.push({ coord: _, label: this._cache.format(p) }), d = _, this.m_priceScale.isLog() && (a = this.tickSpan(p * o, e))) }, r.prototype.marks = function() { return this.m_marks }, l = { autoScale: !0, autoScaleDisabled: !1, lockScale: !1, percentage: !1, percentageDisabled: !1, log: !1, logDisabled: !1, alignLabels: !0 }, a.prototype.isLog = function() { return this._properties.log.value() }, a.prototype.isPercent = function() { return this._properties.percentage.value() }, a.prototype.isPercentage = function() { return this._properties.percentage.value() }, a.prototype.properties = function() { return this._properties }, a.prototype.fontSize = function() { return this._scalesProperties.fontSize.value() }, a.prototype.height = function() { return this.m_height }, a.prototype.setHeight = function(t) { this.m_height !== t && (this.m_height = t, this._invalidateInternalHeightCache(), this ._marksCache = null) }, a.prototype.topMargin = function() { return Math.max(this.m_topMargin, this._studyTopMargin) }, a.prototype.setTopMargin = function(t) { if (!isNumber(t)) throw new TypeError("invalid margin"); if (t < 0 || t > 30) throw new RangeError("invalid margin"); this.m_topMargin !== t && (this.m_topMargin = t, this._invalidateInternalHeightCache(), this._marksCache = null) }, a.prototype.bottomMargin = function() { return Math.max(this.m_bottomMargin, this._studyBottomMargin) }, a.prototype.setBottomMargin = function(t) { if (!isNumber(t)) throw new TypeError("invalid margin"); if (t < 0 || t > 30) throw new RangeError("invalid margin"); this.m_bottomMargin !== t && (this.m_bottomMargin = t, this ._invalidateInternalHeightCache(), this._marksCache = null) }, a.prototype.internalHeight = function() { if (this._internalHeightCache) return this._internalHeightCache; var t = this.height() * (1 - this.topMargin() - this.bottomMargin()); return this._internalHeightCache = t, t }, a.prototype._invalidateInternalHeightCache = function() { this._internalHeightCache = null, this._internalHeightChanged.fire() }, a.prototype.internalHeightChanged = function() { return this._internalHeightChanged }, a.prototype.priceRange = function() { return this.makeSureItIsValid(), this.m_priceRange }, a.prototype.priceRangeChanged = function() { return this._priceRangeChanged }, a.prototype.setPriceRange = function(t, e, i) { var o, n, r; if (!(t instanceof g)) throw new TypeError("incorrect price range"); return o = this.m_priceRange, !!(e || null === o && null !== t || null !== o && !o .equals(t)) && (n = null !== this.m_maxPriceRange && this.m_maxPriceRange .containsStrictly(t), r = null !== this.m_minPriceRange && t.containsStrictly( this.m_minPriceRange), !(this.isLockScale() && !e && (n || r)) && (this ._marksCache = null, this.m_priceRange = t, void(i || this ._priceRangeChanged.fire(o, t)))) }, a.prototype.isEmpty = function() { return this.makeSureItIsValid(), 0 === this.m_height || !this.m_priceRange || this .m_priceRange.isEmpty() }, a.prototype.invertedCoordinate = function(t) { return this.height() - 1 - t }, a._logicalOffset = 4, a._coordOffset = 1e-4, a.prototype.log10 = function(t) { return Math.log(t) / Math.log(10) }, a.prototype._toLog = function(t) { var e, i = Math.abs(t); return i < 1e-8 ? 0 : (e = this.log10(i + a._coordOffset) + a._logicalOffset, t < 0 ? - e : e) }, a.prototype.priceToLogical = function(t) { return this.isLog() && t ? this._toLog(t) : t }, a.prototype._fromLog = function(t) { var e, i = Math.abs(t); return i < 1e-8 ? 0 : (e = Math.pow(10, i - a._logicalOffset) - a._coordOffset, t < 0 ? -e : e) }, a.prototype.logicalToPrice = function(t) { return this.isLog() ? this._fromLog(t) : t }, a.prototype.priceToCoordinate = function(t, e) { var i, o; return this.makeSureItIsValid(), this.isEmpty() ? 0 : (t = this.priceToLogical(t), i = this.bottomMargin() * this.height() + (this.internalHeight() - 1) * (t - this .priceRange().minValue()) / (this.priceRange().maxValue() - this .priceRange().minValue()), o = this.invertedCoordinate(i), e ? o : Math .round(o) ) }, a.prototype.pricesToCoordinates = function(t) { this.pricesToCoordinatesEx(t, function(t) { return t.y }, function(t, e) { t.y = e }) }, a.prototype.pricesToCoordinatesEx = function(t, e, i) { var o, n, r, s, a, l, c, h, u; if (this.makeSureItIsValid(), o = this.bottomMargin() * this.height(), n = this .priceRange().minValue(), r = this.priceRange().maxValue(), s = this .internalHeight() - 1, a = s / (r - n), this.isLog()) for (l = 0; l < t.length; l++) c = e(t[l]), i(t[l], this.priceToLogical(c)); for (l = 0; l < t.length; l++) c = e(t[l]), TradingView.isNaN(c) || void 0 === c || null === c || (h = o + a * (c - n), u = this.m_height - 1 - h, i(t[l], Math.round( u))) }, a.prototype.pointsArrayToCoordinates = function(t) { var e, i, o, n, r, s, a, l, c; if (this.makeSureItIsValid(), e = this.bottomMargin() * this.height(), i = this .priceRange().minValue(), o = this.priceRange().maxValue(), n = this .internalHeight() - 1, r = n / (o - i), this.isLog()) for (s = 0; s < t.length; s++) t[s].y = this.priceToLogical(t[s].y); for (s = 0; s < t.length; s++) a = t[s].y, TradingView.isNaN(a) || void 0 === a || null === a || (l = e + r * (a - i), c = this.m_height - 1 - l, t[s].y = Math.round( c)) }, a.prototype.pricesArrayToCoordinates = function(t) { var e, i, o, n, r, s, a, l, c; if (this.makeSureItIsValid(), e = this.bottomMargin() * this.height(), i = this .priceRange().minValue(), o = this.priceRange().maxValue(), n = this .internalHeight() - 1, r = n / (o - i), this.isLog()) for (s = 0; s < t.length; s++) t[s] = this.priceToLogical(t[s]); for (s = 0; s < t.length; s++) void 0 !== (a = t[s]) && null !== a && (l = e + r * (a - i), c = this.m_height - 1 - l, t[s] = Math.round(c)) }, a.prototype.barPricesToCoordinates = function(t) { var e, i, o, n, r, s, a, l, c, h, u; if (this.makeSureItIsValid(), e = t, i = this.bottomMargin() * this.height(), o = this .priceRange().minValue(), n = this.priceRange().maxValue(), r = this .internalHeight() - 1, s = r / (n - o), this.isLog()) for (a = 0; a < e.length; a++) e[a] && (e[a].open = this.priceToLogical(e[a].open), e[a].high = this.priceToLogical(e[a].high), e[a].low = this.priceToLogical( e[a].low), e[a].close = this.priceToLogical(e[a].close), e[a] .additionalPrice && (e[a].additionalPrice = this.priceToLogical(e[a] .additionalPrice))); for (a = 0; a < e.length; a++)(l = e[a]) && (c = l.open, h = i + s * (c - o), u = this .m_height - 1 - h, l.open = Math.round(u), c = l.high, h = i + s * (c - o), u = this.m_height - 1 - h, l.high = Math.round(u), c = l.low, h = i + s * (c - o), u = this.m_height - 1 - h, l.low = Math.round(u), c = l.close, h = i + s * (c - o), u = this.m_height - 1 - h, l.close = Math.round(u), l.additionalPrice && (c = l.additionalPrice, h = i + s * (c - o), u = this.m_height - 1 - h, l .additionalPrice = Math.round(u))) }, a.prototype.coordinateToPrice = function(t) { var e, i; return this.makeSureItIsValid(), this.isEmpty() ? 0 : (e = this.invertedCoordinate(t), i = this.priceRange().minValue() + (this.priceRange().maxValue() - this .priceRange().minValue()) * ((e - this.bottomMargin() * this.height()) / ( this.internalHeight() - 1)), this.logicalToPrice(i)) }, a.prototype.dataSources = function() { return this.m_dataSources }, a.prototype.orderedSources = function() { var t, e, o, n; if (this._cachedOrderedSoruces) return this._cachedOrderedSoruces; for (t = [], e = 0; e < this.m_dataSources.length; e++) o = this.m_dataSources[e], null == o.zorder() && o.setZorder(e + 1), t.push(o); return n = i(228), t = n.sortSources(t), this._cachedOrderedSoruces = t, this ._cachedOrderedSoruces }, a.prototype.invalidateSourcesCache = function() { this._cachedOrderedSoruces = null }, a.prototype.hasSeries = function() { return this._hasSeries }, a.prototype.addDataSource = function(t, e) { var i, o; (e || -1 === this.m_dataSources.indexOf(t)) && (TradingView.isInherited(t.constructor, p) && (i = t.properties(), !0 !== this._hasSeries && (i.lockScale && (this ._properties.lockScale.setValue(i.lockScale.value()), i.removeProperty( "lockScale")), i.pnfStyle.lockScale && i.pnfStyle.removeProperty( "lockScale")), this._hasSeries = !0), o = this, t.properties().visible .listeners().subscribe(null, function() { o._sourcesForAutoscale = null }), this.m_dataSources.push(t), this._mainSource = void 0, this ._sourcesForAutoscale = null, this._sourcesToUpdateViews = null, this .updateFormatter(), this.initScaleProperties(), this.invalidateSourcesCache()) }, a.prototype.initScaleProperties = function() { var t = this.isLockScale(); t && (this.properties().percentage.setValue(!1), this.properties().log.setValue(!1), this.properties().autoScale.setValue(!1)), this.properties().percentageDisabled .setValue(t), this.properties().logDisabled.setValue(t), this.properties() .autoScaleDisabled.setValue(this.properties().percentage.value()), this.properties() .percentage.value() && this.properties().log.setValue(!1) }, a.prototype.removeDataSource = function(t) { var e = this.m_dataSources.indexOf(t); if (-1 === e) throw Error("source is not attached to scale"); this.m_dataSources.splice(e, 1), TradingView.isInherited(t.constructor, p) && (this ._hasSeries = !1), this.mainSource() || this.setAutoScale(!0), this ._mainSource = void 0, this._sourcesForAutoscale = null, this ._sourcesToUpdateViews = null, this.updateFormatter(), this.invalidateSourcesCache() }, a.prototype.isAutoScale = function() { return this._properties.autoScale.value() && !this.isLockScale() }, a.prototype.isLockScale = function() { return this._properties.lockScale.value() }, a.prototype.setAutoScale = function(t) { this._properties.autoScale.setValue(t) }, a.prototype.isScaled = function() { return "number" == typeof this.m_scaleStartPoint }, a.prototype.startScale = function(t) { this.isPercentage() || null === this.m_scaleStartPoint && null === this .m_priceRangeSnapshot && (this.isEmpty() || (this.m_scaleStartPoint = this .m_height - t, this.m_priceRangeSnapshot = this.priceRange().clone())) }, a.prototype.marks = function() { return this._marksCache ? this._marksCache : (this.m_markBuilder.rebuildTickMarks(), this._marksCache = this.m_markBuilder.marks(), this.onMarksChanged.fire(), this ._marksCache) }, a.prototype.setMaxPriceRange = function(t) { this.m_maxPriceRange = t }, a.prototype.setMinPriceRange = function(t) { this.m_minPriceRange = t }, a.prototype.scaleTo = function(t) { var e, i; this.isPercentage() || null !== this.m_scaleStartPoint && (this.setAutoScale(!1), t = this.m_height - t, t < 0 && (t = 0), e = (this.m_scaleStartPoint + .2 * (this .m_height - 1)) / (t + .2 * (this.m_height - 1)), i = this .m_priceRangeSnapshot.clone(), e = Math.max(e, .1), i.scaleAroundCenter(e), this .setPriceRange(i)) }, a.prototype.endScale = function() { this.isPercentage() || null !== this.m_scaleStartPoint && (this.m_scaleStartPoint = null, this.m_priceRangeSnapshot = null) }, a.prototype.startScroll = function(t) { this.isAutoScale() || null === this.m_scrollStartPoint && null === this .m_priceRangeSnapshot && (this.isEmpty() || (this.m_scrollStartPoint = t, this .m_priceRangeSnapshot = this.priceRange().clone())) }, a.prototype.scrollTo = function(t) { var e, i, o, n; this.isAutoScale() || null !== this.m_scrollStartPoint && (e = this.priceRange() .length() / (this.height() - 1), i = t - this.m_scrollStartPoint, o = i * e, n = this.m_priceRangeSnapshot.clone(), n.shift(o), this.setPriceRange(n, !0), this ._marksCache = null) }, a.prototype.endScroll = function() { this.isAutoScale() || null !== this.m_scrollStartPoint && (this.m_scrollStartPoint = null, this.m_priceRangeSnapshot = null) }, a.prototype.state = function() { var t = {}; return t.m_priceRange = this.priceRange() ? this.priceRange().serialize() : null, t .m_isAutoScale = this.isAutoScale(), t.m_isPercentage = this._properties.percentage .value(), t.m_isLog = this._properties.log.value(), t.m_isLockScale = this .isLockScale(), t.m_height = this.m_height, t.m_topMargin = this.m_topMargin, t .m_bottomMargin = this.m_bottomMargin, t }, a.prototype.restoreState = function(t) { var e = t.m_priceRange; if (void 0 === e) throw new TypeError("invalid state"); if (void 0 === t.m_isAutoScale) throw new TypeError("invalid state"); void 0 !== t.m_isPercentage && this._properties.percentage.setValue(t.m_isPercentage), void 0 !== t.m_isLog && this._properties.log.setValue(t.m_isLog), void 0 !== t.m_isLockScale && this._properties.lockScale.setValue(t.m_isLockScale), e ? this.setPriceRange(new g(e), !0) : this.m_priceRange = null, void 0 !== t .m_height && (this.m_height = Math.max(0, t.m_height)), this.setAutoScale(t .m_isAutoScale), void 0 !== t.m_topMargin && (this.m_topMargin = t.m_topMargin), void 0 !== t.m_bottomMargin && (this.m_bottomMargin = t.m_bottomMargin), this ._mainSource = void 0, this._scaleSeriesOnly = !1 }, a.prototype.mainSource = function() { var t, e; if (void 0 !== this._mainSource) return this._mainSource; for (t = void 0, e = 0; e < this.m_dataSources.length; e++) { if (TradingView.isInherited(this.m_dataSources[e].constructor, p)) { t = this.m_dataSources[e]; break }!t && TradingView.isInherited(this.m_dataSources[e].constructor, d) && (t = this .m_dataSources[e]) } return this._mainSource = t, this._mainSource || null }, a.prototype.formatter = function() { return this._formatter || this.updateFormatter(), this._formatter }, a.prototype.updateFormatter = function() { var t, e; this._marksCache = null, t = this.mainSource(), e = 100, t && (e = t.base()), this ._formatter = null, this.properties().percentage.value() ? this._formatter = new m : this._formatter = t ? t.formatter() : new f(100, 1), this.m_markBuilder = new r( this, e, this._formatter), this.m_markBuilder.rebuildTickMarks() }, a.prototype._recalculateSourcesForAutoscale = function() { var t, e; this._mainSource && (this._scaleSeriesOnly = this._scalesProperties.scaleSeriesOnly .value()), t = this._scaleSeriesOnly && this._hasSeries, e = function(e) { return !!(e.properties().visible.value() || e instanceof p) && (t ? TradingView .isInherited(e.constructor, p) : TradingView.isInherited(e.constructor, d)) }, this._sourcesForAutoscale = this.m_dataSources.filter(e) }, a.prototype.sourcesForAutoscale = function() { return this._mainSource && this._scaleSeriesOnly !== this._scalesProperties .scaleSeriesOnly.value() && (this._sourcesForAutoscale = null), this ._sourcesForAutoscale || this._recalculateSourcesForAutoscale(), this ._sourcesForAutoscale }, a.prototype.recalculatePriceRange = function(t) { this._invalidatedForRange = { visibleBars: t, isValid: !1 } }, a.prototype.makeSureItIsValid = function() { this._invalidatedForRange.isValid || (this._invalidatedForRange.isValid = !0, this .recalculatePriceRangeImpl()) }, a.prototype.recalculatePriceRangeImpl = function() { var t, e, i, o, n, r, s, a, l, c, h = this._invalidatedForRange.visibleBars; if (null !== h) { for (t = null, e = this.sourcesForAutoscale(), i = 0, o = 0, n = 0; n < e .length; n++) r = e[n], r.properties().visible.value() && (s = h.firstBar(), a = h.lastBar(), l = r.priceRange(s, a), null === t && l ? t = l : l && (t = t .merge(l)), r.margins && (c = r.margins(), i = Math.max(c[0], i), o = Math.max(c[1], o))); (Math.abs(o - this._studyBottomMargin) > .01 || Math.abs(i - this._studyTopMargin) > .01) && (this._studyBottomMargin = o, this._studyTopMargin = i, this ._marksCache = null, this._invalidateInternalHeightCache()), t ? (t .minValue() === t.maxValue() && (t = new g(t.minValue() - .5, t.maxValue() + .5)), this.setPriceRange(t)) : this.m_priceRange || this.setPriceRange( new g(-.5, .5)), this._invalidatedForRange.isValid = !0 } }, a.prototype.sourcesToUpdateViews = function() { var t, e; if (!this._sourcesToUpdateViews) for (this._sourcesToUpdateViews = [], t = 0; t < this.m_dataSources.length; t++) e = this.m_dataSources[t], TradingView.isInherited(e.constructor, u) && !e.isActualSymbol() || this ._sourcesToUpdateViews.push(e); return this._sourcesToUpdateViews }, a.prototype.updatePaneViews = function() { var t, e = this.sourcesToUpdateViews(); for (t = 0; t < e.length; t++) e[t].updateAllViews() }, a.prototype.priceRangeInPrice = function() { var t, e, i, o, n, r; return this.isEmpty() ? null : this.isPercent() ? (t = this.mainSource().model() .timeScale().visibleBars(), e = this.mainSource().data().search(t.firstBar(), _ .NearestRight).value[TradingView.CLOSE_PLOT], i = this.priceRange() .convertFromPercents(e), { from: i.minValue(), to: i.maxValue() }) : (o = this.height(), n = this.coordinateToPrice(o - 1), r = this .coordinateToPrice(0), { from: n, to: r }) }, t.exports = a }).call(e, i(25), i(10)) }, function(t, e, i) { "use strict"; function o(t, e, i) { this.source = t, this.pane = e, this._rendererFactory = i } function n(t, e) { this._barWidth = t.barWidth, this._plates = t.plates, this._tooltip = t.tooltip, this._model = e } function r() { this._layout = [], this._currentId = void 0, this.tooltipHovered = !1 } var s = i(8).Point, a = i(60).pointInCircle, l = i(11); o.prototype.update = function() {}, o.prototype.renderer = function() { return this._rendererFactory(this.source) }, n.prototype.draw = function(t) { t.save(); for (var e = 0; e < this._plates.length; e++) if (this._plates[e].highlightByAuthor) { this._highlightByAuthor = !0; break } this._plates.forEach(this._drawItem.bind(this, t)), this._tooltip.draw(this._plates.map( function(t) { return this._plateTransform(t) }.bind(this)), t), this._tooltip.endDraw(), t.restore() }, n.prototype._drawItem = function(t, e) { t.save(), this._highlightByAuthor && !e.highlightByAuthor && (t.globalAlpha = .4); var i = this._dotTransform(e); i.mine ? this._drawTriangle(t, i) : this._drawDot(t, i), t.restore() }, n.prototype._commonTransform = function(t) { var e = Math.max(1.4 * t.minSize, this._barWidth + 4), i = t.y + { up: -1, down: 1 } [t.direction] * (e * (t.order + .6) + .25 * e), o = TradingView.clone(t.overridedTheme || this.themes[t.theme]); return o.dotBorderWidth = t.hovered || t.highlightByAuthor ? 4 : 2, { id: t.id, theme: o, themeName: t.theme, x: Math.round(t.x + 1), y: Math.round(i), pinned: t.pinned, hovered: t.hovered } }, n.prototype._dotTransform = function(t) { var e = this._commonTransform(t); return e.radius = Math.max(t.minSize / 2, .4 * this._barWidth), e.label = t.label, e .labelFontColor = t.labelFontColor, e.labelFontSize = Math.ceil(Math.max(10, Math.min(e .radius, 20))), this._model.updateDotData(t, e) }, n.prototype._plateTransform = function(t) { var e = this._commonTransform(t); return this._model.updatePlateData(t, e) }, n.THEMES = ["green", "red", "neutral", "yellow", "blue"], n.prototype.themes = { green: { border: "#78C143", background: "#8DDD54" }, red: { border: "#CC4545", background: "#ED5A5A" }, neutral: { border: "#EAC300", background: "#FFD400" }, yellow: { border: "#EAC300", background: "#FFD400" }, blue: { border: "#047ACE", background: "#0496FF" } }, n.prototype._drawTriangle = function(t, e) { var i, o, n, r; t.strokeStyle = e.theme.border, t.fillStyle = e.theme.background, t.lineWidth = e.theme .dotBorderWidth, i = e, o = e.radius, n = Math.cos(Math.PI / 6) * o, r = Math.sin(Math.PI / 6) * o, t.translate(i.x, i.y), "up" === e.direction && t.rotate(Math.PI), e.public || (t .lineWidth /= 2), t.beginPath(), t.moveTo(0, -o), t.lineTo(n, r), t.lineTo(-n, r), t.lineTo(0, -o), t.closePath(), t.stroke(), e.public && t.fill() }, n.prototype._drawDot = function(t, e) { t.strokeStyle = e.theme.border, t.fillStyle = e.theme.background, t.lineWidth = e.theme .dotBorderWidth, t.beginPath(), t.arc(e.x, e.y, e.radius, 0, 2 * Math.PI, !0), t .closePath(), t.stroke(), t.fill(), e.label && e.radius > 6 && (t.textAlign = "center", t .textBaseline = "middle", t.font = "bold " + e.labelFontSize + "px Arial", t.fillStyle = e.labelFontColor, t.fillText(e.label, e.x, e.y)) }, n.prototype.hitTest = function(t) { var e, i; for (i = this._plates.length - 1; i >= 0; --i) if (e = this._hitTestDot(this._plates[i], t)) return e; return null }, n.prototype._hitTestDot = function(t, e) { var i = this._dotTransform(t), o = new s(i.x, i.y); return a(e, o, Math.max(i.radius, 8)) ? new l(l.REGULAR, t) : null }, r.prototype._createLayout = function() { throw Error("Child class must override this member") }, r.prototype._updatePlate = function(t) { throw Error("Child class must override this member") }, r.prototype._getContainer = function(t) { return this._container && this._context === t || (this._context = t, this._container = $(t .canvas).parent()), this._container }, r.prototype._plateArrowSize = 14, r.prototype.showPlate = function(t, e) { var i, o, n, r, s, a, l, c; this._currentId === t.id && this._layout && 0 !== this._layout.length && null != this._layout[0] .parentNode || (this._currentId = t.id, this._createLayout(), this._getContainer(e).append( this._layout), i = this, this._layout.hover(function() { i.tooltipHovered = !0, $(this).stop(!0).fadeTo(0, 1) }, function() { i.tooltipHovered = !1 })), o = Math.round(t.barWidth / 2), o > 15 && (o = 15), o < 10 && (o = 10), this ._updatePlate(t), n = e.canvas.getBoundingClientRect(), r = t.x - this._layout .outerWidth() < this._plateArrowSize, s = n.width - t.x + Math.round(t.barWidth / 2 + o), r && ( s -= this._layout.outerWidth() + 2 * this._plateArrowSize), a = n.height, l = 20, c = 10, this._layout.toggleClass("right", r), this._layout.css({ top: Math.min(Math.max(t.y, l), a - this._layout.outerHeight() - c), right: s, fontSize: o + "px", display: "block" }) }, r.prototype._removeLayout = function() { this.tooltipHovered || (this._layout.stop(!0), this._layout.remove()) }, r.prototype._toggleLayout = function(t) { this._layout.toggle(t) }, r.prototype.hide = function(t) { this.tooltipHovered ? this._layout.stop(!0).fadeTo(0, 1) : this._layout.fadeOut(400, function() { $(this).remove(), t() }) }, r.prototype.setSource = function(t) { this.source = t }, e.BarsMarksContainerPaneView = o, e.BarsMarksContainerRenderer = n, e.BarMarkTooltip = r }, function(t, e, i) { "use strict"; var o = {}; o.renderAttributes = function(t) { var e, i = ""; for (e in t) t[e] && (i += " " + e + '="' + t[e] + '"'); return i }, o.create = function(t, e) { var i = $(document.createElement(t)); return e && (e.html && (i.html(e.html), delete e.html), i.attr(e)), i }, o.validAttributes = ["abbr", "accept-charset", "accept", "accesskey", "action", "align", "alink", "alt", "archive", "axis", "background", "bgcolor", "border", "cellpadding", "cellspacing", "char", "charoff", "charset", "checked", "cite", "class", "classid", "clear", "code", "codebase", "codetype", "color", "cols", "colspan", "compact", "content", "coords", "data", "datetime", "declare", "defer", "dir", "disabled", "enctype", "face", "for", "frame", "frameborder", "headers", "height", "href", "hreflang", "hspace", "http-equiv", "id", "ismap", "label", "lang", "language", "link", "longdesc", "marginheight", "marginwidth", "maxlength", "media", "method", "multiple", "name", "nohref", "noresize", "noshade", "nowrap", "object", "onblur", "onchange", "onclick", "ondblclick", "onfocus", "onkeydown", "onkeypress", "onkeyup", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onreset", "onselect", "onsubmit", "onunload", "profile", "prompt", "readonly", "rel", "rev", "rows", "rowspan", "rules", "scheme", "scope", "scrolling", "selected", "shape", "size", "span", "src", "standby", "start", "style", "summary", "tabindex", "target", "text", "title", "type", "usemap", "valign", "value", "valuetype", "version", "vlink", "vspace", "width" ], o.validAttribute = function(t) { return -1 !== jQuery.inArray(t, o.validAttributes) }, o.cleanAttributes = function(t) { return jQuery.each(t, function(e, i) { o.validAttribute(e) || delete t[e] }), t }, t.exports = o }, function(t, e, i) { function o(t, e, i, s, a) { if (!i) return void r.logDebug("Missed undo model"); n.call(this, t, e, !0, i, s), a ? t.callbacks().subscribe(this, a) : t.callbacks().subscribe(this, o .prototype.onActionCallback) } var n = i(320).Binding, r = i(7).getLogger("Chart.PropertyPage.ActionBinder"); inherit(o, n), o.prototype.onActionCallback = function(t) { this._undoModel.setProperty(this._property, this.value(), this._undoText) }, o.prototype.value = function() { return this.control().checked }, o.prototype.setValue = function(t) { return this.control().checked = !!t }, e.ActionBinder = o }, function(t, e, i) { "use strict"; var o = function() { function t(t) { switch (t) { case "c67": case "m67": case "c45": return "copy"; case "c86": case "m86": case "s45": return "paste"; case "c88": case "m88": case "s46": return "cut" } } function e(t) { var e = []; return t.shiftKey && e.push("s"), t.ctrlKey && e.push("c"), t.metaKey && e.push("m"), t .altKey && e.push("a"), e.push(t.keyCode), e.join("") } function i(t) { var e = $.Event(u + ":" + t); return $(window).trigger(e, { AppClipboard: _ }), e } function o(o) { var n, r, s; if ((document.activeElement === document.body || document.activeElement === document .documentElement) && (n = e(o), r = t(n))) { if ("keydown" === o.type) d[n] = !0; else if (d[n]) return; if (document.getSelection) { if (!document.getSelection().isCollapsed) return } else if (document.selection && "None" !== document.selection.type) return; o.isDefaultPrevented() || (s = i(r), s.isDefaultPrevented() && o.preventDefault()) } } function n(t) { t = t.originalEvent || t, t.key === h && i("change") } function r() { p || ($(document).on("keypress keydown", o), $(window).on("storage", n), p = !0) } function s() { $(document).off("keypress keydown", o), $(window).off("storage", n), $(window).off(u + ":copy"), $(window).off(u + ":paste"), $(window).off(u + ":cut"), $(window).off(u + ":change"), p = !1 } function a() { try { return JSON.parse(TVLocalStorage.getItem(h)) } catch (t) { return null } } function l(t) { if (null == t) return c(); var e = JSON.stringify(t); e !== TVLocalStorage.getItem(h) && (TVLocalStorage.setItem(h, e), i("change")) } function c() { TVLocalStorage.getItem(h) && (TVLocalStorage.removeItem(h), i("change")) } var h = "application-clipboard", u = "appclip", d = {}, p = !1, _ = { init: r, set: l, get: a, clear: c, destroy: s }; return _ }(); t.exports = o }, function(t, e, i) { "use strict"; var o = i(48); JSServer.studyLibrary = [{ name: "Accumulation/Distribution", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#808000" } }, precision: 4, inputs: {} }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Accumulation/Distribution", shortDescription: "Accum/Dist", is_price_study: !1, inputs: [], id: "Accumulation/Distribution@tv-basicstudies-1", scriptIdPart: "", name: "Accumulation/Distribution" }, constructor: function() { this.f_0 = function(t, e, i, n) { return o.Std.or(o.Std.and(o.Std.eq(t, e), o.Std.eq(t, i)), o.Std.eq(e, i)) ? 0 : (2 * t - i - e) / (e - i) * n }, this.main = function(t, e) { var i, n, r; return this._context = t, this._input = e, i = this.f_0(o.Std.close(this ._context), o.Std.high(this._context), o.Std.low(this._context), o.Std.volume(this._context)), n = o.Std.cum(i, this._context), r = n, [r] } } }, { name: "Accumulative Swing Index", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#3C78D8" } }, precision: 4, inputs: { in_0: 10 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "ASI", histogramBase: 0, joinPoints: !1 } }, description: "Accumulative Swing Index", shortDescription: "ASI", is_price_study: !1, inputs: [{ id: "in_0", name: "Limit Move Value", defval: 10, type: "float", min: .1, max: 1e5 }], id: "Accumulative Swing Index@tv-basicstudies-1", scriptIdPart: "", name: "Accumulative Swing Index" }, constructor: function() { this.f_0 = function(t, e) { var i = e.new_var(o.Std.open(e)), n = e.new_var(o.Std.high(e)), r = e.new_var(o.Std.low(e)), s = e.new_var(o.Std.close(e)), a = o.Std.abs(n - s.get(1)), l = o.Std.abs(r - s.get(1)), c = o.Std.abs(n - r), h = o.Std.abs(s.get(1) - i.get(1)), u = o.Std.max(a, l), d = o.Std.iff(a >= o.Std.max(l, c), a - .5 * l + .25 * h, o.Std.iff(l >= o.Std.max(a, c), l - .5 * a + .25 * h, c + .25 * h)); return o.Std.iff(0 === d, 0, (s - s.get(1) + .5 * (s - i) + .25 * (s.get( 1) - i.get(1))) / d * u / t * 50) }, this.f_1 = function(t, e) { var i = this.f_0(t, e); return o.Std.cum(i, e) }, this.main = function(t, e) { var i, o; return this._context = t, this._input = e, i = this._input(0), o = this.f_1( i, this._context), [o] } } }, { name: "Advance/Decline", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, inputs: { in_0: 10 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Advance/Decline", shortDescription: "AD", is_price_study: !1, inputs: [{ id: "in_0", name: "length", defval: 10, type: "integer", min: 1, max: 2e3 }], id: "Advance/Decline@tv-basicstudies-1", scriptIdPart: "", name: "Advance/Decline" }, constructor: function() { this.f_0 = function(t, e) { return o.Std.gt(t, e) }, this.f_1 = function(t, e) { return o.Std.lt(t, e) }, this.f_2 = function(t, e) { return 0 === e ? t : t / e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u; return this._context = t, this._input = e, i = this._input(0), n = this.f_0( o.Std.close(this._context), o.Std.open(this._context)), r = this ._context.new_var(n), s = o.Std.sum(r, i, this._context), a = this.f_1(o .Std.close(this._context), o.Std.open(this._context)), l = this ._context.new_var(a), c = o.Std.sum(l, i, this._context), h = this.f_2( s, c), u = h, [u] } } }, { name: "Arnaud Legoux Moving Average", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, inputs: { in_0: 9, in_1: .85, in_2: 6 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Arnaud Legoux Moving Average", shortDescription: "ALMA", is_price_study: !0, inputs: [{ id: "in_0", name: "Window Size", defval: 9, type: "integer", min: 0, max: 5e3 }, { id: "in_1", name: "Offset", defval: .85, type: "float", min: -1e12, max: 1e12 }, { id: "in_2", name: "Sigma", defval: 6, type: "float", min: -1e12, max: 1e12 }], id: "Arnaud Legoux Moving Average@tv-basicstudies-1", scriptIdPart: "", name: "Arnaud Legoux Moving Average" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a, l; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._input(0), r = this._input(1), s = this._input(2), a = this ._context.new_var(i), l = o.Std.alma(a, n, r, s), [l] } } }, { name: "Aroon", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF6A00" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0094FF" } }, precision: 4, inputs: { in_0: 14 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }], styles: { plot_0: { title: "Upper", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Lower", histogramBase: 0, joinPoints: !1 } }, description: "Aroon", shortDescription: "Aroon", is_price_study: !1, inputs: [{ id: "in_0", name: "length", defval: 14, type: "integer", min: 1, max: 2e3 }], id: "Aroon@tv-basicstudies-1", scriptIdPart: "", name: "Aroon" }, constructor: function() { this.f_0 = function(t, e) { return 100 * (t + e) / e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _; return this._context = t, this._input = e, i = this._input(0), n = o.Std .high(this._context), r = i + 1, s = this._context.new_var(n), a = o.Std .highestbars(s, r, this._context), l = this.f_0(a, i), c = o.Std.low( this._context), h = this._context.new_var(c), u = o.Std.lowestbars( h, r, this._context), d = this.f_0(u, i), p = l, _ = d, [p, _] } } }, { name: "Average Directional Index", metainfo: { _metainfoVersion: 41, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, inputs: { in_0: 14, in_1: 14 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "ADX", histogramBase: 0, joinPoints: !1, isHidden: !1 } }, description: "Average Directional Index", shortDescription: "ADX", is_price_study: !1, inputs: [{ id: "in_0", name: "ADX Smoothing", defval: 14, type: "integer", min: -1e12, max: 1e12 }, { id: "in_1", name: "DI Length", defval: 14, type: "integer", min: -1e12, max: 1e12 }], id: "average_directional_Index@tv-basicstudies-1", scriptIdPart: "", name: "Average Directional Index" }, constructor: function() { this.f_0 = function(t) { var e = this._context.new_var(o.Std.high(this._context)), i = o.Std.change(e), n = this._context.new_var(o.Std.low(this._context)), r = -o.Std.change(n), s = this._context.new_var(o.Std.tr(void 0, this._context)), a = o.Std.rma(s, t, this._context), l = this._context.new_var(o.Std.and(o.Std.gt(i, r), o.Std.gt(i, 0)) ? i : 0), c = o.Std.fixnan(100 * o.Std.rma(l, t, this._context) / a, this ._context), h = this._context.new_var(o.Std.and(o.Std.gt(r, i), o.Std.gt(r, 0)) ? r : 0); return [c, o.Std.fixnan(100 * o.Std.rma(h, t, this._context) / a, this ._context)] }, this.f_1 = function(t, e) { var i = this.f_0(t), n = i[0], r = i[1], s = n + r, a = this._context.new_var(o.Std.abs(n - r) / (o.Std.eq(s, 0) ? 1 : s)); return [100 * o.Std.rma(a, e, this._context)] }, this.main = function(t, e) { return this._context = t, this._input = e, this.f_1(this._input(0), this ._input(1)) } } }, { name: "Average True Range", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, inputs: { in_0: 14 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Average True Range", shortDescription: "ATR", is_price_study: !1, inputs: [{ id: "in_0", name: "length", defval: 14, type: "integer", min: 1, max: 2e3 }], id: "Average True Range@tv-basicstudies-1", scriptIdPart: "", name: "Average True Range" }, constructor: function() { this.main = function(t, e) { var i, n, r, s; return this._context = t, this._input = e, i = this._input(0), n = o.Std.tr( this._context), r = this._context.new_var(n), s = o.Std.rma(r, i, this._context), [s] } } }, { name: "Awesome Oscillator", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 1, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, palettes: { palette_0: { colors: { 0: { color: "#FF0000", width: 1, style: 0 }, 1: { color: "#008000", width: 1, style: 0 } } } }, inputs: {} }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", palette: "palette_0", target: "plot_0", type: "colorer" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Awesome Oscillator", shortDescription: "AO", is_price_study: !1, palettes: { palette_0: { colors: { 0: { name: "Color 0" }, 1: { name: "Color 1" } } } }, inputs: [], id: "Awesome Oscillator@tv-basicstudies-1", scriptIdPart: "", name: "Awesome Oscillator" }, constructor: function() { this.f_0 = function(t, e) { return t - e }, this.f_1 = function(t) { return o.Std.le(t, 0) ? 0 : 1 }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d; return this._context = t, this._input = e, i = o.Std.hl2(this._context), n = this._context.new_var(i), r = o.Std .sma(n, 5, this._context), s = this._context.new_var(i), a = o.Std.sma( s, 34, this._context), l = this.f_0(r, a), c = l, h = this._context .new_var(l), u = o.Std.change(h), d = this.f_1(u), [c, d] } } }, { name: "Balance of Power", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, inputs: {} }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Balance of Power", shortDescription: "Balance of Power", is_price_study: !1, inputs: [], id: "Balance of Power@tv-basicstudies-1", scriptIdPart: "", name: "Balance of Power" }, constructor: function() { this.f_0 = function(t, e, i, o) { return (t - e) / (i - o) }, this.main = function(t, e) { return this._context = t, this._input = e, [this.f_0(o.Std.close(this ._context), o.Std.open(this._context), o.Std.high(this ._context), o.Std.low(this._context))] } } }, { name: "Bollinger Bands", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_2: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, filledAreasStyle: { fill_0: { color: "#000080", transparency: 90, visible: !0 } }, inputs: { in_0: 20, in_1: 2 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }, { id: "plot_2", type: "line" }], styles: { plot_0: { title: "Median", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Upper", histogramBase: 0, joinPoints: !1 }, plot_2: { title: "Lower", histogramBase: 0, joinPoints: !1 } }, description: "Bollinger Bands", shortDescription: "BB", is_price_study: !0, filledAreas: [{ id: "fill_0", objAId: "plot_1", objBId: "plot_2", type: "plot_plot", title: "Plots Background" }], inputs: [{ id: "in_0", name: "length", defval: 20, type: "integer", min: 1, max: 1e4 }, { id: "in_1", name: "mult", defval: 2, type: "float", min: .001, max: 50 }], id: "Bollinger Bands@tv-basicstudies-1", scriptIdPart: "", name: "Bollinger Bands" }, constructor: function() { this.f_0 = function(t, e) { return t * e }, this.f_1 = function(t, e) { return t + e }, this.f_2 = function(t, e) { return t - e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._input(0), r = this._input(1), s = this._context.new_var(i), a = o.Std.sma(s, n, this._context), l = this._context.new_var(i), c = o .Std.stdev(l, n, this._context), h = this.f_0(r, c), u = this.f_1(a, h), d = this.f_2(a, h), p = a, _ = u, f = d, [p, _, f] } } }, { name: "Bollinger Bands %B", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#008080" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 1 }, { color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 0 }], filledAreasStyle: { fill_0: { color: "#008080", transparency: 90, visible: !0 } }, inputs: { in_0: 20, in_1: 2 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Bollinger Bands %B", shortDescription: "BB %B", is_price_study: !1, bands: [{ id: "hline_0", name: "UpperLimit" }, { id: "hline_1", name: "LowerLimit" }], filledAreas: [{ id: "fill_0", objAId: "hline_0", objBId: "hline_1", type: "hline_hline", title: "Hlines Background" }], inputs: [{ id: "in_0", name: "length", defval: 20, type: "integer", min: 1, max: 1e4 }, { id: "in_1", name: "mult", defval: 2, type: "float", min: .001, max: 50 }], id: "Bollinger Bands %B@tv-basicstudies-1", scriptIdPart: "", name: "Bollinger Bands %B" }, constructor: function() { this.f_0 = function(t, e) { return t * e }, this.f_1 = function(t, e) { return t + e }, this.f_2 = function(t, e) { return t - e }, this.f_3 = function(t, e, i) { return (t - e) / (i - e) }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._input(0), r = this._input(1), s = this._context.new_var(i), a = o.Std.sma(s, n, this._context), l = this._context.new_var(i), c = o .Std.stdev(l, n, this._context), h = this.f_0(r, c), u = this.f_1(a, h), d = this.f_2(a, h), p = this.f_3(i, d, u), _ = p, [_] } } }, { name: "Bollinger Bands Width", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, inputs: { in_0: 20, in_1: 2 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Bollinger Bands Width", shortDescription: "BBW", is_price_study: !1, inputs: [{ id: "in_0", name: "length", defval: 20, type: "integer", min: 1, max: 1e4 }, { id: "in_1", name: "mult", defval: 2, type: "float", min: .001, max: 50 }], id: "Bollinger Bands Width@tv-basicstudies-1", scriptIdPart: "", name: "Bollinger Bands Width" }, constructor: function() { this.f_0 = function(t, e) { return t * e }, this.f_1 = function(t, e) { return t + e }, this.f_2 = function(t, e) { return t - e }, this.f_3 = function(t, e, i) { return (t - e) / i }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._input(0), r = this._input(1), s = this._context.new_var(i), a = o.Std.sma(s, n, this._context), l = this._context.new_var(i), c = o .Std.stdev(l, n, this._context), h = this.f_0(r, c), u = this.f_1(a, h), d = this.f_2(a, h), p = this.f_3(u, d, a), _ = p, [_] } } }, { name: "Chaikin Money Flow", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#008000" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 0 }], inputs: { in_0: 20 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Chaikin Money Flow", shortDescription: "CMF", is_price_study: !1, bands: [{ id: "hline_0", name: "Zero" }], inputs: [{ id: "in_0", name: "length", defval: 20, type: "integer", min: 1, max: 2e3 }], id: "Chaikin Money Flow@tv-basicstudies-1", scriptIdPart: "", name: "Chaikin Money Flow" }, constructor: function() { this.f_0 = function(t, e, i, n) { return o.Std.or(o.Std.and(o.Std.eq(t, e), o.Std.eq(t, i)), o.Std.eq(e, i)) ? 0 : (2 * t - i - e) / (e - i) * n }, this.f_1 = function(t, e) { return t / e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u; return this._context = t, this._input = e, i = this._input(0), n = this.f_0( o.Std.close(this._context), o.Std.high(this._context), o.Std.low( this._context), o.Std.volume(this._context)), r = this._context .new_var(n), s = o.Std.sum(r, i, this._context), a = o.Std.volume(this ._context), l = this._context.new_var(a), c = o.Std.sum(l, i, this ._context), h = this.f_1(s, c), u = h, [u] } } }, { name: "Chaikin Oscillator", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 0 }], inputs: { in_0: 3, in_1: 10 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Chaikin Oscillator", shortDescription: "Chaikin Osc", is_price_study: !1, bands: [{ id: "hline_0", name: "Zero" }], inputs: [{ id: "in_0", name: "short", defval: 3, type: "integer", min: 1, max: 2e3 }, { id: "in_1", name: "long", defval: 10, type: "integer", min: 1, max: 2e3 }], id: "Chaikin Oscillator@tv-basicstudies-1", scriptIdPart: "", name: "Chaikin Oscillator" }, constructor: function() { this.f_0 = function(t, e) { return t - e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = o.Std.accdist(this._context), s = this._context.new_var( r), a = o.Std.ema(s, i, this._context), l = this._context.new_var( r), c = o.Std.ema(l, n, this._context), h = this.f_0(a, c), u = h, [ u ] } } }, { name: "Chande Kroll Stop", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#008000" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, inputs: { in_0: 10, in_1: 1, in_2: 9 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }], styles: { plot_0: { title: "Long", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Short", histogramBase: 0, joinPoints: !1 } }, description: "Chande Kroll Stop", shortDescription: "Chande Kroll Stop", is_price_study: !0, inputs: [{ id: "in_0", name: "p", defval: 10, type: "integer", min: 1, max: 4999 }, { id: "in_1", name: "x", defval: 1, type: "integer", min: 1, max: 1e12 }, { id: "in_2", name: "q", defval: 9, type: "integer", min: 1, max: 1e12 }], id: "Chande Kroll Stop@tv-basicstudies-1", scriptIdPart: "", name: "Chande Kroll Stop" }, constructor: function() { this.f_0 = function(t, e, i) { return t - e * i }, this.f_1 = function(t, e, i) { return t + e * i }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f, m, g, v, y; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = this._input(2), s = o.Std.high(this._context), a = this ._context.new_var(s), l = o.Std.highest(a, i, this._context), c = o.Std .atr(i, this._context), h = this.f_0(l, n, c), u = this._context .new_var(s), d = o.Std.lowest(u, i, this._context), p = this.f_1(d, n, c), _ = this._context.new_var(h), f = o.Std.highest(_, r, this ._context), m = this._context.new_var(p), g = o.Std.lowest(m, r, this._context), v = g, y = f, [v, y] } } }, { name: "Chande Momentum Oscillator", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#008080" } }, precision: 4, inputs: { in_0: 9 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Chande Momentum Oscillator", shortDescription: "ChandeMO", is_price_study: !1, inputs: [{ id: "in_0", name: "length", defval: 9, type: "integer", min: 1, max: 2e3 }], id: "Chande Momentum Oscillator@tv-basicstudies-1", scriptIdPart: "", name: "Chande Momentum Oscillator" }, constructor: function() { this.f_0 = function(t) { return o.Std.ge(t, 0) ? t : 0 }, this.f_1 = function(t) { return o.Std.ge(t, 0) ? 0 : -t }, this.f_2 = function(t, e) { return 100 * t / e }, this.f_3 = function(t, e) { return this.f_2(t - e, t + e) }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _; return this._context = t, this._input = e, i = this._input(0), n = o.Std .close(this._context), r = this._context.new_var(n), s = o.Std.change( r), a = this.f_0(s), l = this.f_1(s), c = this._context.new_var(a), h = o.Std.sum(c, i, this._context), u = this._context.new_var(l), d = o.Std .sum(u, i, this._context), p = this.f_3(h, d), _ = p, [_] } } }, { name: "Chop Zone", metainfo: { _metainfoVersion: 41, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 5, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, palettes: { palette_0: { colors: { 0: { color: "#34dddd", width: 1, style: 0 }, 1: { color: "#006400", width: 1, style: 0 }, 2: { color: "#98fb98", width: 1, style: 0 }, 3: { color: "#00FF00", width: 1, style: 0 }, 4: { color: "#8B0000", width: 1, style: 0 }, 5: { color: "#FF0000", width: 1, style: 0 }, 6: { color: "#FF7F00", width: 1, style: 0 }, 7: { color: "#ffc04c", width: 1, style: 0 }, 8: { color: "#FFFF00", width: 1, style: 0 } } } }, inputs: {} }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", palette: "palette_0", target: "plot_0", type: "colorer" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1, isHidden: !1 } }, description: "Chop Zone", shortDescription: "Chop Zone", is_price_study: !1, palettes: { palette_0: { colors: { 0: { name: "Color 0" }, 1: { name: "Color 1" }, 2: { name: "Color 2" }, 3: { name: "Color 3" }, 4: { name: "Color 4" }, 5: { name: "Color 5" }, 6: { name: "Color 6" }, 7: { name: "Color 7" }, 8: { name: "Color 8" } }, valToIndex: { 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8 } } }, inputs: [], id: "chop_zone@tv-basicstudies-1", scriptIdPart: "", name: "Chop Zone" }, constructor: function() { this.f_0 = function() { var t = o.Std.close(this._context), e = o.Std.hlc3(this._context), i = this._context.new_var(o.Std.high(this._context)), n = o.Std.highest(i, 30, this._context), r = o.Std.lowest(i, 30, this._context), s = 25 / (n - r) * r, a = this._context.new_var(t), l = this._context.new_var(o.Std.ema(a, 34, this._context)), c = (l.get(1) - l.get(0)) / e * s, h = o.Std.sqrt(1 + c * c), u = o.Std.round(180 * o.Std.acos(1 / h) / 3.141592653589793), d = o.Std.iff(o.Std.gt(c, 0), -u, u), p = o.Std.and(o.Std.gt(d, -2.14), o.Std.le(d, -.71)) ? 7 : 8, _ = o.Std.and(o.Std.gt(d, -3.57), o.Std.le(d, -2.14)) ? 6 : p, f = o.Std.and(o.Std.gt(d, -5), o.Std.le(d, -3.57)) ? 5 : _, m = o.Std.le(d, -5) ? 4 : f, g = o.Std.and(o.Std.lt(d, 2.14), o.Std.ge(d, .71)) ? 3 : m, v = o.Std.and(o.Std.lt(d, 3.57), o.Std.ge(d, 2.14)) ? 2 : g, y = o.Std.and(o.Std.lt(d, 5), o.Std.ge(d, 3.57)) ? 1 : v; return [1, o.Std.ge(d, 5) ? 0 : y] }, this.main = function(t, e) { return this._context = t, this._input = e, this.f_0() } } }, { name: "Choppiness Index", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 61.8 }, { color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 38.2 }], filledAreasStyle: { fill_0: { color: "#008000", transparency: 90, visible: !0 } }, inputs: { in_0: 14 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Choppiness Index", shortDescription: "CHOP", is_price_study: !1, bands: [{ id: "hline_0", name: "UpperLimit" }, { id: "hline_1", name: "LowerLimit" }], filledAreas: [{ id: "fill_0", objAId: "hline_0", objBId: "hline_1", type: "hline_hline", title: "Hlines Background" }], inputs: [{ id: "in_0", name: "length", defval: 14, type: "integer", min: 1, max: 2e3 }], id: "Choppiness Index@tv-basicstudies-1", scriptIdPart: "", name: "Choppiness Index" }, constructor: function() { this.f_0 = function(t, e, i, n) { return 100 * o.Std.log10(t / (e - i)) / n }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f; return this._context = t, this._input = e, i = this._input(0), n = o.Std .atr(1, this._context), r = this._context.new_var(n), s = o.Std.sum(r, i, this._context), a = o.Std.high(this._context), l = this._context .new_var(a), c = o.Std.highest(l, i, this._context), h = o.Std.low(this ._context), u = this._context.new_var(h), d = o.Std.lowest(u, i, this._context), p = o.Std.log10(i), _ = this.f_0(s, c, d, p), f = _, [f] } } }, { name: "Commodity Channel Index", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#808000" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 100 }, { color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: -100 }], filledAreasStyle: { fill_0: { color: "#808000", transparency: 90, visible: !0 } }, inputs: { in_0: 20 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Commodity Channel Index", shortDescription: "CCI", is_price_study: !1, bands: [{ id: "hline_0", name: "UpperLimit" }, { id: "hline_1", name: "LowerLimit" }], filledAreas: [{ id: "fill_0", objAId: "hline_0", objBId: "hline_1", type: "hline_hline", title: "Hlines Background" }], inputs: [{ id: "in_0", name: "length", defval: 20, type: "integer", min: 1, max: 2e3 }], id: "Commodity Channel Index@tv-basicstudies-1", scriptIdPart: "", name: "Commodity Channel Index" }, constructor: function() { this.f_0 = function(t, e, i) { return (t - e) / (.015 * i) }, this.main = function(t, e) { var i, n, r, s, a, l, c, h; return this._context = t, this._input = e, i = o.Std.hlc3(this._context), n = this._input(0), r = this._context.new_var(i), s = o.Std.sma(r, n, this._context), a = this._context.new_var(i), l = o.Std.dev(a, n, this._context), c = this.f_0(i, s, l), h = c, [h] } } }, { name: "Connors RSI", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#800080" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 70 }, { color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 30 }], filledAreasStyle: { fill_0: { color: "#800080", transparency: 90, visible: !0 } }, inputs: { in_0: 3, in_1: 2, in_2: 100 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "CRSI", histogramBase: 0, joinPoints: !1 } }, description: "Connors RSI", shortDescription: "CRSI", is_price_study: !1, bands: [{ id: "hline_0", name: "UpperLimit" }, { id: "hline_1", name: "LowerLimit" }], filledAreas: [{ id: "fill_0", objAId: "hline_0", objBId: "hline_1", type: "hline_hline", title: "Hlines Background" }], inputs: [{ id: "in_0", name: "RSI Length", defval: 3, type: "integer", min: 1 }, { id: "in_1", name: "UpDown Length", defval: 2, type: "integer", min: 1 }, { id: "in_2", name: "ROC Length", defval: 100, type: "integer", min: 1 }], id: "Connors RSI@tv-basicstudies-1", scriptIdPart: "", name: "Connors RSI" }, constructor: function() { this.f_1 = function(t, e, i) { var n = i.new_var(o.Std.max(o.Std.change(t), 0)); return o.Std.rma(n, e, i) }, this.f_2 = function(t, e, i) { var n = i.new_var(-o.Std.min(o.Std.change(t), 0)); return o.Std.rma(n, e, i) }, this.f_3 = function() { var t = 0; return function(e) { var i = e.get(0), n = e.get(1); return t = i === n ? 0 : i > n ? o.Std.nz(t) <= 0 ? 1 : o.Std.nz( t) + 1 : o.Std.nz(t) >= 0 ? -1 : o.Std.nz(t) - 1, this ._context .new_var(t) } }(), this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._context.new_var(i), r = this._input(0), s = this._input(1), a = this._input(2), l = o.Std.rsi(this.f_1(n, r, this._context), this .f_2(n, r, this._context)), c = this.f_3(n), h = o.Std.rsi(this.f_1( c, s, this._context), this.f_2(c, s, this._context)), u = this ._context.new_var(o.Std.roc(n, 1)), d = o.Std.percentrank(u, a), p = o .Std.avg(l, h, d), [p] } } }, { name: "Coppock Curve", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, inputs: { in_0: 10, in_1: 14, in_2: 11 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Coppock Curve", shortDescription: "Coppock Curve", is_price_study: !1, inputs: [{ id: "in_0", name: "WMA Length", defval: 10, type: "integer", min: -1e12, max: 5e3 }, { id: "in_1", name: "Long RoC Length", defval: 14, type: "integer", min: 1, max: 4999 }, { id: "in_2", name: "Short RoC Length", defval: 11, type: "integer", min: 1, max: 4999 }], id: "Coppock Curve@tv-basicstudies-1", scriptIdPart: "", name: "Coppock Curve" }, constructor: function() { this.f_0 = function(t, e) { return t + e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = this._input(2), s = o.Std.close(this._context), a = this ._context.new_var(s), l = o.Std.roc(a, n), c = this._context.new_var(s), h = o.Std.roc(c, r), u = this.f_0(l, h), d = this._context.new_var(u), p = o.Std.wma(d, i, this._context), _ = p, [_] } } }, { name: "Correlation Coeff", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 4, trackPrice: !1, transparency: 40, visible: !0, color: "#800080" } }, precision: 4, inputs: { in_0: "AAPL", in_1: 20 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Correlation Coefficient", shortDescription: "CC", is_price_study: !1, inputs: [{ id: "in_0", name: "sym", defval: "AAPL", type: "symbol" }, { id: "in_1", name: "length", defval: 20, type: "integer", min: 1, max: 2e3 }], id: "Correlation Coeff@tv-basicstudies-1", scriptIdPart: "", name: "Correlation Coeff" }, constructor: function() { this.init = function(t, e) { this._context = t, this._input = e, this._context.new_sym(this._input(0), o .Std.period(this._context), o.Std.period(this._context)) }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d; return this._context = t, this._input = e, i = this._context.new_var(this ._context.symbol.time), this._input(0), o.Std.period(this._context), n = o.Std.close(this._context), r = this._input(1), this._context .select_sym(1), s = this._context.new_var(this._context.symbol.time), a = o.Std.close(this._context), l = this._context.new_var(a), this ._context.select_sym(0), c = l.adopt(s, i, 0), h = this._context .new_var(n), u = this._context.new_var(c), d = o.Std.correlation(h, u, r, this._context), [d] } } }, { name: "Detrended Price Oscillator", metainfo: { _metainfoVersion: 42, isTVScript: !1, isTVScriptStub: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#808000" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 0 }], inputs: { in_0: 21, in_1: !1 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "DPO", histogramBase: 0, joinPoints: !1, isHidden: !1 } }, description: "Detrended Price Oscillator", shortDescription: "DPO", is_price_study: !1, is_hidden_study: !1, id: "detrended_price_oscillator@tv-basicstudies-1", bands: [{ id: "hline_0", name: "Zero", isHidden: !1 }], inputs: [{ id: "in_0", name: "Period", defval: 21, type: "integer", min: 1, max: 1e12 }, { id: "in_1", name: "isCentered", defval: !1, type: "bool" }], scriptIdPart: "", name: "Detrended Price Oscillator" }, constructor: function() { this.f_0 = function() { var t = this._input(0), e = this._input(1), i = Math.floor(t / 2 + 1), n = this._context.new_var(o.Std.close(this._context)), r = this._context.new_var(o.Std.sma(n, t, this._context)), s = this._context.new_var(o.Std.close(this._context)), a = s.get(i) - r, l = o.Std.close(this._context) - r.get(i), c = e ? a : l, h = -i; return [c, e ? h : 0] }, this.main = function(t, e) { this._context = t, this._input = e; var i = this.f_0(); return [{ value: i[0], offset: i[1] }] } } }, { name: "Directional Movement Index", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF7F00" }, plot_2: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, inputs: { in_0: 14, in_1: 14 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }, { id: "plot_2", type: "line" }], styles: { plot_0: { title: "+DI", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "-DI", histogramBase: 0, joinPoints: !1 }, plot_2: { title: "ADX", histogramBase: 0, joinPoints: !1 } }, description: "Directional Movement", shortDescription: "DMI", is_price_study: !1, inputs: [{ id: "in_0", name: "DI Length", defval: 14, type: "integer", min: 1, max: 2e3 }, { id: "in_1", name: "ADX Smoothing", defval: 14, type: "integer", min: 1, max: 50 }], id: "Directional Movement Index@tv-basicstudies-1", scriptIdPart: "", name: "Directional Movement Index" }, constructor: function() { this.f_0 = function(t) { return -t }, this.f_1 = function(t, e) { return o.Std.and(o.Std.gt(t, e), o.Std.gt(t, 0)) ? t : 0 }, this.f_2 = function(t, e) { return 100 * t / e }, this.f_3 = function(t, e) { return t + e }, this.f_4 = function(t, e, i) { return o.Std.abs(t - e) / (o.Std.eq(i, 0) ? 1 : i) }, this.f_5 = function(t) { return 100 * t }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f, m, g, v, y, b, S, w, T, C, x, P, L, I, k, A, M, E; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = o.Std.high(this._context), s = this._context.new_var(r), a = o.Std.change(s), l = o.Std.low(this._context), c = this._context .new_var(l), h = o.Std.change(c), u = this.f_0(h), d = o.Std.tr(this ._context), p = this._context.new_var(d), _ = o.Std.rma(p, i, this ._context), f = this.f_1(a, u), m = this._context.new_var(f), g = o .Std.rma(m, i, this._context), v = this.f_2(g, _), y = o.Std.fixnan(v, this._context), b = this.f_1(u, a), S = this._context.new_var(b), w = o.Std.rma(S, i, this._context), T = this.f_2(w, _), C = o.Std .fixnan(T, this._context), x = this.f_3(y, C), P = this.f_4(y, C, x), L = this._context.new_var(P), I = o.Std.rma(L, n, this._context), k = this.f_5(I), A = y, M = C, E = k, [A, M, E] } } }, { name: "Donchian Channels", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_2: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF7F00" } }, precision: 4, filledAreasStyle: { fill_0: { color: "#0000FF", transparency: 90, visible: !0 } }, inputs: { in_0: 20 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }, { id: "plot_2", type: "line" }], styles: { plot_0: { title: "Lower", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Upper", histogramBase: 0, joinPoints: !1 }, plot_2: { title: "Basis", histogramBase: 0, joinPoints: !1 } }, description: "Donchian Channels", shortDescription: "DC", is_price_study: !0, filledAreas: [{ id: "fill_0", objAId: "plot_1", objBId: "plot_0", type: "plot_plot", title: "Plots Background" }], inputs: [{ id: "in_0", name: "length", defval: 20, type: "integer", min: 1, max: 2e3 }], id: "Donchian Channels@tv-basicstudies-1", scriptIdPart: "", name: "Donchian Channels" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p; return this._context = t, this._input = e, i = this._input(0), n = o.Std .low(this._context), r = this._context.new_var(n), s = o.Std.lowest(r, i, this._context), a = o.Std.high(this._context), l = this._context .new_var(a), c = o.Std.highest(l, i, this._context), h = o.Std.avg(c, s), u = s, d = c, p = h, [u, d, p] } } }, { name: "Double Exponential Moving Average", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#008000" } }, precision: 4, inputs: { in_0: 9 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Double EMA", shortDescription: "DEMA", is_price_study: !0, inputs: [{ id: "in_0", name: "length", defval: 9, type: "integer", min: 1, max: 1e4 }], id: "Double Exponential Moving Average@tv-basicstudies-1", scriptIdPart: "", name: "Double Exponential Moving Average" }, constructor: function() { this.f_0 = function(t, e) { return 2 * t - e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h; return this._context = t, this._input = e, i = this._input(0), n = o.Std .close(this._context), r = this._context.new_var(n), s = o.Std.ema(r, i, this._context), a = this._context.new_var(s), l = o.Std.ema(a, i, this._context), c = this.f_0(s, l), h = c, [h] } } }, { name: "Ease of Movement", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#808000" } }, precision: 4, inputs: { in_0: 1e4, in_1: 14 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Ease Of Movement", shortDescription: "EOM", is_price_study: !1, inputs: [{ id: "in_0", name: "Divisor", defval: 1e4, type: "integer", min: 1, max: 1e9 }, { id: "in_1", name: "length", defval: 14, type: "integer", min: 1, max: 2e3 }], id: "Ease of Movement@tv-basicstudies-1", scriptIdPart: "", name: "Ease of Movement" }, constructor: function() { this.f_0 = function(t, e, i, o, n) { return t * e * (i - o) / n }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = o.Std.hl2(this._context), s = this._context.new_var(r), a = o.Std.change(s), l = this.f_0(i, a, o.Std.high(this._context), o.Std .low(this._context), o.Std.volume(this._context)), c = this._context .new_var(l), h = o.Std.sma(c, n, this._context), u = h, [u] } } }, { name: "Elders Force Index", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#800000" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 0 }], inputs: { in_0: 13 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Elder's Force Index", shortDescription: "EFI", is_price_study: !1, bands: [{ id: "hline_0", name: "Zero" }], inputs: [{ id: "in_0", name: "length", defval: 13, type: "integer", min: 1, max: 2e3 }], id: "Elders Force Index@tv-basicstudies-1", scriptIdPart: "", name: "Elders Force Index" }, constructor: function() { this.f_0 = function(t, e) { return t * e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h; return this._context = t, this._input = e, i = this._input(0), n = o.Std .close(this._context), r = this._context.new_var(n), s = o.Std.change( r), a = this.f_0(s, o.Std.volume(this._context)), l = this._context .new_var(a), c = o.Std.ema(l, i, this._context), h = c, [h] } } }, { name: "EMA Cross", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#008000" }, plot_2: { linestyle: 0, linewidth: 4, plottype: 3, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, inputs: { in_0: 9, in_1: 26 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }, { id: "plot_2", type: "line" }], styles: { plot_0: { title: "Short", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Long", histogramBase: 0, joinPoints: !1 }, plot_2: { title: "Crosses", histogramBase: 0, joinPoints: !1 } }, description: "EMA Cross", shortDescription: "EMA Cross", is_price_study: !0, inputs: [{ id: "in_0", name: "Short", defval: 9, type: "integer", min: 1, max: 2e3 }, { id: "in_1", name: "Long", defval: 26, type: "integer", min: 1, max: 2e3 }], id: "EMA Cross@tv-basicstudies-1", scriptIdPart: "", name: "EMA Cross" }, constructor: function() { this.f_0 = function(t, e) { return t ? e : o.Std.na() }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = o.Std.close(this._context), s = this._context.new_var( r), a = o.Std.ema(s, i, this._context), l = this._context.new_var( r), c = o.Std.ema(l, n, this._context), h = a, u = c, d = o.Std.cross(a, c, this._context), p = this.f_0(d, a), [h, u, p] } } }, { name: "Envelope", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF7F00" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_2: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, filledAreasStyle: { fill_0: { color: "#0000FF", transparency: 90, visible: !0 } }, inputs: { in_0: 20, in_1: 10, in_2: !1 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }, { id: "plot_2", type: "line" }], styles: { plot_0: { title: "Median", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Upper", histogramBase: 0, joinPoints: !1 }, plot_2: { title: "Lower", histogramBase: 0, joinPoints: !1 } }, description: "Envelope", shortDescription: "Env", is_price_study: !0, filledAreas: [{ id: "fill_0", objAId: "plot_1", objBId: "plot_2", type: "plot_plot", title: "Plots Background" }], inputs: [{ id: "in_0", name: "Length", defval: 20, type: "integer", min: 1, max: 2e3 }, { id: "in_1", name: "percent", defval: 10, type: "float", min: -1e12, max: 1e12 }, { id: "in_2", name: "exponential", defval: !1, type: "bool" }], id: "Envelope@tv-basicstudies-1", scriptIdPart: "", name: "Envelope" }, constructor: function() { this.f_0 = function(t, e, i) { return t ? e : i }, this.f_1 = function(t, e) { return t * (1 + e) }, this.f_2 = function(t, e) { return t * (1 - e) }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f, m, g; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._input(0), r = this._input(1), s = this._input(2), a = this ._context.new_var(i), l = o.Std.ema(a, n, this._context), c = this ._context.new_var(i), h = o.Std.sma(c, n, this._context), u = this.f_0( s, l, h), d = r / 100, p = this.f_1(u, d), _ = this.f_2(u, d), f = u, m = p, g = _, [f, m, g] } } }, { name: "Fisher Transform", metainfo: { _metainfoVersion: 41, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF7F00" } }, precision: 4, bands: [{ color: "#FF7F00", linestyle: 2, linewidth: 1, visible: !0, value: 1.5 }, { color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: .75 }, { color: "#FF7F00", linestyle: 2, linewidth: 1, visible: !0, value: 0 }, { color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: -.75 }, { color: "#FF7F00", linestyle: 2, linewidth: 1, visible: !0, value: -1.5 }], inputs: { in_0: 9 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }], styles: { plot_0: { title: "Fisher", histogramBase: 0, joinPoints: !1, isHidden: !1 }, plot_1: { title: "Trigger", histogramBase: 0, joinPoints: !1, isHidden: !1 } }, description: "Fisher Transform", shortDescription: "Fisher", is_price_study: !1, bands: [{ id: "hline_0", name: "Level", isHidden: !1 }, { id: "hline_1", name: "Level", isHidden: !1 }, { id: "hline_2", name: "Level", isHidden: !1 }, { id: "hline_3", name: "Level", isHidden: !1 }, { id: "hline_4", name: "Level", isHidden: !1 }], inputs: [{ id: "in_0", name: "Length", defval: 9, type: "integer", min: 1, max: 1e12 }], id: "fisher_transform@tv-basicstudies-1", scriptIdPart: "", name: "Fisher Transform" }, constructor: function() { this.f_0 = function(t) { var e = o.Std.lt(t, -.99) ? -.999 : t; return [o.Std.gt(t, .99) ? .999 : e] }, this.f_1 = function() { var t, e, i, n = this._input(0), r = this._context.new_var(o.Std.hl2(this._context)), s = o.Std.highest(r, n, this._context), a = this._context.new_var(o.Std.hl2(this._context)), l = o.Std.lowest(a, n, this._context), c = this._context.new_var(), h = this.f_0(.66 * ((o.Std.hl2(this._context) - l) / o.Std.max(s - l, .001) - .5) + .67 * o.Std.nz(c.get(1))); return c.set(h[0]), t = this._context.new_var(), t.set(.5 * o.Std.log((1 + c .get(0)) / o.Std.max(1 - c.get(0), .001)) + .5 * o.Std.nz(t.get( 1))), e = t.get(1), i = t.get(0), [i, e] }, this.main = function(t, e) { return this._context = t, this._input = e, this.f_1() } } }, { name: "Historical Volatility", metainfo: { _metainfoVersion: 41, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, inputs: { in_0: 10 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1, isHidden: !1 } }, description: "Historical Volatility", shortDescription: "HV", is_price_study: !1, inputs: [{ id: "in_0", name: "length", defval: 10, type: "integer", min: 1, max: 1e12 }], id: "historical_volatility@tv-basicstudies-1", scriptIdPart: "", name: "Historical Volatility" }, constructor: function() { this.f_0 = function() { var t = this._input(0), e = o.Std.or(o.Std.isintraday(this._context), o.Std.and(o.Std.isdaily( this._context), o.Std.eq(o.Std.interval(this._context), 1))) ? 1 : 7, i = this._context.new_var(o.Std.close(this._context)), n = this._context.new_var(o.Std.log(o.Std.close(this._context) / i.get( 1))); return [100 * o.Std.stdev(n, t, this._context) * o.Std.sqrt(365 / e)] }, this.main = function(t, e) { return this._context = t, this._input = e, this.f_0() } } }, { name: "Hull MA", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, inputs: { in_0: 9 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Hull Moving Average", shortDescription: "HMA", is_price_study: !0, inputs: [{ id: "in_0", name: "length", defval: 9, type: "integer", min: 1, max: 1e4 }], id: "Hull MA@tv-basicstudies-1", scriptIdPart: "", name: "Hull MA" }, constructor: function() { this.f_0 = function(t, e) { return 2 * t - e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._input(0), r = n / 2, s = this._context.new_var(i), a = o.Std .wma(s, r, this._context), l = this._context.new_var(i), c = o.Std.wma( l, n, this._context), h = this.f_0(a, c), u = o.Std.sqrt(n), d = o .Std.round(u), p = this._context.new_var(h), _ = o.Std.wma(p, d, this ._context), f = _, [f] } } }, { name: "Ichimoku Cloud", metainfo: { _metainfoVersion: 42, isTVScript: !1, isTVScriptStub: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0496ff" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#991515" }, plot_2: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#459915" }, plot_3: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#008000" }, plot_4: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, palettes: { palette_0: { colors: { 0: { color: "#008000", width: 1, style: 0 }, 1: { color: "#FF0000", width: 1, style: 0 } } } }, filledAreasStyle: { fill_0: { color: "#000080", transparency: 90, visible: !0 } }, inputs: { in_0: 9, in_1: 26, in_2: 52, in_3: 26 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }, { id: "plot_2", type: "line" }, { id: "plot_3", type: "line" }, { id: "plot_4", type: "line" }, { id: "plot_5", palette: "palette_0", target: "fill_0", type: "colorer" }], styles: { plot_0: { title: "Conversion Line", histogramBase: 0, joinPoints: !1, isHidden: !1 }, plot_1: { title: "Base Line", histogramBase: 0, joinPoints: !1, isHidden: !1 }, plot_2: { title: "Lagging Span", histogramBase: 0, joinPoints: !1, isHidden: !1 }, plot_3: { title: "Lead 1", histogramBase: 0, joinPoints: !1, isHidden: !1 }, plot_4: { title: "Lead 2", histogramBase: 0, joinPoints: !1, isHidden: !1 } }, description: "Ichimoku Cloud", shortDescription: "Ichimoku", is_price_study: !0, is_hidden_study: !1, id: "Ichimoku Cloud@tv-basicstudies-1", palettes: { palette_0: { colors: { 0: { name: "Color 0" }, 1: { name: "Color 1" } }, valToIndex: { 0: 0, 1: 1 } } }, filledAreas: [{ id: "fill_0", objAId: "plot_3", objBId: "plot_4", type: "plot_plot", title: "Plots Background", isHidden: !1, palette: "palette_0" }], inputs: [{ id: "in_0", name: "Conversion Line Periods", defval: 9, type: "integer", min: 1, max: 1e12 }, { id: "in_1", name: "Base Line Periods", defval: 26, type: "integer", min: 1, max: 1e12 }, { id: "in_2", name: "Lagging Span 2 Periods", defval: 52, type: "integer", min: 1, max: 1e12 }, { id: "in_3", name: "Displacement", defval: 26, type: "integer", min: 1, max: 1e12 }], scriptIdPart: "", name: "Ichimoku Cloud" }, constructor: function() { this.donchian = function(t) { var e = this._context.new_var(o.Std.low(this._context)), i = this._context.new_var(o.Std.high(this._context)); return o.Std.avg(o.Std.lowest(e, t, this._context), o.Std.highest(i, t, this ._context)) }, this.f_1 = function() { var t = this._input(0), e = this._input(1), i = this._input(2), n = this._input(3), r = this.donchian(t), s = this.donchian(e), a = o.Std.avg(r, s), l = this.donchian(i); return [r, s, o.Std.close(this._context), a, l, -n, n, n, o.Std.gt(a, l) ? 0 : 1 ] }, this.main = function(t, e) { this._context = t, this._input = e; var i = this.f_1(); return [i[0], i[1], { value: i[2], offset: i[5] }, { value: i[3], offset: i[6] }, { value: i[4], offset: i[7] }, i[8]] } } }, { name: "Keltner Channels", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_2: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, filledAreasStyle: { fill_0: { color: "#0000FF", transparency: 90, visible: !0 } }, inputs: { in_0: !0, in_1: 20, in_2: 1 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }, { id: "plot_2", type: "line" }], styles: { plot_0: { title: "Upper", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Middle", histogramBase: 0, joinPoints: !1 }, plot_2: { title: "Lower", histogramBase: 0, joinPoints: !1 } }, description: "Keltner Channels", shortDescription: "KC", is_price_study: !0, filledAreas: [{ id: "fill_0", objAId: "plot_0", objBId: "plot_2", type: "plot_plot", title: "Plots Background" }], inputs: [{ id: "in_0", name: "useTrueRange", defval: !0, type: "bool" }, { id: "in_1", name: "length", defval: 20, type: "integer", min: 1, max: 2e3 }, { id: "in_2", name: "mult", defval: 1, type: "float", min: -1e12, max: 1e12 }], id: "Keltner Channels@tv-basicstudies-1", scriptIdPart: "", name: "Keltner Channels" }, constructor: function() { this.f_0 = function(t, e, i, o) { return t ? e : i - o }, this.f_1 = function(t, e, i) { return t + e * i }, this.f_2 = function(t, e, i) { return t - e * i }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f, m; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._input(0), r = this._input(1), s = this._input(2), a = this ._context.new_var(i), l = o.Std.ema(a, r, this._context), c = this.f_0(n, o.Std.tr(this._context), o.Std.high(this._context), o .Std.low(this._context)), h = this._context.new_var(c), u = o.Std .ema(h, r, this._context), d = this.f_1(l, u, s), p = this.f_2(l, u, s), _ = d, f = l, m = p, [_, f, m] } } }, { name: "Klinger Oscillator", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#008000" } }, precision: 4, inputs: {} }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Signal", histogramBase: 0, joinPoints: !1 } }, description: "Klinger Oscillator", shortDescription: "Klinger Oscillator", is_price_study: !1, inputs: [], id: "Klinger Oscillator@tv-basicstudies-1", scriptIdPart: "", name: "Klinger Oscillator" }, constructor: function() { this.f_0 = function(t, e) { return o.Std.ge(t, 0) ? e : -e }, this.f_1 = function(t, e) { return t - e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f; return this._context = t, this._input = e, i = o.Std.hlc3(this._context), n = this._context.new_var(i), r = o.Std.change(n), s = this.f_0(r, o.Std .volume(this._context)), a = this._context.new_var(s), l = o.Std .ema(a, 34, this._context), c = this._context.new_var(s), h = o.Std.ema( c, 55, this._context), u = this.f_1(l, h), d = this._context .new_var(u), p = o.Std.ema(d, 13, this._context), _ = u, f = p, [_, f] } } }, { name: "Know Sure Thing", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#008000" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 0 }], inputs: { in_0: 10, in_1: 15, in_2: 20, in_3: 30, in_4: 10, in_5: 10, in_6: 10, in_7: 15, in_8: 9 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }], styles: { plot_0: { title: "KST", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Signal", histogramBase: 0, joinPoints: !1 } }, description: "Know Sure Thing", shortDescription: "KST", is_price_study: !1, bands: [{ id: "hline_0", name: "Zero" }], inputs: [{ id: "in_0", name: "roclen1", defval: 10, type: "integer", min: 1, max: 2e3 }, { id: "in_1", name: "roclen2", defval: 15, type: "integer", min: 1, max: 2e3 }, { id: "in_2", name: "roclen3", defval: 20, type: "integer", min: 1, max: 2e3 }, { id: "in_3", name: "roclen4", defval: 30, type: "integer", min: 1, max: 2e3 }, { id: "in_4", name: "smalen1", defval: 10, type: "integer", min: 1, max: 2e3 }, { id: "in_5", name: "smalen2", defval: 10, type: "integer", min: 1, max: 2e3 }, { id: "in_6", name: "smalen3", defval: 10, type: "integer", min: 1, max: 2e3 }, { id: "in_7", name: "smalen4", defval: 15, type: "integer", min: 1, max: 2e3 }, { id: "in_8", name: "siglen", defval: 9, type: "integer", min: 1, max: 2e3 }], id: "Know Sure Thing@tv-basicstudies-1", scriptIdPart: "", name: "Know Sure Thing" }, constructor: function() { this.f_0 = function(t, e, i, o) { return t + 2 * e + 3 * i + 4 * o }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f, m, g, v, y, b, S, w, T, C, x, P, L, I, k, A, M, E, D, V, O, R, B, z, F, N, W; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = this._input(2), s = this._input(3), a = this._input(4), l = this._input(5), c = this._input(6), h = this._input(7), u = this ._input(8), d = o.Std.close(this._context), p = i, _ = this._context .new_var(d), f = o.Std.roc(_, p), m = a, g = this._context.new_var(f), v = o.Std.sma(g, m, this._context), y = n, b = this._context.new_var(d), S = o.Std.roc(b, y), w = l, T = this._context.new_var(S), C = o.Std.sma( T, w, this._context), x = r, P = this._context.new_var(d), L = o.Std .roc(P, x), I = c, k = this._context.new_var(L), A = o.Std.sma(k, I, this._context), M = s, E = this._context.new_var(d), D = o.Std.roc( E, M), V = h, O = this._context.new_var(D), R = o.Std.sma(O, V, this ._context), B = this.f_0(v, C, A, R), z = this._context.new_var(B), F = o.Std.sma(z, u, this._context), N = B, W = F, [N, W] } } }, { name: "Least Squares Moving Average", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, inputs: { in_0: 25, in_1: 0 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Least Squares Moving Average", shortDescription: "LSMA", is_price_study: !0, inputs: [{ id: "in_0", name: "Length", defval: 25, type: "integer", min: 1, max: 1e12 }, { id: "in_1", name: "Offset", defval: 0, type: "integer", min: -1e12, max: 1e12 }], id: "Least Squares Moving Average@tv-basicstudies-1", scriptIdPart: "", name: "Least Squares Moving Average" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a, l; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = o.Std.close(this._context), s = this._context.new_var( r), a = o.Std.linreg(s, i, n), l = a, [l] } } }, { name: "Linear Regression Curve", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, inputs: { in_0: 9 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Linear Regression Curve", shortDescription: "LRC", is_price_study: !0, inputs: [{ id: "in_0", name: "Length", defval: 9, type: "integer", min: 1, max: 2e3 }], id: "Linear Regression Curve@tv-basicstudies-1", scriptIdPart: "", name: "Linear Regression Curve" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._input(0), r = this._context.new_var(i), s = o.Std.linreg(r, n, 0), a = s, [a] } } }, { name: "MA Cross", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#008000" }, plot_2: { linestyle: 0, linewidth: 4, plottype: 3, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, inputs: { in_0: 9, in_1: 26 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }, { id: "plot_2", type: "line" }], styles: { plot_0: { title: "Short", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Long", histogramBase: 0, joinPoints: !1 }, plot_2: { title: "Crosses", histogramBase: 0, joinPoints: !1 } }, description: "MA Cross", shortDescription: "MA Cross", is_price_study: !0, inputs: [{ id: "in_0", name: "Short", defval: 9, type: "integer", min: 1, max: 2e3 }, { id: "in_1", name: "Long", defval: 26, type: "integer", min: 1, max: 2e3 }], id: "MA Cross@tv-basicstudies-1", scriptIdPart: "", name: "MA Cross" }, constructor: function() { this.f_0 = function(t, e) { return t ? e : o.Std.na() }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = o.Std.close(this._context), s = this._context.new_var( r), a = o.Std.sma(s, i, this._context), l = this._context.new_var( r), c = o.Std.sma(l, n, this._context), h = a, u = c, d = o.Std.cross(a, c, this._context), p = this.f_0(d, a), [h, u, p] } } }, { name: "MA with EMA Cross", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#008000" }, plot_2: { linestyle: 0, linewidth: 4, plottype: 3, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, inputs: { in_0: 10, in_1: 10 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }, { id: "plot_2", type: "line" }], styles: { plot_0: { title: "MA", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "EMA", histogramBase: 0, joinPoints: !1 }, plot_2: { title: "Crosses", histogramBase: 0, joinPoints: !1 } }, description: "MA with EMA Cross", shortDescription: "MA/EMA Cross", is_price_study: !0, inputs: [{ id: "in_0", name: "Length MA", defval: 10, type: "integer", min: 1, max: 2e3 }, { id: "in_1", name: "Length EMA", defval: 10, type: "integer", min: 1, max: 2e3 }], id: "MA with EMA Cross@tv-basicstudies-1", scriptIdPart: "", name: "MA with EMA Cross" }, constructor: function() { this.f_0 = function(t, e) { return t ? e : o.Std.na() }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = o.Std.close(this._context), s = this._context.new_var( r), a = o.Std.sma(s, i, this._context), l = this._context.new_var( r), c = o.Std.ema(l, n, this._context), h = a, u = c, d = o.Std.cross(a, c, this._context), p = this.f_0(d, a), [h, u, p] } } }, { name: "Mass Index", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, inputs: { in_0: 10 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Mass Index", shortDescription: "Mass Index", is_price_study: !1, inputs: [{ id: "in_0", name: "length", defval: 10, type: "integer", min: 1, max: 2e3 }], id: "Mass Index@tv-basicstudies-1", scriptIdPart: "", name: "Mass Index" }, constructor: function() { this.f_0 = function(t, e) { return t - e }, this.f_1 = function(t, e) { return t / e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d; return this._context = t, this._input = e, i = this._input(0), n = this.f_0( o.Std.high(this._context), o.Std.low(this._context)), r = this._context.new_var(n), s = o.Std.ema(r, 9, this._context), a = this._context.new_var(s), l = o.Std.ema(a, 9, this._context), c = this .f_1(s, l), h = this._context.new_var(c), u = o.Std.sum(h, i, this ._context), d = u, [d] } } }, { name: "McGinley Dynamic", metainfo: { _metainfoVersion: 42, isTVScript: !1, isTVScriptStub: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, inputs: { in_0: 14 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1, isHidden: !1 } }, description: "McGinley Dynamic", shortDescription: "McGinley Dynamic", is_price_study: !0, is_hidden_study: !1, id: "mcginley_dynamic@tv-basicstudies-1", inputs: [{ id: "in_0", name: "length", defval: 14, type: "integer", min: 1, max: 1e12 }], scriptIdPart: "", name: "McGinley Dynamic" }, constructor: function() { this.f_0 = function() { var t, e = this._input(0), i = o.Std.close(this._context), n = this._context.new_var(i), r = o.Std.ema(n, e, this._context), s = this._context.new_var(), a = s.get(1) + (i - s.get(1)) / (e * o.Std.pow(i / s.get(1), 4)); return s.set(o.Std.na(s.get(1)) ? r : a), t = s.get(0), [t] }, this.main = function(t, e) { return this._context = t, this._input = e, this.f_0() } } }, { name: "Momentum", metainfo: { _metainfoVersion: 30, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#808000" } }, precision: 4, inputs: { in_0: 10, in_1: "close" } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Mom", histogramBase: 0, joinPoints: !1, isHidden: !1 } }, description: "Momentum", shortDescription: "Mom", is_price_study: !1, inputs: [{ id: "in_0", name: "Length", defval: 10, type: "integer", min: 1, max: 2e3 }, { id: "in_1", name: "Source", defval: "close", type: "source", options: ["open", "high", "low", "close", "hl2", "hlc3", "ohlc4"] }], id: "Momentum@tv-basicstudies-1", scriptIdPart: "", name: "Momentum" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a; return this._context = t, this._input = e, i = this._input(0), n = o.Std[ this._input(1)](this._context), r = this._context.new_var(n), s = r .get(i), a = s ? n - s : null, [a] } } }, { name: "Money Flow", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#459915" } }, precision: 4, bands: [{ color: "#c0c0c0", linestyle: 2, linewidth: 1, visible: !0, value: 80 }, { color: "#c0c0c0", linestyle: 2, linewidth: 1, visible: !0, value: 20 }], filledAreasStyle: { fill_0: { color: "#9915ff", transparency: 90, visible: !0 } }, inputs: { in_0: 14 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Money Flow", shortDescription: "MFI", is_price_study: !1, bands: [{ id: "hline_0", name: "UpperLimit" }, { id: "hline_1", name: "LowerLimit" }], filledAreas: [{ id: "fill_0", objAId: "hline_0", objBId: "hline_1", type: "hline_hline", title: "Hlines Background" }], inputs: [{ id: "in_0", name: "Length", defval: 14, type: "integer", min: 1, max: 2e3 }], id: "Money Flow@tv-basicstudies-1", scriptIdPart: "", name: "Money Flow" }, constructor: function() { this.f_0 = function(t, e, i) { return t * (o.Std.le(e, 0) ? 0 : i) }, this.f_1 = function(t, e, i) { return t * (o.Std.ge(e, 0) ? 0 : i) }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _; return this._context = t, this._input = e, i = this._input(0), n = o.Std .hlc3(this._context), r = this._context.new_var(n), s = o.Std.change(r), a = this.f_0(o.Std.volume(this._context), s, n), l = this._context .new_var(a), c = o.Std.sum(l, i, this._context), h = this.f_1(o.Std .volume(this._context), s, n), u = this._context.new_var(h), d = o .Std.sum(u, i, this._context), p = o.Std.rsi(c, d), _ = p, [_] } } }, { name: "Moving Average", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, inputs: { in_0: 9, in_1: "close", in_2: 0 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Moving Average", shortDescription: "MA", is_price_study: !0, inputs: [{ id: "in_0", name: "Length", defval: 9, type: "integer", min: 1, max: 1e4 }, { id: "in_1", name: "Source", defval: "close", type: "source", options: ["open", "high", "low", "close", "hl2", "hlc3", "ohlc4"] }, { id: "in_2", name: "Offset", defval: 0, type: "integer", min: -1e4, max: 1e4 }], id: "Moving Average@tv-basicstudies-1", scriptIdPart: "", name: "Moving Average" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a, l; return this._context = t, this._input = e, i = o.Std[this._input(1)](this ._context), n = this._input(0), r = this._input(2), s = this ._context.new_var(i), a = o.Std.sma(s, n, this._context), l = a, [{ value: l, offset: r }] } } }, { name: "Moving Average Channel", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#CC0000" } }, precision: 4, filledAreasStyle: { fill_0: { color: "#A2C4C9", transparency: 90, visible: !0 } }, inputs: { in_0: 20, in_1: 20, in_2: 0, in_3: 0 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }], styles: { plot_0: { title: "Upper", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Lower", histogramBase: 0, joinPoints: !1 } }, filledAreas: [{ id: "fill_0", objAId: "plot_0", objBId: "plot_1", type: "plot_plot", title: "Plots Background" }], description: "Moving Average Channel", shortDescription: "MAC", is_price_study: !0, inputs: [{ id: "in_0", name: "Upper Length", defval: 20, type: "integer", min: 1, max: 1e4 }, { id: "in_1", name: "Lower Length", defval: 20, type: "integer", min: 1, max: 1e4 }, { id: "in_2", name: "Upper Offset", defval: 0, type: "integer", min: -1e4, max: 1e4 }, { id: "in_3", name: "Lower Offset", defval: 0, type: "integer", min: -1e4, max: 1e4 }], id: "Moving Average Channel@tv-basicstudies-1", scriptIdPart: "", name: "Moving Average Channel" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d; return this._context = t, this._input = e, i = o.Std.high(this._context), n = o.Std.low(this._context), r = this._input(0), s = this._input(1), a = this._input(2), l = this._input(3), c = this._context.new_var(i), h = this._context.new_var(n), u = o.Std.sma(c, r, this._context), d = o .Std.sma(h, s, this._context), [{ value: u, offset: a }, { value: d, offset: l }] } } }, { name: "Moving Average Convergence/Divergence", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 1, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_2: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, inputs: { in_0: 12, in_1: 26, in_3: "close", in_2: 9 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }, { id: "plot_2", type: "line" }], styles: { plot_0: { title: "Histogram", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "MACD", histogramBase: 0, joinPoints: !1 }, plot_2: { title: "Signal", histogramBase: 0, joinPoints: !1 } }, description: "MACD", shortDescription: "MACD", is_price_study: !1, inputs: [{ id: "in_0", name: "fastLength", defval: 12, type: "integer", min: 1, max: 2e3 }, { id: "in_1", name: "slowLength", defval: 26, type: "integer", min: 1, max: 2e3 }, { id: "in_3", name: "Source", defval: "close", type: "source", options: ["open", "high", "low", "close", "hl2", "hlc3", "ohlc4"] }, { id: "in_2", name: "signalLength", defval: 9, type: "integer", min: 1, max: 50 }], id: "Moving Average Convergence/Divergence@tv-basicstudies-1", scriptIdPart: "", name: "MACD" }, constructor: function() { this.f_0 = function(t, e) { return t - e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f, m, g; return this._context = t, this._input = e, i = o.Std[this._input(2)](this ._context), n = this._input(0), r = this._input(1), s = this._input( 3), a = this._context.new_var(i), l = o.Std.ema(a, n, this ._context), c = this._context.new_var(i), h = o.Std.ema(c, r, this ._context), u = this.f_0(l, h), d = this._context.new_var(u), p = o .Std.ema(d, s, this._context), _ = this.f_0(u, p), f = _, m = u, g = p, [f, m, g] } } }, { name: "Moving Average Exponential", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, inputs: { in_0: 9, in_1: "close", in_2: 0 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Moving Average Exponential", shortDescription: "EMA", is_price_study: !0, inputs: [{ id: "in_0", name: "Length", defval: 9, type: "integer", min: 1, max: 1e4 }, { id: "in_1", name: "Source", defval: "close", type: "source", options: ["open", "high", "low", "close", "hl2", "hlc3", "ohlc4"] }, { id: "in_2", name: "Offset", defval: 0, type: "integer", min: -1e4, max: 1e4 }], id: "Moving Average Exponential@tv-basicstudies-1", scriptIdPart: "", name: "Moving Average Exponential" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a, l; return this._context = t, this._input = e, i = o.Std[this._input(1)](this ._context), n = this._input(0), r = this._input(2), s = this ._context.new_var(i), a = o.Std.ema(s, n, this._context), l = a, [{ value: l, offset: r }] } } }, { name: "Moving Average Weighted", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, inputs: { in_0: 9, in_1: "close", in_2: 0 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Moving Average Weighted", shortDescription: "WMA", is_price_study: !0, inputs: [{ id: "in_0", name: "Length", defval: 9, type: "integer", min: 1, max: 2e3 }, { id: "in_1", name: "Source", defval: "close", type: "source", options: ["open", "high", "low", "close", "hl2", "hlc3", "ohlc4"] }, { id: "in_2", name: "Offset", defval: 0, type: "integer", min: -1e4, max: 1e4 }], id: "Moving Average Weighted@tv-basicstudies-1", scriptIdPart: "", name: "Moving Average Weighted" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a, l; return this._context = t, this._input = e, i = o.Std[this._input(1)](this ._context), n = this._input(0), r = this._input(2), s = this ._context.new_var(i), a = o.Std.wma(s, n, this._context), l = a, [{ value: l, offset: r }] } } }, { name: "Net Volume", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, inputs: {} }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Net Volume", shortDescription: "Net Volume", is_price_study: !1, inputs: [], id: "Net Volume@tv-basicstudies-1", scriptIdPart: "", name: "Net Volume" }, constructor: function() { this.f_0 = function(t, e, i) { return o.Std.gt(t, 0) ? e : o.Std.lt(i, 0) ? -e : 0 * e }, this.main = function(t, e) { var i, n, r, s, a; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._context.new_var(i), r = o.Std.change(n), s = this.f_0(r, o.Std .volume(this._context), r), a = s, [a] } } }, { name: "On Balance Volume", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, inputs: {} }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "On Balance Volume", shortDescription: "OBV", is_price_study: !1, inputs: [], id: "On Balance Volume@tv-basicstudies-1", scriptIdPart: "", name: "On Balance Volume" }, constructor: function() { this.f_0 = function(t, e, i) { return o.Std.gt(t, 0) ? e : o.Std.lt(i, 0) ? -e : 0 * e }, this.main = function(t, e) { var i, n, r, s, a, l; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._context.new_var(i), r = o.Std.change(n), s = this.f_0(r, o.Std .volume(this._context), r), a = o.Std.cum(s, this._context), l = a, [l] } } }, { name: "Parabolic SAR", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 3, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, inputs: { in_0: .02, in_1: .02, in_2: .2 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Parabolic SAR", shortDescription: "SAR", is_price_study: !0, inputs: [{ id: "in_0", name: "start", defval: .02, type: "float", min: -1e12, max: 1e12 }, { id: "in_1", name: "increment", defval: .02, type: "float", min: -1e12, max: 1e12 }, { id: "in_2", name: "maximum", defval: .2, type: "float", min: -1e12, max: 1e12 }], id: "Parabolic SAR@tv-basicstudies-1", scriptIdPart: "", name: "Parabolic SAR" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = this._input(2), s = o.Std.sar(i, n, r, this._context), a = s, [a] } } }, { name: "Price Channel", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0080" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0080" }, plot_2: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0496FF" } }, precision: 4, inputs: { in_0: 20, in_1: 0 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }, { id: "plot_2", type: "line" }], styles: { plot_0: { title: "Highprice Line", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Lowprice Line", histogramBase: 0, joinPoints: !1 }, plot_2: { title: "Centerprice Line", histogramBase: 0, joinPoints: !1 } }, description: "Price Channel", shortDescription: "PC", is_price_study: !1, inputs: [{ id: "in_0", name: "Length", defval: 20, type: "integer", min: 1, max: 2e3 }, { id: "in_1", name: "Offset Length", defval: 0, type: "integer", min: 1, max: 2e3 }], id: "Price Channel@tv-basicstudies-1", scriptIdPart: "", name: "Price Channel" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a, l, c, h, u; return this._context = t, this._input = e, i = o.Std.high(this._context), n = this._context.new_var(i), r = o.Std.low(this._context), s = this ._context.new_var(r), a = this._input(0), l = this._input(1), c = o.Std .highest(n, a, this._context), h = o.Std.lowest(s, a, this._context), u = o.Std.avg(c, h), [{ value: c, offset: l }, { value: h, offset: l }, { value: u, offset: l }] } } }, { name: "Price Oscillator", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, inputs: { in_0: 10, in_1: 21 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Price Oscillator", shortDescription: "PPO", is_price_study: !1, inputs: [{ id: "in_0", name: "shortlen", defval: 10, type: "integer", min: 1, max: 2e3 }, { id: "in_1", name: "longlen", defval: 21, type: "integer", min: 1, max: 2e3 }], id: "Price Oscillator@tv-basicstudies-1", scriptIdPart: "", name: "Price Oscillator" }, constructor: function() { this.f_0 = function(t, e) { return (t - e) / e * 100 }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._input(0), r = this._input(1), s = this._context.new_var(i), a = o.Std.sma(s, n, this._context), l = this._context.new_var(i), c = o .Std.sma(l, r, this._context), h = this.f_0(a, c), u = h, [u] } } }, { name: "Price Volume Trend", metainfo: { _metainfoVersion: 42, isTVScript: !1, isTVScriptStub: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, inputs: {} }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "PVT", histogramBase: 0, joinPoints: !1, isHidden: !1 } }, description: "Price Volume Trend", shortDescription: "PVT", is_price_study: !1, is_hidden_study: !1, id: "price_volume_trend@tv-basicstudies-1", inputs: [], scriptIdPart: "", name: "Price Volume Trend" }, constructor: function() { this.f_0 = function() { var t = this._context.new_var(o.Std.close(this._context)); return [o.Std.cum(o.Std.change(t) / t.get(1) * o.Std.volume(this._context), this._context)] }, this.main = function(t, e) { return this._context = t, this._input = e, [this.f_0()[0]] } } }, { name: "Rate Of Change", metainfo: { _metainfoVersion: 41, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 0 }], inputs: { in_0: 9 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "ROC", histogramBase: 0, joinPoints: !1, isHidden: !1 } }, description: "Rate Of Change", shortDescription: "ROC", is_price_study: !1, bands: [{ id: "hline_0", name: "Zero Line", isHidden: !1 }], inputs: [{ id: "in_0", name: "length", defval: 9, type: "integer", min: 1, max: 1e12 }], id: "rate_of_change@tv-basicstudies-1", scriptIdPart: "", name: "Rate Of Change" }, constructor: function() { this.main = function(t, e) { var i, n, r; return this._context = t, this._input = e, i = this._context.new_var(o.Std .close(this._context)), n = this._input(0), r = 100 * (i.get(0) - i .get(n)) / i.get(n), [r] } } }, { name: "Relative Strength Index", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#800080" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 70 }, { color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 30 }], filledAreasStyle: { fill_0: { color: "#800080", transparency: 90, visible: !0 } }, inputs: { in_0: 14 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Relative Strength Index", shortDescription: "RSI", is_price_study: !1, bands: [{ id: "hline_0", name: "UpperLimit" }, { id: "hline_1", name: "LowerLimit" }], filledAreas: [{ id: "fill_0", objAId: "hline_0", objBId: "hline_1", type: "hline_hline", title: "Hlines Background" }], inputs: [{ id: "in_0", name: "Length", defval: 14, type: "integer", min: 1, max: 2e3 }], id: "Relative Strength Index@tv-basicstudies-1", scriptIdPart: "", name: "Relative Strength Index" }, constructor: function() { this.f_0 = function(t) { return o.Std.max(t, 0) }, this.f_1 = function(t) { return -o.Std.min(t, 0) }, this.f_2 = function(t, e) { return o.Std.eq(t, 0) ? 100 : o.Std.eq(e, 0) ? 0 : 100 - 100 / (1 + e / t) }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._input(0), r = this._context.new_var(i), s = o.Std.change(r), a = this.f_0(s), l = this._context.new_var(a), c = o.Std.rma(l, n, this ._context), h = this.f_1(s), u = this._context.new_var(h), d = o.Std .rma(u, n, this._context), p = this.f_2(d, c), _ = p, [_] } } }, { name: "Relative Vigor Index", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#008000" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, inputs: { in_0: 10 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }], styles: { plot_0: { title: "RVGI", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Signal", histogramBase: 0, joinPoints: !1 } }, description: "Relative Vigor Index", shortDescription: "RVGI", is_price_study: !1, inputs: [{ id: "in_0", name: "Length", defval: 10, type: "integer", min: 1, max: 2e3 }], id: "Relative Vigor Index@tv-basicstudies-1", scriptIdPart: "", name: "Relative Vigor Index" }, constructor: function() { this.f_0 = function(t, e) { return t - e }, this.f_1 = function(t, e) { return t / e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f, m, g, v; return this._context = t, this._input = e, i = this._input(0), n = this.f_0( o.Std.close(this._context), o.Std.open(this._context)), r = this ._context.new_var(n), s = o.Std.swma(r, this._context), a = this ._context.new_var(s), l = o.Std.sum(a, i, this._context), c = this.f_0(o .Std.high(this._context), o.Std.low(this._context)), h = this ._context.new_var(c), u = o.Std.swma(h, this._context), d = this ._context.new_var(u), p = o.Std.sum(d, i, this._context), _ = this.f_1( l, p), f = this._context.new_var(_), m = o.Std.swma(f, this ._context), g = _, v = m, [g, v] } } }, { name: "Relative Volatility Index", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 80 }, { color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 20 }], filledAreasStyle: { fill_0: { color: "#808000", transparency: 90, visible: !0 } }, inputs: { in_0: 10 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Relative Volatility Index", shortDescription: "RVI", is_price_study: !1, bands: [{ id: "hline_0", name: "UpperLimit" }, { id: "hline_1", name: "LowerLimit" }], filledAreas: [{ id: "fill_0", objAId: "hline_0", objBId: "hline_1", type: "hline_hline", title: "Hlines Background" }], inputs: [{ id: "in_0", name: "length", defval: 10, type: "integer", min: 1, max: 2e3 }], id: "Relative Volatility Index@tv-basicstudies-1", scriptIdPart: "", name: "Relative Volatility Index" }, constructor: function() { this.f_0 = function(t, e) { return o.Std.le(t, 0) ? 0 : e }, this.f_1 = function(t, e) { return o.Std.gt(t, 0) ? 0 : e }, this.f_2 = function(t, e) { return t / (t + e) * 100 }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f, m; return this._context = t, this._input = e, i = this._input(0), n = o.Std .close(this._context), r = this._context.new_var(n), s = o.Std.stdev(r, i, this._context), a = this._context.new_var(n), l = o.Std.change( a), c = this.f_0(l, s), h = this._context.new_var(c), u = o.Std.ema( h, 14, this._context), d = this.f_1(l, s), p = this._context.new_var( d), _ = o.Std.ema(p, 14, this._context), f = this.f_2(u, _), m = f, [m] } } }, { name: "SMI Ergodic Indicator/Oscillator", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF7F00" }, plot_2: { linestyle: 0, linewidth: 1, plottype: 1, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, inputs: { in_0: 5, in_1: 20, in_2: 5 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }, { id: "plot_2", type: "line" }], styles: { plot_0: { title: "Indicator", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Signal", histogramBase: 0, joinPoints: !1 }, plot_2: { title: "Oscillator", histogramBase: 0, joinPoints: !1 } }, description: "SMI Ergodic Indicator/Oscillator", shortDescription: "SMIIO", is_price_study: !1, inputs: [{ id: "in_0", name: "shortlen", defval: 5, type: "integer", min: 1, max: 2e3 }, { id: "in_1", name: "longlen", defval: 20, type: "integer", min: 1, max: 2e3 }, { id: "in_2", name: "siglen", defval: 5, type: "integer", min: 1, max: 2e3 }], id: "SMI Ergodic Indicator/Oscillator@tv-basicstudies-1", scriptIdPart: "", name: "SMI Ergodic Indicator/Oscillator" }, constructor: function() { this.f_0 = function(t, e) { return t - e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = this._input(2), s = o.Std.close(this._context), a = this ._context.new_var(s), l = o.Std.tsi(a, i, n, this._context), c = this ._context.new_var(l), h = o.Std.ema(c, r, this._context), u = this.f_0( l, h), d = l, p = h, _ = u, [d, p, _] } } }, { name: "Smoothed Moving Average", metainfo: { _metainfoVersion: 41, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, inputs: { in_0: 7, in_1: "close" } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1, isHidden: !1 } }, description: "Smoothed Moving Average", shortDescription: "SMMA", is_price_study: !0, inputs: [{ id: "in_0", name: "Length", defval: 7, type: "integer", min: 1, max: 1e12 }, { id: "in_1", name: "Source", defval: "close", type: "source", options: ["open", "high", "low", "close", "hl2", "hlc3", "ohlc4"] }], id: "smoothed_moving_average@tv-basicstudies-1", scriptIdPart: "", name: "Smoothed Moving Average" }, constructor: function() { this.f_0 = function() { var t, e = this._input(0), i = o.Std[this._input(1)](this._context), n = this._context.new_var(i), r = o.Std.sma(n, e, this._context), s = this._context.new_var(), a = (s.get(1) * (e - 1) + i) / e; return s.set(o.Std.na(s.get(1)) ? r : a), t = s.get(0), [t] }, this.main = function(t, e) { return this._context = t, this._input = e, this.f_0() } } }, { name: "Stochastic", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 80 }, { color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 20 }], filledAreasStyle: { fill_0: { color: "#800080", transparency: 75, visible: !0 } }, inputs: { in_0: 14, in_1: 1, in_2: 3 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }], styles: { plot_0: { title: "%K", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "%D", histogramBase: 0, joinPoints: !1 } }, description: "Stochastic", shortDescription: "Stoch", is_price_study: !1, bands: [{ id: "hline_0", name: "UpperLimit" }, { id: "hline_1", name: "LowerLimit" }], filledAreas: [{ id: "fill_0", objAId: "hline_0", objBId: "hline_1", type: "hline_hline", title: "Hlines Background" }], inputs: [{ id: "in_0", name: "length", defval: 14, type: "integer", min: 1, max: 1e4 }, { id: "in_1", name: "smoothK", defval: 1, type: "integer", min: 1, max: 1e4 }, { id: "in_2", name: "smoothD", defval: 3, type: "integer", min: 1, max: 1e4 }], id: "Stochastic@tv-basicstudies-1", scriptIdPart: "", name: "Stochastic" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f, m, g, v; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = this._input(2), s = o.Std.close(this._context), a = o .Std.high(this._context), l = o.Std.low(this._context), c = this ._context.new_var(s), h = this._context.new_var(a), u = this._context .new_var(l), d = o.Std.stoch(c, h, u, i, this._context), p = this ._context.new_var(d), _ = o.Std.sma(p, n, this._context), f = this ._context.new_var(_), m = o.Std.sma(f, r, this._context), g = _, v = m, [g, v] } } }, { name: "Stochastic RSI", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 80 }, { color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 20 }], filledAreasStyle: { fill_0: { color: "#800080", transparency: 80, visible: !0 } }, inputs: { in_0: 14, in_1: 14, in_2: 3, in_3: 3 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }], styles: { plot_0: { title: "%K", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "%D", histogramBase: 0, joinPoints: !1 } }, description: "Stochastic RSI", shortDescription: "Stoch RSI", is_price_study: !1, bands: [{ id: "hline_0", name: "UpperLimit" }, { id: "hline_1", name: "LowerLimit" }], filledAreas: [{ id: "fill_0", objAId: "hline_0", objBId: "hline_1", type: "hline_hline", title: "Hlines Background" }], inputs: [{ id: "in_0", name: "lengthRSI", defval: 14, type: "integer", min: 1, max: 1e4 }, { id: "in_1", name: "lengthStoch", defval: 14, type: "integer", min: 1, max: 1e4 }, { id: "in_2", name: "smoothK", defval: 3, type: "integer", min: 1, max: 1e4 }, { id: "in_3", name: "smoothD", defval: 3, type: "integer", min: 1, max: 1e4 }], id: "Stochastic RSI@tv-basicstudies-1", scriptIdPart: "", name: "Stochastic RSI" }, constructor: function() { this.f_1 = function(t, e, i) { var n = i.new_var(o.Std.max(o.Std.change(t), 0)); return o.Std.rma(n, e, i) }, this.f_2 = function(t, e, i) { var n = i.new_var(-o.Std.min(o.Std.change(t), 0)); return o.Std.rma(n, e, i) }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f, m, g, v, y; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._input(0), r = this._input(1), s = this._input(2), a = this ._input(3), l = this._context.new_var(i), c = o.Std.rsi(this.f_1(l, n, this._context), this.f_2(l, n, this._context)), h = this._context .new_var(c), u = this._context.new_var(c), d = this._context.new_var(c), p = o.Std.stoch(h, u, d, r, this ._context), _ = this._context.new_var(p), f = o.Std.sma(_, s, this ._context), m = this._context.new_var(f), g = o.Std.sma(m, a, this ._context), v = f, y = g, [v, y] } } }, { name: "TRIX", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#800000" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 0 }], inputs: { in_0: 18 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "TRIX", histogramBase: 0, joinPoints: !1 } }, description: "TRIX", shortDescription: "TRIX", is_price_study: !1, bands: [{ id: "hline_0", name: "Zero" }], inputs: [{ id: "in_0", name: "length", defval: 18, type: "integer", min: 1, max: 2e3 }], id: "TRIX@tv-basicstudies-1", scriptIdPart: "", name: "TRIX" }, constructor: function() { this.f_0 = function(t) { return o.Std.log(t) }, this.f_1 = function(t) { return 1e4 * t }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _; return this._context = t, this._input = e, i = this._input(0), n = this.f_0( o.Std.close(this._context)), r = this._context.new_var(n), s = o.Std .ema(r, i, this._context), a = this._context.new_var(s), l = o.Std.ema( a, i, this._context), c = this._context.new_var(l), h = o.Std.ema(c, i, this._context), u = this._context.new_var(h), d = o.Std.change( u), p = this.f_1(d), _ = p, [_] } } }, { name: "Triple EMA", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#008000" } }, precision: 4, inputs: { in_0: 9 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Triple EMA", shortDescription: "TEMA", is_price_study: !0, inputs: [{ id: "in_0", name: "length", defval: 9, type: "integer", min: 1, max: 1e4 }], id: "Triple EMA@tv-basicstudies-1", scriptIdPart: "", name: "Triple EMA" }, constructor: function() { this.f_0 = function(t, e, i) { return 3 * (t - e) + i }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d; return this._context = t, this._input = e, i = this._input(0), n = o.Std .close(this._context), r = this._context.new_var(n), s = o.Std.ema(r, i, this._context), a = this._context.new_var(s), l = o.Std.ema(a, i, this._context), c = this._context.new_var(l), h = o.Std.ema(c, i, this._context), u = this.f_0(s, l, h), d = u, [d] } } }, { name: "True Strength Indicator", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 0 }], inputs: { in_0: 25, in_1: 13, in_2: 13 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "True Strength Indicator", shortDescription: "True Strength Indicator", is_price_study: !1, bands: [{ id: "hline_0", name: "Zero" }], inputs: [{ id: "in_0", name: "long", defval: 25, type: "integer", min: 1, max: 4999 }, { id: "in_1", name: "short", defval: 13, type: "integer", min: 1, max: 4999 }, { id: "in_2", name: "siglen", defval: 13, type: "integer", min: 1, max: 4999 }], id: "True Strength Indicator@tv-basicstudies-1", scriptIdPart: "", name: "True Strength Indicator" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a, l, c, h; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = this._input(2), s = o.Std.close(this._context), a = this ._context.new_var(s), l = o.Std.tsi(a, n, i, this._context), c = l, h = this._context.new_var(c), [c, o.Std.ema(h, r, this._context)] } } }, { name: "Ultimate Oscillator", metainfo: { _metainfoVersion: 41, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, inputs: { in_0: 7, in_1: 14, in_2: 28 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "UO", histogramBase: 0, joinPoints: !1, isHidden: !1 } }, description: "Ultimate Oscillator", shortDescription: "UO", is_price_study: !1, inputs: [{ id: "in_0", name: "length7", defval: 7, type: "integer", min: 1, max: 1e12 }, { id: "in_1", name: "length14", defval: 14, type: "integer", min: 1, max: 1e12 }, { id: "in_2", name: "length28", defval: 28, type: "integer", min: 1, max: 1e12 }], id: "ultimate_oscillator@tv-basicstudies-1", scriptIdPart: "", name: "Ultimate Oscillator" }, constructor: function() { this.f_0 = function(t, e, i) { var n = this._context.new_var(t), r = this._context.new_var(e); return [o.Std.sum(n, i, this._context) / o.Std.sum(r, i, this._context)] }, this.f_1 = function() { var t = this._input(0), e = this._input(1), i = this._input(2), n = this._context.new_var(o.Std.close(this._context)), r = o.Std.max(o.Std.high(this._context), n.get(1)), s = this._context.new_var(o.Std.close(this._context)), a = o.Std.min(o.Std.low(this._context), s.get(1)), l = o.Std.close(this._context) - a, c = r - a, h = this.f_0(l, c, t), u = this.f_0(l, c, e), d = this.f_0(l, c, i); return [100 * (4 * h[0] + 2 * u[0] + d[0]) / 7] }, this.main = function(t, e) { return this._context = t, this._input = e, this.f_1() } } }, { name: "VWAP", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: 0, transparency: 0, visible: !0, color: "#3A6CA8" } }, precision: 4 }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "VWAP", histogramBase: 0, joinPoints: !1, isHidden: !1 } }, description: "VWAP", shortDescription: "VWAP", is_price_study: !0, inputs: [], id: "VWAP@tv-basicstudies-1", scriptIdPart: "", name: "VWAP" }, constructor: function() { this.f_1 = function(t) { t.hist = null, t.add_hist() }, this.init = function(t, e) { this._isNewSession = o.Std.createNewSessionCheck(t) }, this.main = function(t, e) { var i, n, r, s; return this._context = t, this._input = e, i = t.new_var(), n = t.new_var(), this._context.symbol.time && (r = this._context.symbol.time, this ._isNewSession(r) && (this.f_1(i), this.f_1(n))), i.set(o.Std.nz(i .get(1)) + o.Std.hlc3(this._context) * o.Std.volume(this ._context)), n.set(o.Std.nz(n.get(1)) + o.Std.volume(this ._context)), s = i.get(0) / n.get(0), [s] } } }, { name: "VWMA", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" } }, precision: 4, inputs: { in_0: 20 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "VWMA", shortDescription: "VWMA", is_price_study: !0, inputs: [{ id: "in_0", name: "len", defval: 20, type: "integer", min: 1, max: 1e4 }], id: "VWMA@tv-basicstudies-1", scriptIdPart: "", name: "VWMA" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a; return this._context = t, this._input = e, i = o.Std.close(this._context), n = this._input(0), r = this._context.new_var(i), s = o.Std.vwma(r, n, this._context), a = s, [a] } } }, { name: "Volume Oscillator", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: 0 }], inputs: { in_0: 5, in_1: 10 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Volume Oscillator", shortDescription: "Volume Osc", is_price_study: !1, bands: [{ id: "hline_0", name: "Zero" }], inputs: [{ id: "in_0", name: "shortlen", defval: 5, type: "integer", min: 1, max: 4999 }, { id: "in_1", name: "longlen", defval: 10, type: "integer", min: 1, max: 4999 }], id: "Volume Oscillator@tv-basicstudies-1", scriptIdPart: "", name: "Volume Oscillator" }, constructor: function() { this.f_0 = function(t, e) { return 100 * (t - e) / e }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = o.Std.volume(this._context), s = this._context.new_var( r), a = o.Std.ema(s, i, this._context), l = this._context.new_var( r), c = o.Std.ema(l, n, this._context), h = this.f_0(a, c), u = h, [ u ] } } }, { name: "Vortex Indicator", metainfo: { _metainfoVersion: 42, isTVScript: !1, isTVScriptStub: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" } }, precision: 4, inputs: { in_0: 14 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }], styles: { plot_0: { title: "VI +", histogramBase: 0, joinPoints: !1, isHidden: !1 }, plot_1: { title: "VI -", histogramBase: 0, joinPoints: !1, isHidden: !1 } }, description: "Vortex Indicator", shortDescription: "VI", is_price_study: !1, is_hidden_study: !1, id: "vortex_indicator@tv-basicstudies-1", inputs: [{ id: "in_0", name: "Period", defval: 14, type: "integer", min: 2, max: 1e12 }], scriptIdPart: "", name: "Vortex Indicator" }, constructor: function() { this.f_0 = function() { var t = this._input(0), e = this._context.new_var(o.Std.low(this._context)), i = this._context.new_var(o.Std.abs(o.Std.high(this._context) - e.get( 1))), n = o.Std.sum(i, t, this._context), r = this._context.new_var(o.Std.high(this._context)), s = this._context.new_var(o.Std.abs(o.Std.low(this._context) - r.get( 1))), a = o.Std.sum(s, t, this._context), l = this._context.new_var(o.Std.atr(1, this._context)), c = o.Std.sum(l, t, this._context); return [n / c, a / c] }, this.main = function(t, e) { return this._context = t, this._input = e, this.f_0() } } }, { name: "Willams %R", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#000080" } }, precision: 4, bands: [{ color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: -20 }, { color: "#808080", linestyle: 2, linewidth: 1, visible: !0, value: -80 }], filledAreasStyle: { fill_0: { color: "#000080", transparency: 90, visible: !0 } }, inputs: { in_0: 14 } }, plots: [{ id: "plot_0", type: "line" }], styles: { plot_0: { title: "Plot", histogramBase: 0, joinPoints: !1 } }, description: "Williams %R", shortDescription: "%R", is_price_study: !1, bands: [{ id: "hline_0", name: "UpperLimit" }, { id: "hline_1", name: "LowerLimit" }], filledAreas: [{ id: "fill_0", objAId: "hline_0", objBId: "hline_1", type: "hline_hline", title: "Hlines Background" }], inputs: [{ id: "in_0", name: "length", defval: 14, type: "integer", min: 1, max: 2e3 }], id: "Willams %R@tv-basicstudies-1", scriptIdPart: "", name: "Willams %R" }, constructor: function() { this.f_0 = function(t, e, i) { return 100 * (t - e) / (e - i) }, this.main = function(t, e) { var i, n, r, s, a, l, c, h, u; return this._context = t, this._input = e, i = this._input(0), n = o.Std .high(this._context), r = this._context.new_var(n), s = o.Std.highest(r, i, this._context), a = o.Std.low(this._context), l = this._context .new_var(a), c = o.Std.lowest(l, i, this._context), h = this.f_0(o.Std .close(this._context), s, c), u = h, [u] } } }, { name: "Williams Alligator", metainfo: { _metainfoVersion: 27, isTVScript: !1, isTVScriptStub: !1, is_hidden_study: !1, defaults: { styles: { plot_0: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#0000FF" }, plot_1: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#FF0000" }, plot_2: { linestyle: 0, linewidth: 1, plottype: 0, trackPrice: !1, transparency: 35, visible: !0, color: "#008000" } }, precision: 4, inputs: { in_0: 21, in_1: 13, in_2: 8 } }, plots: [{ id: "plot_0", type: "line" }, { id: "plot_1", type: "line" }, { id: "plot_2", type: "line" }], styles: { plot_0: { title: "Jaw", histogramBase: 0, joinPoints: !1 }, plot_1: { title: "Teeth", histogramBase: 0, joinPoints: !1 }, plot_2: { title: "Lips", histogramBase: 0, joinPoints: !1 } }, description: "Williams Alligator", shortDescription: "Alligator", is_price_study: !0, inputs: [{ id: "in_0", name: "jawLength", defval: 21, type: "integer", min: 1, max: 2e3 }, { id: "in_1", name: "teethLength", defval: 13, type: "integer", min: 1, max: 2e3 }, { id: "in_2", name: "lipsLength", defval: 8, type: "integer", min: 1, max: 2e3 }], id: "Williams Alligator@tv-basicstudies-1", scriptIdPart: "", name: "Williams Alligator" }, constructor: function() { this.main = function(t, e) { var i, n, r, s, a, l, c, h, u, d, p, _, f; return this._context = t, this._input = e, i = this._input(0), n = this ._input(1), r = this._input(2), s = o.Std.hl2(this._context), a = this ._context.new_var(s), l = o.Std.ema(a, i, this._context), c = this ._context.new_var(s), h = o.Std.ema(c, n, this._context), u = this ._context.new_var(s), d = o.Std.ema(u, r, this._context), p = l, _ = h, f = d, [{ value: p, offset: 8 }, { value: _, offset: 5 }, { value: f, offset: 3 }] } } }, { name: "Williams Fractals", metainfo: { _metainfoVersion: 42, isTVScript: !1, isTVScriptStub: !1, defaults: { styles: { plot_0: { plottype: "shape_triangle_down", visible: !0, location: "BelowBar", transparency: 0, color: "#800000" }, plot_1: { plottype: "shape_triangle_up", visible: !0, location: "AboveBar", transparency: 0, color: "#808000" } }, precision: 4, inputs: { in_0: 2 } }, plots: [{ id: "plot_0", type: "shapes" }, { id: "plot_1", type: "shapes" }], styles: { plot_0: { title: "Down fractals", isHidden: !1 }, plot_1: { title: "Up fractals", isHidden: !1 } }, description: "Williams Fractal", shortDescription: "Fractals", is_price_study: !0, is_hidden_study: !1, id: "Williams Fractals@tv-basicstudies-1", inputs: [{ id: "in_0", name: "Periods", defval: 2, type: "integer", min: 2, max: 1e12 }], scriptIdPart: "", name: "Williams Fractals", isCustomIndicator: !0 }, constructor: function() { this.f_0 = function() { var t = this._input(0), e = this._context.new_var(o.Std.high(this._context)), i = o.Std.or(o.Std.and(o.Std.and(o.Std.lt(e.get(t + 2), e.get(t)), o.Std .lt(e.get(t + 1), e.get(t))), o.Std.and(o.Std.lt(e.get(t - 1), e.get(t)), o.Std.lt(e.get(t - 2), e.get(t)))), o.Std.or(o .Std.or(o.Std.and(o.Std.lt(e.get(t + 3), e.get(t)), o.Std.and(o .Std.and(o.Std.lt(e.get(t + 2), e.get(t)), o.Std.eq( e.get(t + 1), e.get(t))), o.Std.and(o.Std.lt(e .get(t - 1), e.get(t)), o.Std.lt(e.get(t - 2), e.get(t))))), o.Std.and(o.Std.and(o.Std.lt(e .get(t + 4), e.get(t)), o.Std.lt(e.get(t + 3), e .get(t))), o.Std.and(o.Std.and(o.Std.eq(e.get(t + 2), e.get(t)), o.Std.le(e.get(t + 1), e.get( t))), o.Std.and(o.Std.lt(e.get(t - 1), e.get( t)), o.Std.lt(e.get(t - 2), e.get(t)))))), o.Std.or(o.Std .and(o.Std.and(o.Std.lt(e.get(t + 5), e.get(t)), o.Std.and(o .Std.lt(e.get(t + 4), e.get(t)), o.Std.eq(e.get( t + 3), e.get(t)))), o.Std.and(o.Std.and(o.Std .eq(e.get(t + 2), e.get(t)), o.Std.le(e.get(t + 1), e.get(t))), o.Std.and(o.Std.lt(e.get(t - 1), e.get(t)), o.Std.lt(e.get(t - 2), e.get( t))))), o.Std.and(o.Std.and(o.Std.and(o.Std.lt(e.get(t + 6), e.get(t)), o.Std.lt(e.get(t + 5), e.get( t))), o.Std.and(o.Std.eq(e.get(t + 4), e.get( t)), o.Std.le(e.get(t + 3), e.get(t)))), o.Std.and(o .Std.and(o.Std.eq(e.get(t + 2), e.get(t)), o.Std.le( e.get(t + 1), e.get(t))), o.Std.and(o.Std.lt(e .get(t - 1), e.get(t)), o.Std.lt(e.get(t - 2), e.get(t)))))))), n = this._context.new_var(o.Std.low(this._context)); return [o.Std.or(o.Std.and(o.Std.and(o.Std.gt(n.get(t + 2), n.get(t)), o.Std .gt(n.get(t + 1), n.get(t))), o.Std.and(o.Std.gt(n.get( t - 1), n.get(t)), o.Std.gt(n.get(t - 2), n.get(t)))), o.Std .or(o.Std.or(o.Std.and(o.Std.gt(n.get(t + 3), n.get(t)), o.Std .and(o.Std.and(o.Std.gt(n.get(t + 2), n.get(t)), o .Std.eq(n.get(t + 1), n.get(t))), o.Std.and( o.Std.gt(n.get(t - 1), n.get(t)), o.Std.gt(n .get(t - 2), n.get(t))))), o.Std.and(o.Std .and(o.Std.gt(n.get(t + 4), n.get(t)), o.Std.gt(n .get(t + 3), n.get(t))), o.Std.and(o.Std.and(o .Std.eq(n.get(t + 2), n.get(t)), o.Std.ge(n .get(t + 1), n.get(t))), o.Std.and(o.Std .gt(n.get(t - 1), n.get(t)), o.Std.gt(n.get( t - 2), n.get(t)))))), o.Std.or(o.Std.and(o.Std .and(o.Std.gt(n.get(t + 5), n.get(t)), o.Std.and(o .Std.gt(n.get(t + 4), n.get(t)), o.Std.eq(n .get(t + 3), n.get(t)))), o.Std.and(o.Std .and(o.Std.eq(n.get(t + 2), n.get(t)), o.Std.ge( n.get(t + 1), n.get(t))), o.Std.and(o.Std .gt(n.get(t - 1), n.get(t)), o.Std.gt(n.get( t - 2), n.get(t))))), o.Std.and(o.Std .and(o.Std.and(o.Std.gt(n.get(t + 6), n.get(t)), o .Std.gt(n.get(t + 5), n.get(t))), o.Std.and( o.Std.eq(n.get(t + 4), n.get(t)), o.Std.ge(n .get(t + 3), n.get(t)))), o.Std.and(o.Std .and(o.Std.eq(n.get(t + 2), n.get(t)), o.Std.ge( n.get(t + 1), n.get(t))), o.Std.and(o.Std .gt(n.get(t - 1), n.get(t)), o.Std.gt(n.get( t - 2), n.get(t)))))))), i] }, this.main = function(t, e) { this._context = t, this._input = e; var i = this.f_0(); return [{ value: i[0], offset: -2 }, { value: i[1], offset: -2 }] } } }] }, function(t, e, i) { "use strict"; var o, n, r, s, a, l, c, h; Object.defineProperty(e, "__esModule", { value: !0 }), o = i(0), n = i(2), r = i(39), s = i(14), a = i(85), l = i(368), c = i(1025), h = function(t) { function e(e) { var i = t.call(this, e) || this; return i._handleClick = function() { i._handleToggleDropdown() }, i._handleToggleDropdown = function(t) { var e = i.state.isOpened, o = "boolean" == typeof t ? t : !e; i.setState({ isOpened: o }) }, i._handleClose = function() { i._handleToggleDropdown(!1) }, i._getDropdownPosition = function() { var t = r.findDOMNode(i).getBoundingClientRect(); return { x: t.left + (i.props.directionHorz === a.DirectionHorz.ToLeft ? t.width : 0), y: t.bottom + 2 } }, i.state = { isOpened: !1 }, i } return o.__extends(e, t), e.prototype.render = function() { var t, e = this.props, i = e.id, o = e.arrow, r = e.children, h = e.content, u = e.directionHorz, d = e.isDisabled, p = e.minWidth, _ = e.title, f = e.className, m = this.state.isOpened, g = s(f, c.button, "apply-common-tooltip", (t = {}, t[c.isDisabled] = d, t[c .isOpened] = m, t)); return n.createElement("div", { id: i, className: g, onClick: d ? void 0 : this._handleClick, title: _ }, h, o && n.createElement("div", { className: c.arrow }, n.createElement("div", { className: c.arrowWrap }, n.createElement(l.ToolWidgetCaret, { dropped: m }))), n.createElement(a.PopupMenu, { closeOnClickOutside: this.props.closeOnClickOutside, directionHorz: u, doNotCloseOn: this, isOpened: m, minWidth: p, onClose: this._handleClose, position: this._getDropdownPosition }, r)) }, e.defaultProps = { arrow: !0, closeOnClickOutside: !0 }, e }(n.PureComponent), e.ToolWidgetMenu = h }, function(t, e, i) { "use strict"; function o(t) { var e = t.className, i = n.__rest(t, ["className"]); return r.createElement(a.ToolWidgetButton, n.__assign({}, i, { className: s(e, l.button) })) } var n, r, s, a, l; Object.defineProperty(e, "__esModule", { value: !0 }), n = i(0), r = i(2), s = i(14), a = i(103), l = i(1033), e.ToolWidgetIconButton = o }, function(t, e, i) { "use strict"; function o(t, e, i) { var o, n, r, s, a; for (void 0 === i && (i = {}), o = Object.assign({}, e), n = 0, r = Object.keys(e); n < r .length; n++) s = r[n], (a = i[s] || s) in t && (o[s] = [t[a], e[s]].join(" ")); return o } Object.defineProperty(e, "__esModule", { value: !0 }), e.weakComposeClasses = o }, function(t, e, i) { "use strict"; (function(t) { function o(t, e) { this._model = e, this._bindings = [], this._property = t, this.supportThemeSwitcher = !1 } function n(t) { return t.toUpperCase() } function r(t) { return function(e) { return e < t ? t : e } } function s(t) { return function(e) { return e > t ? t : e } } function a(t) { return function(e) { var i = parseInt(e, 10); return M(i) ? t : i } } function l(t) { var e = new B; return function(i) { var o = e.parse(i); return M(o) ? t : o } } function c(t) { var e = new B; return function(i) { var o = e.parse(i); return M(o) ? t() : o } } function h(t, e) { var i = new z(e); return function(e) { var o = i.format(e); return M(o) ? t : o } } function u() { return function(t) { for (var e = t, i = t.replace(/[^\u0000-\u007F]/, ""); i.length !== e.length;) e = i, i = e.replace(/[^\u0000-\u007F]/, ""); return i } } function d(t) { return function(e) { return 0 === e.length ? t : e } } function p(t, e, i, o, n, r, s) { W.call(this, t, e, o, n, r), this._transformFunction = i, this._setter = s, this ._attachToControl(t, o) } function _(t, e, i, o, n) { p.call(this, t, e, l(e.value()), i, o, n), this.addFormatter(function(t) { return (new B).format(t) }) } function f(t, e, i, o, n, r) { this._subControlIds = e, W.call(this, t, i, o, n, r), this._forEachSubControl(function(t) { this._attachToControl(t, o) }) } function m(t, e, i, o, n, r, s) { this._model = o, this._mainSeries = r, this._toIntTransformer = a(s), this._disabled = !1, W .call(this, t, e, i, o, n); var l = this; i && t.change(function() { l.setValueToProperty(l.value()) }), this._mainSeries.onBarReceived().subscribe(this, function() { l.setValue(this.property().value()) }) } function g(t, e, i, o, n) { W.call(this, t, e, i, o, n), i && t.on("accept-symbol", function(t, e) { this.setValueToProperty(e) }.bind(this)) } function v(t, e, i, o, n, r, s, a) { W.call(this, t, e, o, n, r), this._transformFunction = i, this._propertyChangedHook = a, this._setter = s; var l = this; o && t.change(function() { l._setter ? l._setter.call(l, l.value()) : l.setValueToProperty(l.value()) }) } function y(t, e) { W.call(this, t, e) } function b(t, e, i, o, n, r) { if (!t.is(":checkbox, :radio")) return new w(t, e, i, o, n); W.call(this, t, e, i, o, n), this._setter = r; var s = this; i && t.change(function() { s._setter ? s._setter.call(s, s.value()) : s.setValueToProperty(s.value()) }) } function S(t, e, i, o, n, r) { W.call(this, t, e, i, o, n), this._inverted = !0 === r } function w(t, e, i, o, n) { W.call(this, t, e, i, o, n); var r = this; i && t.click(function() { var t = $(this).toggleClass("active").hasClass("active"); r.setValueToProperty(t) }) } function T(t, e, i, o, n, r) { var s, a; s = t.is("input") ? t : t.find("input"), W.call(this, s, e, i, o, n), this ._transparencyProperty = r, this.applyOldTransparency(), a = this, i && s.change( function() { a.setValueToProperty(a.value()) }) } function C(e, i, o, n, r, s) { function a(t, e) { var i = c.control().slider("option", "min"), o = c.control().slider("option", "max"), n = c._property.value(); (i <= n && n <= o || i < e.value && e.value < o) && c.setValueToProperty(e.value) } function l(t, e) { c.setValueToProperty(e.value) } isNumber(i.value()) || (H.logWarn( "Property cannot be binded to control, bad value (expect number): " + i.value() ), i = new t), W.call(this, e, i, o, n, r); var c = this; o && (s ? (e.bind("slidechange", a), e.bind("slide", a)) : (e.bind("slidechange", l), e .bind("slide", l))), e.bind("slidestart", function(t, e) { n.beginUndoMacro(r) }), e.bind("slidestop", function(t, e) { n.endUndoMacro() }) } function x(t, e, i, o, n, r) { b.call(this, t, e, o, n, r), this._intervalProperty = i, this._intervalProperty.listeners() .subscribe(this, this.onIntervalChanged), this.onIntervalChanged() } function P(t, e, i, o, n) { this._control = t, this._wv = e, this._transformFunction = i, this._undoModel = o, this ._undoText = n, this._attachToControl(this._control), this._setValueBinded = this .setValue.bind(this) } function L(t, e, i, o, n, r) { this._not = !!r, P.apply(this, arguments) } function I(t, e, i, o, n, r, s, a) { this._propFrom = e[0], this._propTo = e[1], this._control = t, this._applyOnFly = o, this ._undoModel = n, this._undoText = s, this._properties = e, this._inputsText = r, this ._transformers = i; var l = this; t.slider({ range: !0, min: i[0], max: i[1], values: [l._propFrom.value(), l._propTo.value()] }), this.$rangeHandleFrom = $(t.find(".ui-slider-handle")[0]).addClass("from"), this .$rangeHandleTo = $(t.find(".ui-slider-handle")[1]).addClass("to"), this.setValue(this ._propFrom, 0), this.setValue(this._propTo, 1), a && ($(a).on("change", function( t) { $(this).is(":checked") ? (l._control.slider("enable"), $(l._inputsText[0]) .prop("disabled", !1), $(l._inputsText[1]).prop("disabled", !1)) : ( l._control.slider("disable"), $(l._inputsText[0]).prop("disabled", ! 0), $(l._inputsText[1]).prop("disabled", !0)) }), $(a).is(":checked") ? (l._control.slider("enable"), $(l._inputsText[0]).prop( "disabled", !1), $(l._inputsText[1]).prop("disabled", !1)) : (l._control.slider( "disable"), $(l._inputsText[0]).prop("disabled", !0), $(l._inputsText[1]) .prop("disabled", !0))), r && ($(r[0]).val(this._control.slider("values", 0)), $(r[ 1]).val(this._control.slider("values", 1)), t.slider({ slide: function(t, e) { $(r[0]).val(e.values[0]), $(r[1]).val(e.values[1]) } }), $(r).each(function() { $(this).on("keydown", function(t) { parseInt($(r[0]).val()) < l._transformers[0] ? $(r[0]).val(l ._transformers[0]) : parseInt($(r[1]).val()) > l ._transformers[1] && $(r[1]).val(l._transformers[1]), -1 !== $.inArray(t.keyCode, [46, 8, 9, 27, 13, 110, 190]) || 65 === t.keyCode && !0 === t.ctrlKey || 67 === t.keyCode && !0 === t.ctrlKey || 88 === t.keyCode && !0 === t.ctrlKey || t .keyCode >= 35 && t.keyCode <= 39 || (t.shiftKey || t .keyCode < 48 || t.keyCode > 57) && (t.keyCode < 96 || t .keyCode > 105) && t.preventDefault() }) }), $(r[0]).on("keyup", function(t) { parseInt($(this).val()) < l._transformers[0] ? $(this).val(l._transformers[ 0]) : parseInt($(this).val()) > l._transformers[1] && $(this).val(l ._transformers[1]), parseInt($(this).val()) > parseInt($(r[1]) .val()) && $(this).val(r[1].val()), l._control.slider("values", 0, $( this).val()), I.prototype.setValueToProperty.call(l, l._control .slider("values"), "from") }), $(r[1]).on("keyup", function(t) { parseInt($(this).val()) < l._transformers[0] ? $(this).val(l._transformers[ 0]) : parseInt($(this).val()) > l._transformers[1] && $(this).val(l ._transformers[1]), parseInt($(this).val()) < $(r[0]).val() && $(this).val(r[0].val()), l ._control.slider("values", 1, $(this).val()), I.prototype .setValueToProperty.call(l, l._control.slider("values"), "to") })), this._propFrom.listeners().subscribe(this, I.prototype.propertyChanged), this ._propTo.listeners().subscribe(this, I.prototype.propertyChanged), o && t.on("slide", function(t, e) { l.setValueToProperty(l._control.slider("values"), e.handle) }), t.slider({ stop: function(t, e) { r && ($(r[0]).val(l._control.slider("values", 0)), $(r[1]).val(l ._control.slider("values", 1))), l.setValueToProperty(l._control .slider("values"), e.handle) }, start: function(t, e) { r && ($(r[0]).val(l._control.slider("values", 0)), $(r[1]).val(l ._control.slider("values", 1))), l.setValueToProperty(l._control .slider("values"), e.handle) } }) } function k(t, e, i, o, n, r) { W.call(this, t, e, i, o, n), this._separator = r || " "; var s = this; i && t.change(function() { s.setValueToProperty(s.value()) }) } var A, M, E, D, V, O, R, B, z, F, N, W, H; i(384), A = i(9).ensureNotNull, M = i(198).isNaN, E = i(32), D = E.rgba, V = E.rgbaToString, O = E.parseRgb, R = i(212).TimePointIndexSearchMode, B = i(89).NumericFormatter, z = i(213) .LimitedPrecisionNumericFormatter, F = i(30), N = i(372).addColorPicker, W = i(320).Binding, H = i(7).getLogger("Chart.PropertyPage"), o.prototype.model = function() { return this._model }, o.prototype.bindControl = function(t) { return this._bindings.push(t), t }, o.prototype.unbindControl = function(t) { var e = this._bindings.indexOf(t); - 1 !== e && this._bindings.splice(e, 1) }, o.prototype.loadData = function() { var t, e, i; for (t = 0; t < this._bindings.length; t++) e = this._bindings[t], e.properties ? (i = e .properties(), e.setValue(i[0], 0), e.setValue(i[1], 1)) : e.property && (e .transparencyProperty && e.transparencyProperty() ? e.applyOldTransparency() : e .setValue(e.property().value())) }, o.prototype.saveData = function() { var t, e; for (this._model.beginUndoMacro(), t = 0; t < this._bindings.length; t++) e = this ._bindings[t], e.changed() && this._model.setProperty(e.property(), e.value()); this._model.endUndoMacro() }, o.prototype.createColorPicker = function(t) { return N(null, t) }, o.prototype.createTextEditor = function(t, e) { var i = {}; return t && (i.width = t), e && (i.height = e), $(document.createElement("textarea")) .css(i).addClass("tv-control-input") }, o.prototype.createCombo = function(t) { var e = $(document.createElement("select")), i = t.reduce(function(t, e) { return t.add($(document.createElement("option")).prop({ value: e, text: e })) }, $()); return e.append(i) }, o.prototype.createKeyCombo = function(t) { var e = $(document.createElement("select")); return $.each(t || [], function(t, i) { $(document.createElement("option")).prop({ value: t, text: i }).appendTo(e) }), e }, o.prototype.createFontEditor = function(t) { var e = t || TradingView.factoryDefaults("chartproperties.editorFontsList"); return this.createCombo(e) }, o.prototype.createFontSizeEditor = function(t) { var e = t || [10, 11, 12, 14, 16, 20, 24, 28, 32, 40]; return this.createCombo(e).addClass("tv-select-container-fontsize") }, o.prototype.createSeriesMinTickEditor = function() { var t, e, i, o, n = "", $(n) }, o.prototype.createPrecisionEditor = function() { var t, e = "", $(e) }, o.prototype.createLabeledCell = function(t, e, i) { var o, n, r, s, a = null; return "number" == typeof t.valueOf() ? (a = t, o = e, n = i) : (o = t, n = e), o += "", r = this._labelToId(o), s = $(""), $("