Confluence Profile
Сообщите нам, если считаете, что материал размещён без разрешения.
Сообщить о материале
Обращение по товару «indicator confluence profile for tradingview.pine» отправится на рассмотрение. Укажите контакт для ответа и опишите причину.
О программе
Confluence Profile — это индикатор для TradingView, который строит на графике профиль, объединяющий несколько технических факторов в единую колонку «Confluence» (Σ). В расчёте участвуют уровни Фибоначчи, зоны Order Blocks, Fair Value Gaps и объёмные профили, рассчитанные по данным выбранного инструмента. Индикатор отображает эти компоненты в виде отдельных колонок рядом с графиком и показывает, насколько сильно факторы совпадают по цене.
Пользователь может включать и отключать отдельные компоненты, задавать длины свингов, уровни Фибоначчи, параметры Order Blocks и FVG, режим объёмного профиля и веса каждого компонента в итоговой сумме. Настройки внешнего вида позволяют менять ширину колонок, смещение от последней свечи, цвета, размер текста и прозрачность рамок, а также включать зеркальное расположение колонки Confluence относительно свечей.
Индикатор не является торговым советником и не выполняет симуляцию сделок. Он предназначен для визуального анализа совпадения уровней и зон на графике и не содержит встроенных торговых правил или гарантий доходности.
Настройки программы
| Настройка | Описание |
|---|---|
| atrLen | Длина ATR: количество последних свечей для расчёта среднего размера свечи. Все настройки, выраженные в ATR, используют это значение. |
| tolAtr | Допуск в ATR: насколько близко должны находиться компоненты, чтобы считаться одной ценовой зоной и суммироваться в колонке Confluence. |
| en1 | Включает или отключает короткий свинг для расчёта уровней Фибоначчи и объёмного профиля. |
| len1 | Длина пивота для короткого свинга: количество свечей с каждой стороны для подтверждения экстремума. |
| en2 | Включает или отключает средний свинг для расчёта уровней Фибоначчи и объёмного профиля. |
| len2 | Длина пивота для среднего свинга: количество свечей с каждой стороны для подтверждения экстремума. |
| en3 | Включает или отключает длинный свинг для расчёта уровней Фибоначчи и объёмного профиля. |
| len3 | Длина пивота для длинного свинга: количество свечей с каждой стороны для подтверждения экстремума. |
| useEnds | Учитывать экстремумы свинга (0% и 100%) как уровни. |
| showSwPts | Показывает на графике точки свинга 0 и 1 с подписями и пунктирной линией между ними. |
| showX1 | Включает или отключает уровень Фибоначчи за новым экстремумом со значением -0.618. |
| valX1 | Значение уровня Фибоначчи за новым экстремумом. |
| showX2 | Включает или отключает уровень Фибоначчи за новым экстремумом со значением -0.272. |
| valX2 | Значение уровня Фибоначчи за новым экстремумом. |
| showI1 | Включает или отключает уровень коррекции Фибоначчи со значением 0.236. |
| valI1 | Значение уровня коррекции Фибоначчи. |
| showI2 | Включает или отключает уровень коррекции Фибоначчи со значением 0.382. |
| valI2 | Значение уровня коррекции Фибоначчи. |
| showI3 | Включает или отключает уровень коррекции Фибоначчи со значением 0.500. |
| valI3 | Значение уровня коррекции Фибоначчи. |
| showI4 | Включает или отключает уровень коррекции Фибоначчи со значением 0.618. |
| valI4 | Значение уровня коррекции Фибоначчи. |
| showI5 | Включает или отключает уровень коррекции Фибоначчи со значением 0.786. |
| valI5 | Значение уровня коррекции Фибоначчи. |
| showE0 | Включает или отключает уровень Фибоначчи за старым экстремумом со значением 1.272. |
| valE0 | Значение уровня Фибоначчи за старым экстремумом. |
| showE1 | Включает или отключает уровень Фибоначчи за старым экстремумом со значением 1.618. |
| valE1 | Значение уровня Фибоначчи за старым экстремумом. |
| showE2 | Включает или отключает уровень Фибоначчи за старым экстремумом со значением 2.000. |
| valE2 | Значение уровня Фибоначчи за старым экстремумом. |
| useOB | Включает колонку OB и учёт Order Blocks в профиле. |
| pivot_length | Длина пивота для Order Blocks: количество свечей с каждой стороны для подтверждения экстремума. Не зависит от свингов Фибоначчи. |
| use_wicks | Учитывать тени свечей в Order Block: включено — полная свеча с тенями, выключено — только тело. |
| ob_min_atr | Минимальная высота Order Block в ATR: меньшие блоки игнорируются. |
| useFVG | Включает колонку FVG и учёт Fair Value Gaps в профиле. |
| fvg_min_atr | Минимальная высота FVG в ATR: меньшие гэпы игнорируются. 0 — учитывать все гэпы. |
| fvgFill | Поведение FVG при входе цены в гэп: «None» — гэп остаётся до пробоя, «Shrink» — заполненная часть отсекается, «Remove at 50%» — закрытие за серединой удаляет гэп. |
| useVol | Включает объёмные профили для трёх свингов Фибоначчи (V1, V2, V3). |
| useVolZ | Включает объёмный профиль расширенной истории (Vext). Активен только при включённых уровнях за пределами свинга. |
| volMode | Режим объёмного профиля: «Nodes» — только области с заметно повышенным объёмом, «Total volume» — сырой объём. |
| wF1 | Вес уровня F1 в колонке Confluence: 1 — по умолчанию, 0 — исключён из суммы, 2 — двойной вклад. |
| wF2 | Вес уровня F2 в колонке Confluence: 1 — по умолчанию, 0 — исключён из суммы, 2 — двойной вклад. |
| wF3 | Вес уровня F3 в колонке Confluence: 1 — по умолчанию, 0 — исключён из суммы, 2 — двойной вклад. |
| wOB | Вес Order Block в колонке Confluence: 1 — по умолчанию, 0 — исключён из суммы, 2 — двойной вклад. |
| wFVG | Вес FVG в колонке Confluence: 1 — по умолчанию, 0 — исключён из суммы, 2 — двойной вклад. |
| wV1 | Вес объёмного профиля V1 в колонке Confluence: 1 — по умолчанию, 0 — исключён из суммы, 2 — двойной вклад. |
| wV2 | Вес объёмного профиля V2 в колонке Confluence: 1 — по умолчанию, 0 — исключён из суммы, 2 — двойной вклад. |
| wV3 | Вес объёмного профиля V3 в колонке Confluence: 1 — по умолчанию, 0 — исключён из суммы, 2 — двойной вклад. |
| wVz | Вес объёмного профиля Vext в колонке Confluence: 1 — по умолчанию, 0 — исключён из суммы, 2 — двойной вклад. |
| mxOffset | Смещение колонок от последней свечи в свечах. |
| laneW | Ширина колонок F1 … Vext в свечах. |
| sumW | Ширина колонки Confluence в свечах: длина самого длинного столбца. |
| colBull | Цвет бычьих Order Blocks и FVG, а также столбцов Confluence ниже цены. |
| colBear | Цвет медвежьих Order Blocks и FVG, а также столбцов Confluence выше цены. |
| txtSizeS | Размер текста заголовков колонок и подписи у текущей цены. |
| frameTr | Прозрачность рамок колонок в процентах: 0 — сплошные, 100 — скрытые. |
| mirror | Зеркальное расположение: колонка Confluence размещается рядом со свечами, столбцы растут к цене; остальные колонки следуют за ней. |
| zonesOnChart | Дополнительно отображать Order Blocks и FVG на свечах графика: «None», «FVG», «OB» или «Both». |
Поиск по коду файла
indicator("Confluence Profile", overlay = true,
max_bars_back = 2050, max_boxes_count = 500, max_labels_count = 500, max_lines_count = 200)
gGen = "General"
atrLen = input.int(100, "ATR length", minval = 1, group = gGen,
tooltip = "ATR is the average candle size over this many recent candles. Every setting expressed \"in ATR\" is a multiple of it, so the indicator behaves the same on any market and timeframe.")
tolAtr = input.float(0.15, "Tolerance (ATR)", minval = 0.01, step = 0.01, group = gGen,
tooltip = "How close two components (e.g. a Fib level and an Order Block) must be to count as the same price area and add up in the Confluence column.\n0.15 = 15% of an average candle. Higher values find confluence more easily but less precisely.")
gFib = "Fibonacci and volume – swings (trailing)"
en1 = input.bool(true, "F1 / V1 – short swing", group = gFib, inline = "s1")
len1 = input.int(10, "", minval = 2, group = gFib, inline = "s1",
tooltip = "Short swing. The number is the pivot length (candles on each side). See the long swing for details.")
en2 = input.bool(true, "F2 / V2 – medium swing", group = gFib, inline = "s2")
len2 = input.int(30, "", minval = 2, group = gFib, inline = "s2",
tooltip = "Medium swing. The number is the pivot length (candles on each side). See the long swing for details.")
en3 = input.bool(true, "F3 / V3 – long swing", group = gFib, inline = "s3")
len3 = input.int(80, "", minval = 2, group = gFib, inline = "s3",
tooltip = "The number is the pivot length: how many candles on each side must be lower (for a high) or higher (for a low).\n\nTRAILING – the swing always covers the most recent leg of price, from the latest swing high to the latest swing low (or vice versa):\n• when price extends beyond the newer extreme, that extreme moves with it,\n• when price breaks beyond the older extreme, a new leg starts,\n• when a new pivot is confirmed, the swing moves to the newest leg. If two highs are confirmed in a row, the lowest low between them is used as the swing low (and vice versa), so there is never a higher high or lower low inside the measured leg.\nFib levels therefore always describe the current move and never need to be redrawn by hand. Level 0 is the more recent extreme, level 1 the older one.\n\nEach swing defines:\n• Fib levels (columns F1, F2, F3),\n• a volume profile (columns V1, V2, V3) – from the start of the swing to the last closed candle, between the swing low and swing high.\n\nThe longest enabled swing (usually F3) also sets the height of the profile and how far back Order Blocks, FVGs and the Vext column reach.\n\nIf two swings land in the same place, the second one is skipped (its column header shows e.g. \"=F1\").")
useEnds = input.bool(true, "Include 0% and 100% (swing high and low)", group = gFib,
tooltip = "The swing extremes themselves also count as levels.")
showSwPts = input.bool(true, "Mark swing points 0 and 1 on the chart", group = gFib,
tooltip = "Shows exactly what each swing measures:\n• label \"F1: 1\" at the older extreme (start of the measurement),\n• label \"F1: 0\" at the more recent extreme (end of the measurement),\n• a dashed line between them.\nIn columns F1–F3, levels 0 and 1 are then drawn in the text color instead of red, with a 0 or 1 next to them.")
gLv = "Fibonacci – levels"
lvTip = "Enable / disable the level and set its value."
showX1 = input.bool(false, "Beyond recent extreme", group = gLv, inline = "x1")
valX1 = input.float(-0.618, "", step = 0.001, group = gLv, inline = "x1", tooltip = lvTip)
showX2 = input.bool(false, "Beyond recent extreme", group = gLv, inline = "x2")
valX2 = input.float(-0.272, "", step = 0.001, group = gLv, inline = "x2", tooltip = lvTip)
showI1 = input.bool(false, "Retracement", group = gLv, inline = "i1")
valI1 = input.float(0.236, "", step = 0.001, group = gLv, inline = "i1", tooltip = lvTip)
showI2 = input.bool(true, "Retracement", group = gLv, inline = "i2")
valI2 = input.float(0.382, "", step = 0.001, group = gLv, inline = "i2", tooltip = lvTip)
showI3 = input.bool(true, "Retracement", group = gLv, inline = "i3")
valI3 = input.float(0.500, "", step = 0.001, group = gLv, inline = "i3", tooltip = lvTip)
showI4 = input.bool(true, "Retracement", group = gLv, inline = "i4")
valI4 = input.float(0.618, "", step = 0.001, group = gLv, inline = "i4", tooltip = lvTip)
showI5 = input.bool(true, "Retracement", group = gLv, inline = "i5")
valI5 = input.float(0.786, "", step = 0.001, group = gLv, inline = "i5", tooltip = lvTip)
showE0 = input.bool(true, "Beyond older extreme", group = gLv, inline = "e0")
valE0 = input.float(1.272, "", step = 0.001, group = gLv, inline = "e0", tooltip = lvTip)
showE1 = input.bool(false, "Beyond older extreme", group = gLv, inline = "e1")
valE1 = input.float(1.618, "", step = 0.001, group = gLv, inline = "e1", tooltip = lvTip)
showE2 = input.bool(false, "Beyond older extreme", group = gLv, inline = "e2")
valE2 = input.float(2.000, "", step = 0.001, group = gLv, inline = "e2",
tooltip = "Levels are measured from the swing's more recent extreme (0) to its older extreme (1).\n• Retracement (0–1): inside the swing.\n• Beyond older extreme (> 1): e.g. below the low when the last move was up.\n• Beyond recent extreme (< 0): continuation targets.\n\nLevels outside the swing (> 1 and < 0) extend the profile's price range and enable the Vext column.")
gOB = "Order Blocks"
useOB = input.bool(true, "Include Order Blocks", group = gOB,
tooltip = "OB column. An Order Block is removed once price closes beyond it.")
pivot_length = input.int(12, "Pivot length", minval = 1, group = gOB,
tooltip = "An Order Block forms at a high or low confirmed by this many candles on each side. Independent of the Fib swings.")
use_wicks = input.bool(true, "Include wicks", group = gOB,
tooltip = "On – the Order Block covers the full candle including wicks. Off – body only.")
ob_min_atr = input.float(0.1, "Min. height (ATR)", minval = 0.0, step = 0.05, group = gOB,
tooltip = "Smaller Order Blocks are ignored.")
gFVG = "Fair Value Gaps"
useFVG = input.bool(true, "Include FVGs", group = gFVG,
tooltip = "FVG column. A gap is removed once price closes beyond it.")
fvg_min_atr = input.float(0.25, "Min. height (ATR)", minval = 0.0, step = 0.05, group = gFVG,
tooltip = "Smaller gaps are ignored. 0 = every gap.")
fillNone = "None"
fillShrink = "Shrink"
fillCE = "Remove at 50%"
fvgFill = input.string(fillShrink, "Gap fill", options = [fillNone, fillShrink, fillCE], group = gFVG,
tooltip = "What happens when price trades into a gap:\n• Shrink – the filled part of the gap is cut off.\n• Remove at 50% – a candle close beyond the midpoint removes the gap.\n• None – the gap stays intact until price breaks through it.")
gVol = "Volume"
useVol = input.bool(true, "Include volume (V1, V2, V3)", group = gVol,
tooltip = "Volume profiles of the three Fib swings – each from the start of its swing to the last closed candle.")
useVolZ = input.bool(true, "Include extended-history volume (Vext)", group = gVol,
tooltip = "Only active when levels outside the swing (> 1 or < 0) are enabled. If its range is almost the same as V1, V2 or V3, the column is skipped (header shows e.g. \"=V3\") so the same volume is not counted twice.")
volMode = input.string("Nodes", "Volume mode", options = ["Nodes", "Total volume"], group = gVol,
tooltip = "Nodes – only areas with clearly higher volume than their surroundings (recommended).\nTotal volume – raw volume; prices traded recently always appear \"hot\".")
gW = "Confluence weights"
wTip = "How much this component adds to the Confluence column (a full hit = its weight).\n1 = default, 0 = excluded from the sum (the column is still drawn), 2 = counts double.\nA weight other than 1 is shown in the column header, e.g. \"×0.5\"."
wF1 = input.float(1.0, "F1 · F2 · F3", minval = 0.0, step = 0.1, group = gW, inline = "wf")
wF2 = input.float(1.0, "", minval = 0.0, step = 0.1, group = gW, inline = "wf")
wF3 = input.float(1.0, "", minval = 0.0, step = 0.1, group = gW, inline = "wf", tooltip = wTip)
wOB = input.float(1.0, "OB · FVG", minval = 0.0, step = 0.1, group = gW, inline = "wz")
wFVG = input.float(1.0, "", minval = 0.0, step = 0.1, group = gW, inline = "wz", tooltip = wTip)
wV1 = input.float(1.0, "V1 · V2 · V3 · Vext", minval = 0.0, step = 0.1, group = gW, inline = "wv")
wV2 = input.float(1.0, "", minval = 0.0, step = 0.1, group = gW, inline = "wv")
wV3 = input.float(1.0, "", minval = 0.0, step = 0.1, group = gW, inline = "wv")
wVz = input.float(1.0, "", minval = 0.0, step = 0.1, group = gW, inline = "wv",
tooltip = wTip + "\n\nTip: profiles V1–V3 partly overlap (a shorter swing sits inside a longer one), so the same volume node can be counted several times. Lower volume weights (e.g. 0.5) reduce this effect.")
gLook = "Appearance"
mxOffset = input.int(4, "Offset from last candle", minval = 0, group = gLook,
tooltip = "In candles.")
laneW = input.int(4, "Column width", minval = 1, maxval = 20, group = gLook,
tooltip = "In candles. Applies to columns F1 … Vext.")
sumW = input.int(20, "Confluence column width", minval = 4, maxval = 100, group = gLook,
tooltip = "In candles. Length of the longest confluence bar.")
colBull = input.color(#1D9E75, "Color: support / bullish", group = gLook,
tooltip = "Bullish OBs and FVGs, and confluence bars below price.")
colBear = input.color(#E24B4A, "Color: resistance / bearish", group = gLook,
tooltip = "Bearish OBs and FVGs, and confluence bars above price.")
txtSizeS = input.string("Small", "Text size", options = ["Tiny", "Small", "Normal", "Large"], group = gLook,
tooltip = "Column headers and the label at the current price.")
frameTr = input.int(70, "Column frame transparency (%)", minval = 0, maxval = 100, group = gLook,
tooltip = "0 = solid, clearly visible frames. 100 = frames hidden.")
mirror = input.bool(true, "Mirror layout (Confluence next to candles, bars toward price)", group = gLook,
tooltip = "On – the Confluence (Σ) column sits right next to the candles and its bars grow to the left, toward price (like the TradingView volume profile). Columns F1, F2, F3, OB, FVG, V1, V2, V3, Vext follow behind it.\nOff – columns F1 … Vext first, Confluence last on the right, with bars growing to the right.")
colFrame = color.new(color.gray, frameTr)
zonesOnChart = input.string("None", "Show zones on candles", options = ["None", "FVG", "OB", "Both"], group = gLook,
tooltip = "Also draws the Order Blocks and FVGs counted in the profile directly on the chart, so you can see where they come from.")
rows = 81 // minimum number of profile rows
quantLv = 8 // number of color intensity steps
minCell = 0.05 // cells below 5% intensity are not drawn
dirTint = true // OB/FVG colored by direction
sumSide = true // Σ colored by side (support / resistance)
showHeaders = true
showPriceLn = true
showSumTxt = true
exactEdges = true // OB/FVG drawn with exact edges in the profile
obSourceLookback = 5 // OB source candle: at most this many candles before the pivot
obWickMode = true // oversized OB → use only the swing candle's wick
obWickAtr = 2.0
volMaxBars = 2000 // maximum historical lookback (✂ in the column header when reached)
volBinAtr = 0.1 // volume profile resolution
volDupPct = 80 // profiles sharing ≥ 80% of their range are treated as one
volHVN = "Nodes"
hvnWinAtr = 1.0 // neighborhood for volume nodes: ± 1 ATR
colCold = #378ADD
colMid = #EF9F27
colHot = #E24B4A
transpStrong = 10
transpWeak = 85
colTxt = chart.fg_color
txtSize = txtSizeS == "Tiny" ? size.tiny : txtSizeS == "Small" ? size.small : txtSizeS == "Normal" ? size.normal : size.large
colTxtBg = color.new(chart.bg_color, 25)
atrV = ta.atr(atrLen)
f_extreme(int o1, int o2, bool hi) =>
float p = na
int i = na
int a = math.max(0, o1)
int b = math.min(o2, math.min(bar_index, volMaxBars))
if a <= b
for off = a to b
float v = hi ? high[off] : low[off]
if na(p) or (hi ? v > p : v < p)
p := v
i := bar_index - off
[p, i]
trailFib(int len) =>
var float pA = na
var int iA = na
var bool hA = false
var float pB = na
var int iB = na
var bool hB = true
if na(pB)
pA := low
iA := bar_index
hA := false
pB := high
iB := bar_index
hB := true
ph = ta.pivothigh(high, len, len)
pl = ta.pivotlow(low, len, len)
int p = bar_index - len
if not na(ph) and barstate.isconfirmed
if hB and iB < p
[lp, li] = f_extreme(bar_index - p + 1, bar_index - iB - 1, false)
if not na(lp)
[hp, hi_] = f_extreme(0, bar_index - li - 1, true)
pA := lp
iA := li
hA := false
pB := hp
iB := hi_
hB := true
[lp2, li2] = f_extreme(0, bar_index - iB - 1, false)
if not na(lp2) and lp2 < pA
pA := pB
iA := iB
hA := true
pB := lp2
iB := li2
hB := false
else if not hB and p > iB
[hp, hi_] = f_extreme(0, bar_index - iB - 1, true)
if not na(hp)
pA := pB
iA := iB
hA := false
pB := hp
iB := hi_
hB := true
else if not hB and p > iA
pA := ph
iA := p
hA := true
if not na(pl) and barstate.isconfirmed
if not hB and iB < p
[hp, hi_] = f_extreme(bar_index - p + 1, bar_index - iB - 1, true)
if not na(hp)
[lp, li] = f_extreme(0, bar_index - hi_ - 1, false)
pA := hp
iA := hi_
hA := true
pB := lp
iB := li
hB := false
[hp2, hi2] = f_extreme(0, bar_index - iB - 1, true)
if not na(hp2) and hp2 > pA
pA := pB
iA := iB
hA := false
pB := hp2
iB := hi2
hB := true
else if hB and p > iB
[lp, li] = f_extreme(0, bar_index - iB - 1, false)
if not na(lp)
pA := pB
iA := iB
hA := true
pB := lp
iB := li
hB := false
else if hB and p > iA
pA := pl
iA := p
hA := false
bool grn = close >= open
for step = 0 to 1
bool doLow = grn ? step == 0 : step == 1
if doLow
if not hB and low < pB
pB := low
iB := bar_index
else if hB and low < pA
pA := pB
iA := iB
hA := true
pB := low
iB := bar_index
hB := false
else
if hB and high > pB
pB := high
iB := bar_index
else if not hB and high > pA
pA := pB
iA := iB
hA := false
pB := high
iB := bar_index
hB := true
float tHigh = hB ? pB : pA
float tLow = hB ? pA : pB
int iHigh = hB ? iB : iA
int iLow = hB ? iA : iB
[tHigh, tLow, hB, iA, iHigh, iLow]
[h1, l1, z1, a1, ih1, il1] = trailFib(len1)
[h2, l2, z2, a2, ih2, il2] = trailFib(len2)
[h3, l3, z3, a3, ih3, il3] = trailFib(len3)
var array<float> ratios = array.new<float>()
f_addLvl(bool on, float v) =>
if on
ratios.push(v)
if barstate.isfirst
f_addLvl(useEnds, 0.0)
f_addLvl(useEnds, 1.0)
f_addLvl(showX1, valX1)
f_addLvl(showX2, valX2)
f_addLvl(showI1, valI1)
f_addLvl(showI2, valI2)
f_addLvl(showI3, valI3)
f_addLvl(showI4, valI4)
f_addLvl(showI5, valI5)
f_addLvl(showE0, valE0)
f_addLvl(showE1, valE1)
f_addLvl(showE2, valE2)
type Zone
float top
float bot
int leftIdx
bool isBull
bool isFvg
float ce
float top0
float bot0
bool armed = false
bool touching = false
bool epConf = false
bool confirmed = false
int tests = 0
var array<Zone> obZones = array.new<Zone>()
var array<Zone> fvgZones = array.new<Zone>()
is_green(int offset) =>
close[offset] > open[offset]
is_red(int offset) =>
close[offset] < open[offset]
f_addZone(array<Zone> zs, float t, float b, int leftIdx, bool isBull, bool isFvg) =>
if zs.size() >= 300
zs.shift()
zs.push(Zone.new(t, b, leftIdx, isBull, isFvg, (t + b) / 2, t, b))
f_buildOB(int sourceIdx, float t, float b, bool isBull) =>
if (t - b) >= atrV * ob_min_atr
f_addZone(obZones, t, b, bar_index - sourceIdx, isBull, false)
f_createOBExtended(bool isBull) =>
int idx = pivot_length
int src = idx
if isBull and not is_red(idx)
for k = idx + 1 to idx + obSourceLookback
if is_red(k)
src := k
break
else if not isBull and not is_green(idx)
for k = idx + 1 to idx + obSourceLookback
if is_green(k)
src := k
break
float t = use_wicks ? high[src] : math.max(open[src], close[src])
float b = use_wicks ? low[src] : math.min(open[src], close[src])
if isBull
b := math.min(b, use_wicks ? low[idx] : math.min(open[idx], close[idx]))
else
t := math.max(t, use_wicks ? high[idx] : math.max(open[idx], close[idx]))
int srcUsed = src
if obWickMode and (t - b) > atrV * obWickAtr
if isBull
t := math.min(open[idx], close[idx])
b := low[idx]
else
t := high[idx]
b := math.max(open[idx], close[idx])
srcUsed := idx
f_buildOB(srcUsed, t, b, isBull)
f_track(array<Zone> zs) =>
bool bUp = false
bool bDn = false
bool eUp = false
bool eDn = false
if zs.size() > 0
for i = zs.size() - 1 to 0
Zone z = zs.get(i)
if z.isBull and close < z.bot
zs.remove(i)
bDn := true
continue
if not z.isBull and close > z.top
zs.remove(i)
bUp := true
continue
if z.isFvg and fvgFill == fillCE and (z.isBull ? close < z.ce : close > z.ce)
zs.remove(i)
continue
bool touch = low <= z.top and high >= z.bot
if not z.armed
if not touch
z.armed := true
else
if touch and not z.touching
z.tests := z.tests + 1
z.epConf := false
if touch and not z.epConf
if z.isBull and close > z.top
z.confirmed := true
z.epConf := true
eUp := true
else if not z.isBull and close < z.bot
z.confirmed := true
z.epConf := true
eDn := true
z.touching := touch
if z.isFvg and fvgFill == fillShrink and touch
if z.isBull
if low <= z.bot
zs.remove(i)
continue
z.top := math.min(z.top, low)
else
if high >= z.top
zs.remove(i)
continue
z.bot := math.max(z.bot, high)
[bUp, bDn, eUp, eDn]
pivot_low = ta.pivotlow(low, pivot_length, pivot_length)
pivot_high = ta.pivothigh(high, pivot_length, pivot_length)
if useOB and barstate.isconfirmed
if not na(pivot_low)
f_createOBExtended(true)
if not na(pivot_high)
f_createOBExtended(false)
if useFVG and barstate.isconfirmed
if low > high[2] and (low - high[2]) >= atrV * fvg_min_atr
f_addZone(fvgZones, low, high[2], bar_index - 2, true, true)
if high < low[2] and (low[2] - high) >= atrV * fvg_min_atr
f_addZone(fvgZones, low[2], high, bar_index - 2, false, true)
if barstate.isconfirmed
[obBU, obBD, obEU, obED] = f_track(obZones)
[fvBU, fvBD, fvEU, fvED] = f_track(fvgZones)
var array<box> mBoxes = array.new<box>()
var array<label> mLabels = array.new<label>()
var array<line> mLines = array.new<line>()
heatCol(float v) =>
v < 0.5 ? color.from_gradient(v, 0.0, 0.5, colCold, colMid) : color.from_gradient(v, 0.5, 1.0, colMid, colHot)
dirCol(color c, float v) =>
color.from_gradient(v, 0.0, 1.0, color.gray, c)
cellCol(color c, float v) =>
color.new(c, transpWeak + (transpStrong - transpWeak) * math.min(1.0, math.max(0.0, v)))
float atrC = nz(atrV[1], atrV)
float tol = tolAtr * atrC
f_rowsIn(float a, float b, float lo, float rh, int N) =>
int rA = 0
int rB = -1
if rh <= tol
rA := math.max(0, int(math.ceil((a - lo) / rh - 0.5)))
rB := math.min(N - 1, int(math.floor((b - lo) / rh - 0.5)))
else
rA := math.max(0, int(math.floor((a - lo) / rh)))
rB := math.min(N - 1, int(math.floor((b - lo) / rh)))
[rA, rB]
f_volAt(array<float> vp, int off, int nb, float pLo, float vb, float c, float t) =>
float v = 0.0
float a = c - t
float b = c + t
if nb > 0 and b >= pLo and a <= pLo + nb * vb
int bA = math.max(0, int(math.floor((a - pLo) / vb)))
int bB = math.min(nb - 1, int(math.floor((b - pLo) / vb)))
if bA <= bB
for i = bA to bB
v := math.max(v, vp.get(off + i))
v
f_buildProf(int endOff, float pLo, float pHi) =>
float vb = math.max(volBinAtr * atrC, (pHi - pLo) / 500.0)
int nb = math.max(1, int(math.ceil((pHi - pLo) / vb)))
prof = array.new<float>(nb, 0.0)
for off = 1 to math.max(1, endOff)
float bh = high[off]
float bl = low[off]
float bv = nz(volume[off])
if bv > 0 and bh >= pLo and bl <= pHi
if bh > bl
float ch = math.min(bh, pHi)
float cl = math.max(bl, pLo)
int bA = math.max(0, math.min(nb - 1, int(math.floor((cl - pLo) / vb))))
int bB = math.max(0, math.min(nb - 1, int(math.floor((ch - pLo) / vb))))
for bi = bA to bB
float bBot = pLo + bi * vb
float ov = math.min(ch, bBot + vb) - math.max(cl, bBПоказано первые 50% кода (символов: 29916)