← К каталогу
Исходный код · ID 4133

Dual-Phase Reversal by DGT

indicator dual-phase reversal by dgt for tradingview.pine
Вы автор или правообладатель?

Сообщите нам, если считаете, что материал размещён без разрешения.

Краткий обзор

О программе

Индикатор «Dual-Phase Reversal by DGT» — это инструмент анализа TradingView на Pine Script v6, отслеживающий последовательное истощение тренда в двух фазах: фазе импульсного истощения (Momentum Exhaustion, 9 шагов) и фазе терминального истощения (Terminal Exhaustion, 13 шагов). Каждая фаза визуализируется на графике помеченными метками и линиями поддержки/сопротивления, позволяя пользователю наблюдать за развитием разворачивающихся движений цены.

Помимо фаз истощения, индикатор отображает уровни опор, пивота и сопротивления, рассчитанные по диапазонам более высоких таймфреймов, включая режимы текущего формирующегося и исторического диапазонов. Встроенный осциллятор объёмного давления оценивает относительное давление покупок и продаж на основе направления ценового движения и объёма, нормализуясь в диапазон 0–100.

Индикатор также включает раскрашивание свечей по объёму, информационную панель с текущим состоянием фаз, пивотов и давления, а также систему оповещений для пересечений ключевых уровней и завершения фаз. Все элементы отображаются непосредственно на графике через линии, метки и графические объекты Pine Script.

Настройки программы

НастройкаОписание
showPhaseMarkers Режим отображения маркеров фаз: «Completed Only» — только завершённые фазы, «All Sequence Steps» — все шаги по мере развития, «None» — скрыть маркеры фаз.
phaseSRLevels Отображает динамические уровни поддержки и сопротивления, полученные из завершённых фаз импульсного истощения. Уровни остаются активными до пересечения ценой.
stopLevels Отображает уровни аннулирования (invalidation), полученные из экстремумов цен, установленных во время фаз импульсного и терминального истощения. Каждый уровень остаётся активным до пересечения ценой.
htf Таймфрейм для расчёта пивота диапазона. Режим «Auto» автоматически выбирает таймфрейм на основе таймфрейма графика.
i_isPivot Включает отображение уровней опоры, пивота и сопротивления, рассчитанных по диапазону выбранного таймфрейма.
i_dispPVT Отображает уровни поддержки, пивота и сопротивления текущего, ещё формирующегося диапазона более высокого таймфрейма в реальном времени до его закрытия.
i_disphist Отображает исторические уровни поддержки, пивота и сопротивления завершённых диапазонов более высокого таймфрейма.
color_r Цвет линии и меток уровня сопротивления на графике.
color_s Цвет линии и меток уровня поддержки на графике.
isPressureEnabled Включает или отключает осциллятор объёмного давления, оценивающий относительное давление покупок и продаж.
oscColor Цвет линии осциллятора объёмного давления.
pressureLength Длина периода расчёта осциллятора объёмного давления.
upperBand Верхняя граница зоны осциллятора объёмного давления в процентах.
lowerBand Нижняя граница зоны осциллятора объёмного давления в процентах.
oscLookbackLength Количество баров, отображаемых в осцилляторе объёмного давления.
oscPlacement Расположение осциллятора объёмного давления на графике: сверху, по центру или снизу.
oscVerticalOffset Вертикальное смещение осциллятора объёмного давления при расположении по центру.
vwcb Включает раскрашивание свечей в зависимости от текущего объёма относительно его скользящего среднего. Свечи с высоким и низким объёмом получают более выразительную визуальную окраску.
upThesh Множитель для определения высокообъёмных свечей: свечи считаются высокообъёмными, если объём превышает среднее значение на этот множитель.
showDashboard Включает или отключает информационную панель с данными о текущих фазах, пивотах и давлении.
dashboardPosition Позиция информационной панели на графике: верхний правый, верхний левый или нижний левый угол.
Получить полный код

Поиск по коду файла

