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

Daily Volume Profile [Amtrades] β0.1

indicator daily volume profile [amtrades] for tradingview.pine
Вы автор или правообладатель?

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

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

О программе

Daily Volume Profile [Amtrades] β0.1 — это индикатор TradingView, написанный на Pine Script v6. Он отображает на графике временные диапазоны ключевых торговых сессий, рассчитываемые по нью-йоркскому времени: азиатскую (18:00–01:00), лондонскую (01:00–08:00), нью-йоркскую (08:00–14:00), а также часовые диапазоны 01:00–02:00 и 08:00–09:00 и два дополнительных диапазона DTR. Для каждой сессии строится прямоугольник, охватывающий её максимум и минимум, с возможностью вывода подписи с названием сессии и краткой классификацией характера движения.

Индикатор накапливает значения открытия, максимума, минимума и закрытия по каждой сессии, а по её завершении фиксирует эти значения для дальнейшего анализа. На основе сравнения диапазонов сессий формируются текстовые метки-классификации, например «Consolidation», «Reversal», «Expansion», «Sweep & Rev», «Continuation». Для лондонской сессии дополнительно используется настраиваемый порог, выраженный в процентах от диапазона азиатской сессии, чтобы считать диапазон «фактически внутри».

В момент завершения часового диапазона 08:00–09:00 индикатор выводит прогнозную метку с одним из нескольких типовых сценариев, а в момент закрытия нью-йоркской сессии — метку фактической реализации с указанием, совпал ли прогноз с итоговым направлением. Все элементы отображаются только на таймфреймах не старше 10 минут, если не включён соответствующий переключатель.

Индикатор не является автоматическим советником: он не совершает сделок и не содержит торговых правил. Все параметры задаются пользователем через настройки — видимость на старших таймфреймах, отображение каждой сессии, подписей и меток, порог «внутри» для Лондона и цвета для каждого типа диапазона.

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

НастройкаОписание
show_above_10m Показывать на таймфреймах выше 10 минут — Разрешает отображение элементов индикатора на таймфреймах старше 10 минут. Если выключено, индикатор виден только на таймфреймах не старше 10 минут.
show_asia Показывать Asia — Включает отображение прямоугольника азиатской сессии.
show_lon Показывать London — Включает отображение прямоугольника лондонской сессии.
show_ny Показывать NYC — Включает отображение прямоугольника нью-йоркской сессии.
show_1am Показывать 1AM — Включает отображение прямоугольника для часового диапазона 01:00–02:00.
show_8am Показывать 8AM — Включает отображение прямоугольника для часового диапазона 08:00–09:00.
show_dtr_lon Показывать DTR Лондона — Включает отображение прямоугольника для диапазона DTR Лондона.
show_dtr_nyc Показывать DTR Нью-Йорка — Включает отображение прямоугольника для диапазона DTR Нью-Йорка.
show_labels Показывать подписи сессий — Включает вывод текстовых подписей с названием сессии рядом с её прямоугольником.
show_type_labels Показывать метки типа внутри прямоугольников — Включает вывод внутри прямоугольников сессий кратких текстовых классификаций характера движения.
show_pred Показывать прогноз в 8:59 — Включает вывод прогнозной метки в момент завершения часового диапазона 08:00–09:00.
show_reality Показывать метку реальности при закрытии NYC — Включает вывод метки фактической реализации в момент закрытия нью-йоркской сессии.
lon_inside_pct Порог «внутри» для Лондона (%) — Порог в процентах от диапазона азиатской сессии, при котором лондонский диапазон считается «фактически внутри» азиатского. Используется при классификации и формировании прогнозов.
col_asia Цвет Asia — Цвет заливки и границы для азиатской сессии.
col_lon Цвет London — Цвет заливки и границы для лондонской сессии.
col_ny Цвет NYC — Цвет заливки и границы для нью-йоркской сессии.
col_1am Цвет 1AM — Цвет заливки и границы для часового диапазона 01:00–02:00.
col_8am Цвет 8AM — Цвет заливки и границы для часового диапазона 08:00–09:00.
col_dtrL Цвет DTR Lon — Цвет заливки и границы для диапазона DTR Лондона.
col_dtrN Цвет DTR NYC — Цвет заливки и границы для диапазона DTR Нью-Йорка.
Получить полный код

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

indicator("Daily Volume Profile [Amtrades] β0.1", overlay=true, max_boxes_count=500, max_labels_count=500)

var string TZ = "America/New_York"

grp_vis = "Visibility"
show_above_10m = input.bool(true,  "Show above 10min chart", group=grp_vis)
is_visible     = timeframe.in_seconds() <= 600 or show_above_10m

grp_sess = "Session Boxes"
show_asia    = input.bool(true,  "Asia   18:00→01:00",          group=grp_sess)
show_lon     = input.bool(true,  "London 01:00→08:00",          group=grp_sess)
show_ny      = input.bool(true,  "NYC    08:00→14:00",          group=grp_sess)
show_1am     = input.bool(false, "1AM hourly 01:00→02:00",      group=grp_sess)
show_8am     = input.bool(true,  "8AM hourly 08:00→09:00",      group=grp_sess)
show_dtr_lon = input.bool(false, "London DTR 1:12→2:12",        group=grp_sess)
show_dtr_nyc = input.bool(false, "NYC DTR 8:12→9:12",           group=grp_sess)
show_labels  = input.bool(false, "Show session name labels",     group=grp_sess)

grp_type = "Session Type Labels"
show_type_labels = input.bool(true, "Show type labels inside boxes", group=grp_type)

grp_prof = "Profile"
show_pred        = input.bool(true,  "Show prediction at 8:59",                     group=grp_prof)
show_reality     = input.bool(true,  "Show reality label at NYC close",              group=grp_prof)
lon_inside_pct   = input.float(10.0, "London 'effectively inside' threshold (%)",    group=grp_prof, minval=0.0, maxval=30.0, step=1.0,
                   tooltip="If London broke Asia range by less than this % of Asia range, treat as consolidation. Default 10%.")