f_drawLineX(_x1, _y1, _x2, _y2, _xloc, _extend, _color, _style, _width) =>
    var id = line.new(_x1, _y1, _x2, _y2, _xloc, _extend, _color, _style, _width)
    if _y1 > 0 and _y2 > 0
        line.set_xy1(id, _x1, _y1)
        line.set_xy2(id, _x2, _y2)
        line.set_color(id, _color)
    else
        line.set_xy1(id, _x1, close)
        line.set_xy2(id, _x2, close)
        line.set_color(id, #00000000)

f_drawLabelX(_x, _y, _text, _xloc, _yloc, _color, _style, _textcolor, _size, _textalign, _tooltip) =>
    var id = label.new(_x, _y, _text, _xloc, _yloc, _color, _style, _textcolor, _size, _textalign, _tooltip)
    label.set_text(id, _text)
    label.set_tooltip(id, _tooltip)
    if _y > 0
        label.set_xy(id, _x, _y)
        label.set_textcolor(id, _textcolor)
    else
        label.set_xy(id, _x, close)
        label.set_textcolor(id, #00000000)

f_crossingLevelX(_price, _level) =>
    not na(_level) and _level != 0 and ((_level > _price and _level < _price[1]) or (_level < _price and _level > _price[1]))

f_processPivotLevelX(_show, _x1, _y, _x2, _c, _s, _w, _lb, _tip) =>
    if _show
        style = _s == 'Solid' ? line.style_solid : _s == 'Dotted' ? line.style_dotted : line.style_dashed
        f_drawLineX(_x1, _y, _x2, _y, xloc.bar_time, extend.none, _c, style, _w)
        f_drawLabelX(_x2, _y, _lb + ' (' + str.tostring(_y, format.mintick) + ')', xloc.bar_time, yloc.price, #00000000, label.style_label_left, _c, size.normal, text.align_left, _tip + ' ' + _lb + '\n' + str.tostring(_y, format.mintick))
    if f_crossingLevelX(close, _y) and _tip != 'Developing Range Pivot'
        alert(syminfo.ticker + ' crossing ' + _tip + ' ' + _lb + ' level, price ' + str.tostring(_y, format.mintick))

f_htf_ohlc(_htf) =>
    var htf_o  = 0., var htf_h  = 0., var htf_l  = 0., htf_c  = close
    var htf_ox = 0., var htf_hx = 0., var htf_lx = 0., var htf_cx = 0.
    if ta.change(time(_htf)) != 0
        htf_ox := htf_o
        htf_o  := open
        htf_hx := htf_h
        htf_h  := high
        htf_lx := htf_l
        htf_l  := low
        htf_cx := htf_c[1]
        htf_c := close
        htf_cx
    else
        htf_h := math.max(high, htf_h)
        htf_l := math.min(low, htf_l)
        htf_l
    [htf_ox, htf_hx, htf_lx, htf_cx, htf_o, htf_h, htf_l, htf_c]

f_get_pivot(_o, _h, _l, _c, _o0) =>
    var r1x = 0., var px  = 0., var s1x = 0.
    x = _c < _o ? _h + 2 * _l + _c : _c > _o ? 2 * _h + _l + _c : _h + _l + 2 * _c
    px  := x / 4
    s1x := x / 2 - _h
    r1x := x / 2 - _l
    [r1x, px, s1x]

ma(_source, _length, _type) =>
    switch _type
        "SMA"  => ta.sma (_source, _length)
        "EMA"  => ta.ema (_source, _length)
        "RMA"  => ta.rma (_source, _length)
        "WMA"  => ta.wma (_source, _length)
        "VWMA" => ta.vwma(_source, _length)

indicator("Dual-Phase Reversal by DGT", "DPR ☼☾", true, max_labels_count = 500, max_lines_count = 500, max_boxes_count = 500, max_bars_back = 5000)

display = display.all - display.status_line

group_phase9   = 'Dual-Phase Exhaustion'
tooltip_phase9 = 'Tracks sequential trend exhaustion across two distinct phases: Momentum Exhaustion and Terminal Exhaustion.\n\n' +
                  '• Completed Only: Displays completed Momentum and Terminal phase markers.\n' +
                  '• All Sequence Steps: Displays the full sequence as it develops.\n' +
                  '• None: Hides phase markers.'

showPhaseMarkers = input.string('Completed Only', 'Phase Display Mode', options = ['Completed Only', 'All Sequence Steps', 'None'], display = display, group = group_phase9, tooltip = tooltip_phase9)

compltedPhases = showPhaseMarkers == 'Completed Only'
showNone       = showPhaseMarkers == 'None' ? false : true

phaseSRLevels = input.bool(true, 'Momentum Support & Resistance Levels', group = group_phase9, tooltip = 'Projects dynamic Support and Resistance levels derived from completed Momentum Exhaustion phases. Levels remain active until price crosses the corresponding level.')
stopLevels    = input.bool(false, 'Momentum & Terminal Invalidation Levels', group = group_phase9, tooltip = 'Displays structural invalidation levels derived from the price extremes established during Momentum and Terminal Exhaustion phases. Each level remains active until price crosses it.')

group_pivot = 'Range Pivot Settings'
tooltip_pivot = 'Displays higher-timeframe Support (S), Pivot (P), and Resistance (R) levels calculated from the selected range.'

htf        = input.string('Auto', 'Pivot Timeframe', display = display, options=['Auto', '1 Hour', '4 Hour', 'Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly'], group=group_pivot, tooltip = 'Selects the higher-timeframe range used to calculate Support (S), Pivot (P), and Resistance (R) levels. Auto selects the range according to the chart timeframe.')
htf_user   = htf == '1 Hour' ? '60' : htf == '4 Hour' ? '240' : htf == 'Daily' ? 'D' : htf == 'Weekly' ? 'W' : htf == 'Monthly' ? 'M' : htf == 'Quarterly' ? '3M' : '12M'
htf_auto   = timeframe.period == '1'   ? '60'  :
             timeframe.period == '3'   ? '60'  :
             timeframe.period == '5'   ? '240' :
             timeframe.period == '15'  ? '240' :
             timeframe.period == '30'  ? 'D'   :
             timeframe.period == '45'  ? 'D'   :
             timeframe.period == '60'  ? 'D'   :
             timeframe.period == '120' ? 'W'   :
             timeframe.period == '180' ? 'W'   :
             timeframe.period == '240' ? 'W'   :
             timeframe.period == '1D'  ? 'M'   :
             timeframe.period == '1W'  ? '3M'  : '12M'

i_htf      = htf == 'Auto' ? htf_auto : htf_user
i_isPivot  = input.bool(true, 'Range Pivot', group=group_pivot, tooltip = tooltip_pivot)
i_dispPVT  = input.bool(false, 'Developing Range Pivot', group=group_pivot, tooltip = 'Projects Support, Pivot, and Resistance levels from the current, still-forming higher-timeframe range — an early preview of the next range\'s pivot, updating in real time as the range develops, before it closes.')
i_disphist = input.bool(false, 'Historical Range Pivot', group=group_pivot, tooltip = 'Displays the historical Support, Pivot, and Resistance levels of completed higher-timeframe ranges.')
color_r    = input.color(color.red, '  Resistance', inline='col', group=group_pivot)
color_s    = input.color(color.teal, 'Support', inline='col', group=group_pivot)

tooltip_pressure  = 'Volume Pressure Oscillator\nEstimates relative buying and selling pressure by weighting directional price movement within each bar\'s range by traded volume.\nThe resulting oscillator is normalized to a 0–100 scale, where higher values indicate greater relative buying pressure and lower values indicate greater relative selling pressure.'
group_pressure    = 'Volume Pressure Settings'
isPressureEnabled = input.bool(true, 'Volume Pressure', inline = 'PRS', group=group_pressure, tooltip = tooltip_pressure)
oscColor          = input.color(#00bcd4, '', inline = 'PRS',  group=group_pressure)
pressureLength    = input.int(13, '  Pressure Length', display = display, minval=1, group=group_pressure)
upperBand         = input.int(75, '  Pressure Upper Band', display = display, group=group_pressure)
lowerBand         = input.int(25, '  Pressure Lower Band', display = display, group=group_pressure)
oscLookbackLength = input.int(200, '  Display Length', display = display, minval = 10, step = 10, maxval = 475, group=group_pressure)
oscLookbackLength := last_bar_index < oscLookbackLength ? last_bar_index : oscLookbackLength
oscPlacement      = input.string('Bottom', '  Placement', display = display, options = ['Top', 'Middle', 'Bottom'], group=group_pressure)
oscHight          = 11 - input.int(9, '  Height' , display = display, minval = 1, maxval = 10 , group=group_pressure )
oscVerticalOffset = input.int(5, "  Vertical Offset", display = display, minval = -3, maxval = 10, group=group_pressure) / 10
fillColor         = color.new(#2962FF, 97)

priceOpen  = open
priceHigh  = high
priceLow   = low
priceClose = close

buyPhaseCondition  = priceClose < priceClose[4]
sellPhaseCondition = priceClose > priceClose[4]

buyMomentumShift  = priceClose < priceClose[4] and priceClose[1] > priceClose[5]
sellMomentumShift = priceClose > priceClose[4] and priceClose[1] < priceClose[5]

var buyCount  = 0
var sellCount = 0

if buyPhaseCondition
    buyCount  := (buyCount == 0 or buyCount == 9) ? (buyMomentumShift ? 1 : 0) : buyCount + 1
    sellCount := 0
else if sellPhaseCondition
    sellCount := (sellCount == 0 or sellCount == 9) ? (sellMomentumShift ? 1 : 0) : sellCount + 1
    buyCount  := 0
else
    buyCount  := 0
    sellCount := 0

buyPhaseQualified  = (priceLow  <= priceLow[3]  and priceLow  <= priceLow[2])  or (priceLow[1]  <= priceLow[3]  and priceLow[1]  <= priceLow[2] )
sellPhaseQualified = (priceHigh >= priceHigh[3] and priceHigh >= priceHigh[2]) or (priceHigh[1] >= priceHigh[3] and priceHigh[1] >= priceHigh[2])

plotshape(showNone and buyCount == 1 and not compltedPhases, 'Buy ME 1', shape.labeldown, location.abovebar, #00000000, 0, '₁', color.red, false, display = display)
plotshape(showNone and buyCount == 2 and not compltedPhases, 'Buy ME 2', shape.labeldown, location.abovebar, #00000000, 0, '₂', color.red, false, display = display)
plotshape(showNone and buyCount == 3 and not compltedPhases, 'Buy ME 3', shape.labeldown, location.abovebar, #00000000, 0, '₃', color.red, false, display = display)
plotshape(showNone and buyCount == 4 and not compltedPhases, 'Buy ME 4', shape.labeldown, location.abovebar, #00000000, 0, '₄', color.red, false, display = display)
plotshape(showNone and buyCount == 5 and not compltedPhases, 'Buy ME 5', shape.labeldown, location.abovebar, #00000000, 0, '₅', color.red, false, display = display)
plotshape(showNone and buyCount == 6 and not compltedPhases, 'Buy ME 6', shape.labeldown, location.abovebar, #00000000, 0, '₆', color.red, false, display = display)
plotshape(showNone and buyCount == 7 and not compltedPhases, 'Buy ME 7', shape.labeldown, location.abovebar, #00000000, 0, '₇', color.red, false, display = display)
plotshape(showNone and buyCount == 8 and not compltedPhases and not buyPhaseQualified, 'Buy ME 8', shape.labeldown, location.abovebar, #00000000, 0, '₈', color.red, false, display = display)
plotshape(showNone and buyCount == 8 and not compltedPhases and buyPhaseQualified, 'Buy ME 8 Qualified', shape.labeldown, location.abovebar, color.new(color.teal, 75), 0, 'ǫ₈', color.white, false, display = display)
plotshape(showNone and buyCount == 9 and not buyPhaseQualified, 'Buy ME 9', shape.labelup, location.belowbar, color.new(color.teal, 25), 0, 'ᴍ', color.white, true, size.tiny, display = display)
plotshape(showNone and buyCount == 9 and buyPhaseQualified, 'Buy ME 9 Qualified', shape.labelup, location.belowbar, color.new(color.teal, 25), 0, 'ᴍ\nǫ', color.white, true, size.tiny, display = display)

phase9Resistance = ta.highest(9)
buyPhaseResistance = 0.0
buyPhaseResistance := buyCount == 9 ? phase9Resistance : priceClose > buyPhaseResistance[1] ? 0 : buyPhaseResistance[1]
plot(phaseSRLevels and buyPhaseResistance > 0 ? buyPhaseResistance : na, "ME Resistance", color.red, 1, plot.style_linebr, display = display)

var buyPhaseHigh   = 0.
var buyPhaseLowest = 0.

if buyCount == 1
    buyPhaseLowest := priceLow

if buyCount > 0
    buyPhaseLowest := math.min(priceLow, buyPhaseLowest)
    if priceLow == buyPhaseLowest
        buyPhaseHigh := priceHigh

buyPhaseStopPrice = 2 * buyPhaseLowest - buyPhaseHigh
buyPhaseStopLevel = 0.0
buyPhaseStopLevel := buyCount == 9 ? buyPhaseStopPrice : priceClose < buyPhaseStopLevel[1] ? 0 : buyPhaseStopLevel[1]
plot(stopLevels and buyPhaseStopLevel > 0 ? buyPhaseStopLevel : na, "ME Buy Invalidation", color.blue, 1, plot.style_circles, display = display)

plotshape(showNone and sellCount == 1 and not compltedPhases, 'Sell ME 1', shape.labeldown, location.abovebar, #00000000, 0, '₁', color.teal, false, display = display)
plotshape(showNone and sellCount == 2 and not compltedPhases, 'Sell ME 2', shape.labeldown, location.abovebar, #00000000, 0, '₂', color.teal, false, display = display)
plotshape(showNone and sellCount == 3 and not compltedPhases, 'Sell ME 3', shape.labeldown, location.abovebar, #00000000, 0, '₃', color.teal, false, display = display)
plotshape(showNone and sellCount == 4 and not compltedPhases, 'Sell ME 4', shape.labeldown, location.abovebar, #00000000, 0, '₄', color.teal, false, display = display)
plotshape(showNone and sellCount == 5 and not compltedPhases, 'Sell ME 5', shape.labeldown, location.abovebar, #00000000, 0, '₅', color.teal, false, display = display)
plotshape(showNone and sellCount == 6 and not compltedPhases, 'Sell ME 6', shape.labeldown, location.abovebar, #00000000, 0, '₆', color.teal, false, display = display)
plotshape(showNone and sellCount == 7 and not compltedPhases, 'Sell ME 7', shape.labeldown, location.abovebar, #00000000, 0, '₇', color.teal, false, display = display)
plotshape(showNone and sellCount == 8 and not compltedPhases and not sellPhaseQualified, 'Sell ME 8', shape.labeldown, location.abovebar, #00000000, 0, '₈', color.teal, false, display = display)
plotshape(showNone and sellCount == 8 and not compltedPhases and sellPhaseQualified, 'Sell ME 8 Qualified', shape.labeldown, location.abovebar, color.new(color.red, 75), 0, 'ǫ₈', color.white, false, display = display)
plotshape(showNone and sellCount == 9 and not sellPhaseQualified, 'Sell ME 9', shape.labeldown, location.abovebar, color.new(color.red, 25), 0, 'ᴍ', color.white, true, size.tiny, display = display)
plotshape(showNone and sellCount == 9 and sellPhaseQualified, 'Sell ME 9 Qualified', shape.labeldown, location.abovebar, color.new(color.red, 25), 0, 'ǫ\nᴍ', color.white, true, size.tiny, display = display)

phase9Support = ta.lowest(9)
sellPhaseSupport = 0.0
sellPhaseSupport := sellCount == 9 ? phase9Support : priceClose < sellPhaseSupport[1] ? 0 : sellPhaseSupport[1]
plot(phaseSRLevels and sellPhaseSupport > 0 ? sellPhaseSupport : na, "ME Support", color.teal, 1, plot.style_linebr, display = display)

var sellPhaseHighest = 0.
var sellPhaseLow     = 0.

if sellCount == 1
    sellPhaseHighest := priceHigh

if sellCount > 0
    sellPhaseHighest := math.max(priceHigh, sellPhaseHighest)
    if priceHigh == sellPhaseHighest
        sellPhaseLow := priceLow

sellPhaseStopPrice = 2 * sellPhaseHighest - sellPhaseLow
sellPhaseStopLevel = 0.0
sellPhaseStopLevel := sellCount == 9 ? sellPhaseStopPrice : priceClose > sellPhaseStopLevel[1] ? 0 : sellPhaseStopLevel[1]
plot(stopLevels and sellPhaseStopLevel > 0 ? sellPhaseStopLevel : na, "ME Sell Invalidation", color.blue, 1, plot.style_circles, display = display)

var sellExhaustionCount = 0
var buyExhaustionCount  = 0

var startBuyExhaustion13     = false
var buyExhaustion13RefClose8 = 0.
buyExhaustion13Condition = priceClose <= priceLow[2] ? true : false
buyExhaustionBar13Fails  = priceClose <= priceLow[2] and priceLow >= buyExhaustion13RefClose8 ? true : false

startBuyExhaustion13 := if buyCount == 9 and buyExhaustionCount == 0
    true
else
    if sellCount == 9 or buyExhaustionCount == 13 or priceClose > buyPhaseResistance
        false
    else
        startBuyExhaustion13[1]

buyExhaustionCount := startBuyExhaustion13 ? buyCount == 9 ? buyExhaustion13Condition ? 1 : 0 : buyExhaustion13Condition ? buyExhaustionCount + 1 : buyExhaustionCount : 0
buyExhaustionCount := buyExhaustionCount == 13 and buyExhaustionBar13Fails ? buyExhaustionCount - 1 : buyExhaustionCount

if buyExhaustionCount == 8 and buyExhaustionCount != buyExhaustionCount[1]
    buyExhaustion13RefClose8 := priceClose

plotshape(showNone and not compltedPhases and startBuyExhaustion13 and buyExhaustionCount != buyExhaustionCount[1] and buyExhaustionCount == 1, 'Buy TE', shape.labeldown, location.belowbar, #00000000, 0, '₁', color.red, false, display = display)
plotshape(showNone and not compltedPhases and startBuyExhaustion13 and buyExhaustionCount != buyExhaustionCount[1] and buyExhaustionCount == 2, 'Buy TE', shape.labeldown, location.belowbar, #00000000, 0, '₂', color.red, false, display = display)
plotshape(showNone and not compltedPhases and startBuyExhaustion13 and buyExhaustionCount != buyExhaustionCount[1] and buyExhaustionCount == 3, 'Buy TE', shape.labeldown, location.belowbar, #00000000, 0, '₃', color.red, false, display = display)
plotshape(showNone and not compltedPhases and startBuyExhaustion13 and buyExhaustionCount != buyExhaustionCount[1] and buyExhaustionCount == 4, 'Buy TE', shape.labeldown, location.belowbar, #00000000, 0, '₄', color.red, false, display = display)
plotshape(showNone and not compltedPhases and startBuyExhaustion13 and buyExhaustionCount != buyExhaustionCount[1] and buyExhaustionCount == 5, 'Buy TE', shape.labeldown, location.belowbar, #00000000, 0, '₅', color.red, false, display = display)
plotshape(showNone and not compltedPhases and startBuyExhaustion13 and buyExhaustionCount != buyExhaustionCount[1] and buyExhaustionCount == 6, 'Buy TE', shape.labeldown, location.belowbar, #00000000, 0, '₆', color.red, false, display = display)
plotshape(showNone and not compltedPhases and startBuyExhaustion13 and buyExhaustionCount != buyExhaustionCount[1] and buyExhaustionCount == 7, 'Buy TE', shape.labeldown, location.belowbar, #00000000, 0, '₇', color.red, false, display = display)
plotshape(showNone and not compltedPhases and startBuyExhaustion13 and buyExhaustionCount != buyExhaustionCount[1] and buyExhaustionCount == 8, 'Buy TE', shape.labeldown, location.belowbar, #00000000, 0, '₈', color.red, false, display = display)
plotshape(showNone and not compltedPhases and startBuyExhaustion13 and buyExhaustionCount != buyExhaustionCount[1] and buyExhaustionCount == 9, 'Buy TE', shape.labeldown, location.belowbar, #00000000, 0, '₉', color.red, false, display = display)
plotshape(showNone and not compltedPhases and startBuyExhaustion13 and buyExhaustionCount != buyExhaustionCount[1] and buyExhaustionCount == 10, 'Buy TE', shape.labeldown, location.belowbar, #00000000, 0, '₁₀', color.red, false, display = display)
plotshape(showNone and not compltedPhases and startBuyExhaustion13 and buyExhaustionCount != buyExhaustionCount[1] and buyExhaustionCount == 11, 'Buy TE', shape.labeldown, location.belowbar, #00000000, 0, '₁₁', color.red, false, display = display)
plotshape(showNone and not compltedPhases and startBuyExhaustion13 and buyExhaustionCount != buyExhaustionCount[1] and buyExhaustionCount == 12, 'Buy TE', shape.labeldown, location.belowbar, #00000000, 0, '₁₂', color.red, false, display = display)
plotshape(showNone and not compltedPhases and startBuyExhaustion13 and buyExhaustionCount == buyExhaustionCount[1] and buyExhaustionCount == 12 and buyExhaustionBar13Fails, 'Buy TE', shape.labeldown, location.belowbar, #00000000, 0, '₊', color.red, false, display = display)
plotshape(showNone and startBuyExhaustion13 and buyExhaustionCount != buyExhaustionCount[1] and buyExhaustionCount == 13, 'Buy TE 13', shape.labelup, location.belowbar, color.new(#006400, 25), 0, 'ᴛ', color.white, true, size.tiny, display = display)

var buyExhaustionHighest    = 0.
var buyExhaustionHigh       = 0.
var buyExhaustionLow        = 0.
var buyExhaustionLowest     = 0.
var buyExhaustionStopLevel  = 0.
var buyExhaustionTargetLevel = 0.

if buyExhaustionCount == 1
    buyExhaustionLowest  := priceLow
    buyExhaustionHighest := priceHigh

if startBuyExhaustion13
    buyExhaustionHighest := math.max(priceHigh, buyExhaustionHighest)
    buyExhaustionLowest  := math.min(priceLow, buyExhaustionLowest)
    if priceHigh == buyExhaustionHighest
        buyExhaustionLow := priceLow
    if priceLow == buyExhaustionLowest
        buyExhaustionHigh := priceHigh

buyExhaustionTargetPrice = 2 * buyExhaustionHighest - buyExhaustionLow
buyExhaustionTargetLevel := buyExhaustionCount == 13 ? buyExhaustionTargetPrice : priceClose > buyExhaustionTargetLevel[1] or (buyExhaustionStopLevel == 0 and sellExhaustionCount == 13) ? 0. : buyExhaustionTargetLevel[1]
plot(buyExhaustionTargetLevel > 0 ? buyExhaustionTargetLevel : na, "TE Buy Target", color.gray, 1, plot.style_circles, display=display.none)

buyExhaustionStopPrice = 2 * buyExhaustionLowest - buyExhaustionHigh
buyExhaustionStopLevel := buyExhaustionCount == 13 ? buyExhaustionStopPrice : priceClose < buyExhaustionStopLevel[1] or (buyExhaustionTargetLevel == 0 and sellExhaustionCount == 13) ? 0. : buyExhaustionStopLevel[1]
plot(stopLevels and buyExhaustionStopLevel > 0 ? buyExhaustionStopLevel : na, "TE Buy Invalidation", color.blue, 1, plot.style_circles, display = display)

var startSellExhaustion13     = false
var sellExhaustion13RefClose8 = 0.
sellExhaustion13Condition = priceClose >= priceHigh[2] ? true : false
sellExhaustionBar13Fails  = priceClose >= priceHigh[2] and priceHigh <= sellExhaustion13RefClose8 ? true : false

startSellExhaustion13 := if sellCount == 9 and sellExhaustionCount == 0
    true
else
    if buyCount == 9 or sellExhaustionCount == 13 or priceClose < sellPhaseSupport
        false
    else
        startSellExhaustion13[1]

sellExhaustionCount := startSellExhau

Показано первые 50% кода (символов: 35546)

Открыть по тарифу

Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.

Разовая покупка файла

На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.

Чтобы оформить заказ, введите email и перейдите к оплате.

Стоимость полного кода
3 554,60₽ ≈ $43.44