grp_col = "Colors"
col_asia = input.color(color.new(#FF9800, 85), "Asia",    group=grp_col)
col_lon  = input.color(color.new(#2196F3, 85), "London",  group=grp_col)
col_ny   = input.color(color.new(#4CAF50, 85), "NYC",     group=grp_col)
col_1am  = input.color(color.new(#9C27B0, 75), "1AM",     group=grp_col)
col_8am  = input.color(color.new(#E91E63, 75), "8AM",     group=grp_col)
col_dtrL = input.color(color.new(#2196F3, 55), "DTR Lon", group=grp_col)
col_dtrN = input.color(color.new(#4CAF50, 55), "DTR NYC", group=grp_col)

in_asia  = not na(time(timeframe.period, "1800-0100:1234567", TZ))
in_lon   = not na(time(timeframe.period, "0100-0800:1234567", TZ))
in_ny    = not na(time(timeframe.period, "0800-1400:1234567", TZ))
in_1am   = not na(time(timeframe.period, "0100-0200:1234567", TZ))
in_8am   = not na(time(timeframe.period, "0800-0900:1234567", TZ))
in_dtrL  = not na(time(timeframe.period, "0112-0212:1234567", TZ))
in_dtrN  = not na(time(timeframe.period, "0812-0912:1234567", TZ))

is_asia_first = in_asia and not in_asia[1]
is_lon_first  = in_lon  and not in_lon[1]
is_ny_first   = in_ny   and not in_ny[1]
is_1am_first  = in_1am  and not in_1am[1]
is_8am_first  = in_8am  and not in_8am[1]
is_dtrL_first = in_dtrL and not in_dtrL[1]
is_dtrN_first = in_dtrN and not in_dtrN[1]

is_asia_last  = not in_asia and in_asia[1]
is_lon_last   = not in_lon  and in_lon[1]
is_ny_last    = not in_ny   and in_ny[1]
is_8am_last   = not in_8am  and in_8am[1]

var float _asia_h = na, var float _asia_l = na, var float _asia_o = na, var float _asia_c = na
var float _lon_h  = na, var float _lon_l  = na, var float _lon_o  = na, var float _lon_c  = na
var float _ny_h   = na, var float _ny_l   = na, var float _ny_o   = na, var float _ny_c   = na
var float _h1am_h = na, var float _h1am_l = na
var float _h8am_h = na, var float _h8am_l = na, var float _h8am_o = na, var float _h8am_c = na
var float _dtrL_h = na, var float _dtrL_l = na
var float _dtrN_h = na, var float _dtrN_l = na

if is_asia_first
    _asia_h := high
    _asia_l := low
    _asia_o := open
if in_asia
    _asia_h := math.max(_asia_h, high)
    _asia_l := math.min(_asia_l, low)
    _asia_c := close

if is_lon_first
    _lon_h := high
    _lon_l := low
    _lon_o := open
if in_lon
    _lon_h := math.max(_lon_h, high)
    _lon_l := math.min(_lon_l, low)
    _lon_c := close

if is_ny_first
    _ny_h := high
    _ny_l := low
    _ny_o := open
if in_ny
    _ny_h := math.max(_ny_h, high)
    _ny_l := math.min(_ny_l, low)
    _ny_c := close

if is_1am_first
    _h1am_h := high
    _h1am_l := low
if in_1am
    _h1am_h := math.max(_h1am_h, high)
    _h1am_l := math.min(_h1am_l, low)

if is_8am_first
    _h8am_h := high
    _h8am_l := low
    _h8am_o := open
if in_8am
    _h8am_h := math.max(_h8am_h, high)
    _h8am_l := math.min(_h8am_l, low)
    _h8am_c := close

if is_dtrL_first
    _dtrL_h := high
    _dtrL_l := low
if in_dtrL
    _dtrL_h := math.max(_dtrL_h, high)
    _dtrL_l := math.min(_dtrL_l, low)

if is_dtrN_first
    _dtrN_h := high
    _dtrN_l := low
if in_dtrN
    _dtrN_h := math.max(_dtrN_h, high)
    _dtrN_l := math.min(_dtrN_l, low)

var float asia_h = na, var float asia_l = na, var float asia_o = na, var float asia_c = na
var float lon_h  = na, var float lon_l  = na, var float lon_o  = na, var float lon_c  = na
var float h8am_h = na, var float h8am_l = na, var float h8am_o = na, var float h8am_c = na

if is_asia_last
    asia_h := _asia_h
    asia_l := _asia_l
    asia_o := _asia_o
    asia_c := _asia_c
if is_lon_last
    lon_h := _lon_h
    lon_l := _lon_l
    lon_o := _lon_o
    lon_c := _lon_c
if is_8am_last
    h8am_h := _h8am_h
    h8am_l := _h8am_l
    h8am_o := _h8am_o
    h8am_c := _h8am_c

f_asia_type(o, c, h, l) =>
    body = math.abs(c - o)
    span = h - l
    body > span * 0.35 ? (c > o ? "Reversal ▲" : "Reversal ▼") : "Consolidation"

f_lon_type(lo, lc, lh, ll, ah, al) =>
    swept_lo = ll < al and lc > lo
    swept_hi = lh > ah and lc < lo
    swept_lo ? "Sweep & Rev ▲" : swept_hi ? "Sweep & Rev ▼" : (lc > lo ? "Expansion ▲" : "Expansion ▼")

f_8am_type(o8, c8, h8, l8, lh, ll) =>
    wick_above  = h8 > lh
    wick_below  = l8 < ll
    close_above = c8 > lh
    close_below = c8 < ll
    inside_lon  = h8 <= lh and l8 >= ll
    rev_bear    = wick_above and not close_above
    rev_bull    = wick_below and not close_below
    inside_lon   ? "Consolidation" :
     rev_bear    ? "Reversal ▼" :
     rev_bull    ? "Reversal ▲" :
     close_above ? "Continuation ▲" :
     close_below ? "Continuation ▼" :
     (c8 > o8    ? "Continuation ▲" : "Continuation ▼")

f_nyc_type(nyc, nyo, lc, lo) =>
    nyc_up   = nyc > nyo
    lon_bull = lc > lo
    continued = (nyc_up and lon_bull) or (not nyc_up and not lon_bull)
    continued ? (nyc_up ? "Continuation ▲" : "Continuation ▼") : (nyc_up ? "Reversal ▲" : "Reversal ▼")

var box bx_asia = na, var box bx_lon = na, var box bx_ny  = na
var box bx_1am  = na, var box bx_8am = na
var box bx_dtrL = na, var box bx_dtrN = na

if is_asia_first and show_asia and is_visible
    bx_asia := box.new(bar_index, high, bar_index+1, low, bgcolor=col_asia, border_color=color.new(#FF9800,20), border_width=1)
    if show_labels
        label.new(bar_index, high, "Asia", style=label.style_label_down, color=color.new(#FF9800,0), textcolor=color.white, size=size.small)
if in_asia and not na(bx_asia) and show_asia and is_visible
    box.set_top(bx_asia, _asia_h)
    box.set_bottom(bx_asia, _asia_l)
    box.set_right(bx_asia, bar_index+1)
if is_asia_last and show_asia and show_type_labels and is_visible and not na(_asia_h)
    label.new(bar_index, (_asia_h+_asia_l)*0.5, "Asia\n"+f_asia_type(_asia_o,_asia_c,_asia_h,_asia_l),
              style=label.style_label_center, color=color.new(#FF9800,70), textcolor=color.new(#FF9800,0), size=size.tiny)

if is_lon_first and show_lon and is_visible
    bx_lon := box.new(bar_index, high, bar_index+1, low, bgcolor=col_lon, border_color=color.new(#2196F3,20), border_width=1)
    if show_labels
        label.new(bar_index, high, "London", style=label.style_label_down, color=color.new(#2196F3,0), textcolor=color.white, size=size.small)
if in_lon and not na(bx_lon) and show_lon and is_visible
    box.set_top(bx_lon, _lon_h)
    box.set_bottom(bx_lon, _lon_l)
    box.set_right(bx_lon, bar_index+1)
if is_lon_last and show_lon and show_type_labels and is_visible and not na(_lon_h) and not na(asia_h)
    _athr        = math.max(asia_h-asia_l, 1.0) * lon_inside_pct / 100.0
    _leff_inside = math.max(_lon_h-asia_h, 0.0) <= _athr and math.max(asia_l-_lon_l, 0.0) <= _athr
    _ltyp        = _leff_inside ? "Consolidation" : f_lon_type(_lon_o, _lon_c, _lon_h, _lon_l, asia_h, asia_l)
    label.new(bar_index, (_lon_h+_lon_l)*0.5, "London\n"+_ltyp,
              style=label.style_label_center, color=color.new(#2196F3,70), textcolor=color.new(#2196F3,0), size=size.tiny)

if is_ny_first and show_ny and is_visible
    bx_ny := box.new(bar_index, high, bar_index+1, low, bgcolor=col_ny, border_color=color.new(#4CAF50,20), border_width=1)
    if show_labels
        label.new(bar_index, high, "NYC", style=label.style_label_down, color=color.new(#4CAF50,0), textcolor=color.white, size=size.small)
if in_ny and not na(bx_ny) and show_ny and is_visible
    box.set_top(bx_ny, _ny_h)
    box.set_bottom(bx_ny, _ny_l)
    box.set_right(bx_ny, bar_index+1)
if is_ny_last and show_ny and show_type_labels and is_visible and not na(_ny_h) and not na(lon_c)
    label.new(bar_index, (_ny_h+_ny_l)*0.5, "NYC\n"+f_nyc_type(_ny_c,_ny_o,lon_c,lon_o),
              style=label.style_label_center, color=color.new(#4CAF50,70), textcolor=color.new(#4CAF50,0), size=size.tiny)

if is_1am_first and show_1am and is_visible
    bx_1am := box.new(bar_index, high, bar_index+1, low, bgcolor=col_1am, border_color=color.new(#9C27B0,20), border_width=1)
    if show_labels
        label.new(bar_index, low, "1AM", style=label.style_label_up, color=color.new(#9C27B0,0), textcolor=color.white, size=size.tiny)
if in_1am and not na(bx_1am) and show_1am and is_visible
    box.set_top(bx_1am, _h1am_h)
    box.set_bottom(bx_1am, _h1am_l)
    box.set_right(bx_1am, bar_index+1)

if is_8am_first and show_8am and is_visible
    bx_8am := box.new(bar_index, high, bar_index+1, low, bgcolor=col_8am, border_color=color.new(#E91E63,20), border_width=1)
    if show_labels
        label.new(bar_index, low, "8AM", style=label.style_label_up, color=color.new(#E91E63,0), textcolor=color.white, size=size.tiny)
if in_8am and not na(bx_8am) and show_8am and is_visible
    box.set_top(bx_8am, _h8am_h)
    box.set_bottom(bx_8am, _h8am_l)
    box.set_right(bx_8am, bar_index+1)
if is_8am_last and show_8am and show_type_labels and is_visible and not na(_h8am_h) and not na(lon_h)
    label.new(bar_index, (_h8am_h+_h8am_l)*0.5, "8AM\n"+f_8am_type(_h8am_o,_h8am_c,_h8am_h,_h8am_l,lon_h,lon_l),
              style=label.style_label_center, color=color.new(#E91E63,70), textcolor=color.new(#E91E63,0), size=size.tiny)

if is_dtrL_first and show_dtr_lon and is_visible
    bx_dtrL := box.new(bar_index, high, bar_index+1, low, bgcolor=col_dtrL, border_color=color.new(#2196F3,0), border_width=2)
    if show_labels
        label.new(bar_index, low, "DTR L", style=label.style_label_up, color=color.new(#2196F3,0), textcolor=color.white, size=size.tiny)
if in_dtrL and not na(bx_dtrL) and show_dtr_lon and is_visible
    box.set_top(bx_dtrL, _dtrL_h)
    box.set_bottom(bx_dtrL, _dtrL_l)

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

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

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

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

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

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

Стоимость полного кода
1 734,90₽ ≈ $21.20