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

SMC - Complete Analysis

smc_indicator@free_fx_pro_5918035398503701400.pine

Похожие материалы по тегам

ares_indicator.pineTradingView · 1 общих теговgold_trend_revers.mq5MQL5 / MetaTrader 5 · 1 общих тегов!!!-mt4 x-xardg-rsi.mq5MQL5 / MetaTrader 5 · 1 общих тегов! cycle-identifier.mq5MQL5 / MetaTrader 5 · 1 общих тегов!!! rsi ma simple+arrows 1.2 (mtf).mq5MQL5 / MetaTrader 5 · 1 общих теговprecisionflowea.mq5MQL5 / MetaTrader 5 · 1 общих тегов
Вы автор или правообладатель?

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

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

О программе

Индикатор «SMC - Complete Analysis» — это комплексный инструмент анализа для TradingView, отображаемый на графике цены. Он визуализирует ключевые элементы концепции Smart Money: структуру рынка (BOS, CHoCH, MSS), справедливые пробелы (FVG), ордер-блоки, индьюсменты, дислокейшн и диапазоны консолидации.

Помимо структурного анализа, индикатор предоставляет временные инструменты: зоны активности (Kill Zones), сессионные коробки и уровни предыдущего дня (PDH/PDL). Также реализованы средства управления рисками — триггеры входа, калькулятор рисков и проекции целей (TP, T1, T2).

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

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

НастройкаОписание
swing_len Длина свинга — Длина свинга для определения ключевых вершин и впадин на графике.
internal_swing_len Длина внутреннего свинга — Длина внутреннего свинга для определения промежуточных вершин и впадин.
show_bos Показывать прорывы структуры — Отображение линий и меток прорывов структуры (Break of Structure).
show_choch Показывать смену структуры — Отображение смены рыночной структуры (Change of Character).
show_mss Показывать смену структуры (MSS) — Отображение смены рыночной структуры (Market Structure Shift) с маркировкой ключевых точек.
show_internal Показывать внутреннюю структуру — Отображение внутренних свингов (мелких вершин и впадин) на графике.
show_displacement Показывать дислокейшн — Отображение меток дислокейшна — мощных импульсных свечей с минимальным откатом.
show_range Показывать диапазоны консолидации — Отображение зон консолидации (диапазонов) на графике.
show_fvg Показывать справедливые пробелы — Отображение справедливых пробелов (Fair Value Gap) в виде закрашенных коробок.
show_ob Показывать ордер-блоки — Отображение ордер-блоков — зон, предшествовавших импульсному движению.
show_inducement Показывать индьюсменты — Отображение меток индьюсмента — ложных ловушек ликвидности.
show_liquidity Показывать уровни ликвидности — Отображение уровней ликвидности (хотя в коде переключатель включён, конкретная визуализация отсутствует).
show_premium_discount Показывать премиум/дисконт — Отображение индикации премиум/дисконт зон на основе структуры свингов.
show_kill_zones Показывать зоны активности — Отображение временных зон активности: Азиатская, Лондонская, Нью-Йоркская.
show_sessions Показывать сессионные коробки — Отображение цветных сессионных коробок (Азия, Лондон, Нью-Йорк).
show_daily_levels Показывать уровни дня — Отображение уровней предыдущего торгового дня — PDH и PDL.
show_entry_triggers Показывать сигналы входа — Отображение сигналов входа в сделку с уровнями входа, стоп-лосса и тейк-профита.
show_risk_calc Показывать калькулятор рисков — Отображение таблицы калькулятора рисков: размер позиции, сумма риска, потенциальная прибыль.
show_targets Показывать проекции целей — Отображение линий и меток проекций целей (TP, T1, T2) после входа в сделку.
show_htf_structure Показывать структуру высшего ТФ — Отображение структуры высшего таймфрейма — ключевые свинги HTF.
show_fibonacci Показывать авто-Фибоначчи — Отображение автоматических уровней Фибоначчи на основе найденных экстремумов.
show_trend_lines Показывать трендовые линии — Отображение автоматических трендовых линий по свингам цены.
show_money_flow Показывать поток умных денег — Отображение анализа потока умных денег на основе объёма и цены.
show_strength_meter Показывать индикатор силы — Отображение таблицы индикатора силы с оценкой бычьего/медвежьего давления, RSI и MFI.
show_volume_analysis Показывать анализ объёма — Отображение меток всплесков объёма при резком увеличении торгового оборота.
show_smt Показывать ловушки умных денег — Отображение ловушек умных денег (SMT) — спред ликвидности с последующим возвратом.
show_discipline_mode Включить режим дисциплины — Включение режима дисциплины с фильтрацией сигналов по баллу конфлюэнса и дополнительным условиям.
min_confluence_score Минимальный балл конфлюэнса — Минимальный суммарный балл совпадающих факторов для генерации сигнала в режиме дисциплины.
require_kill_zone Требовать активную зону времени — Обязательная активность зоны времени (Kill Zone) для подтверждения торгового сигнала.
require_strength_bias Требовать направление силы — Требование преобладания бычьей или медвежьей силы из индикатора силы для подтверждения сигнала.
risk_percent Риск на сделку (%) — Процент от размера счёта, рискуемый на одну сделку.
risk_reward_ratio Соотношение риск/прибыль — Соотношение риска и прибыли (R:R), используемое при расчёте целей.
htf_timeframe Таймфрейм высшего уровня — Таймфрейм для получения данных высшего уровня и отображения его структуры.
fib_lookback Глубина поиска Фибоначчи — Количество баров для поиска экстремумов при построении автоматических уровней Фибоначчи.
trend_strength_period Период оценки силы тренда — Период скользящей средней для расчёта ценовой составляющей индикатора силы.
volume_ma_length Период средней объёма — Период скользящей средней объёма, используемой для анализа и фильтрации.
displacement_threshold Порог дислокейшна — Множитель ATR для определения минимального размера свечи при обнаружении дислокейшна.
range_threshold Порог обнаружения диапазона — Количество баров без новых экстремумов для определения диапазона консолидации.
extend_bars Продление баров — Количество баров вправо для продления графических объектов (коробок, линий).
Получить полный код

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

indicator("SMC - Complete Analysis", overlay=true, max_boxes_count=100, max_labels_count=200, max_lines_count=200)

swing_len = input.int(5, "Swing Length")
internal_swing_len = input.int(3, "Internal Swing Length")

sl_long_src  = ta.lowest(low,  5)           
sl_short_src = ta.highest(high, 5)

var float entry_px_fix  = na
var float sl_px_fix     = na
var float tp_px_fix     = na
var int   entry_bar_idx = na

isNewDay = ta.change(time("1D")) != 0

show_bos = input.bool(false, "Show BOS")
show_choch = input.bool(false, "Show CHoCH")
show_mss = input.bool(false, "Show MSS")
show_internal = input.bool(false, "Show Internal Structure")
show_displacement = input.bool(false, "Show Displacement")
show_range = input.bool(false, "Show Range/Consolidation")
show_fvg = input.bool(false, "Show FVG")
show_ob = input.bool(false, "Show Order Blocks")
show_inducement = input.bool(false, "Show Inducement")
show_liquidity = input.bool(false, "Show Liquidity Levels")
show_premium_discount = input.bool(false, "Show Premium/Discount")

show_kill_zones = input.bool(false, "Show Kill Zones")
show_sessions = input.bool(false, "Show Session Boxes")
show_daily_levels = input.bool(false, "Show Daily Levels")

show_entry_triggers = input.bool(true, "???? MAIN SIGNALS - BUY/SELL/SL/TP")
show_risk_calc = input.bool(false, "Show Risk Calculator")
show_targets = input.bool(false, "Show Target Projections")
show_htf_structure = input.bool(false, "Show HTF Structure")

show_fibonacci = input.bool(false, "Show Auto Fibonacci")
show_trend_lines = input.bool(false, "Show Auto Trend Lines")
show_money_flow = input.bool(false, "Show Smart Money Flow")
show_strength_meter = input.bool(false, "Show Strength Meter")
show_volume_analysis = input.bool(false, "Show Volume Analysis")

show_smt = input.bool(true, "Show Smart Money Trap (Liquidity Sweep + Displacement)")

show_discipline_mode = input.bool(true, "???? DISCIPLINE MODE - Simple BUY/SELL Signals")
min_confluence_score = input.int(3, "Minimum Confluence Score", minval=2, maxval=6)
require_kill_zone = input.bool(false, "Require Kill Zone Active")
require_strength_bias = input.bool(false, "Require Strength Meter Bias")

account_size = input.float(10000, "Account Size ($)", minval=100)
risk_percent = input.float(2.0, "Risk Per Trade (%)", minval=0.5, maxval=10.0)
risk_reward_ratio = input.float(3.0, "Risk:Reward Ratio", minval=1.0, maxval=10.0)
htf_timeframe = input.timeframe("60", "Higher Timeframe")

fib_lookback = input.int(50, "Fibonacci Lookback", minval=20, maxval=100)
trend_strength_period = input.int(20, "Trend Strength Period", minval=10, maxval=50)
volume_ma_length = input.int(20, "Volume MA Length", minval=5, maxval=50)

displacement_threshold = input.float(2.0, "Displacement Threshold", minval=1.0, maxval=5.0)
range_threshold = input.int(20, "Range Detection Bars", minval=10, maxval=50)
extend_bars = input.int(5, "Extension Bars")

swing_high = ta.pivothigh(high, swing_len, swing_len)
swing_low = ta.pivotlow(low, swing_len, swing_len)
internal_high = ta.pivothigh(high, internal_swing_len, internal_swing_len)
internal_low = ta.pivotlow(low, internal_swing_len, internal_swing_len)
atr_value = ta.atr(14)

current_hour = hour(time)
is_asian_kz = current_hour >= 0 and current_hour < 2
is_london_kz = current_hour >= 8 and current_hour < 10
is_ny_kz = current_hour >= 13 and current_hour < 15
is_asian_session = current_hour >= 0 and current_hour < 8
is_london_session = current_hour >= 8 and current_hour < 16
is_ny_session = current_hour >= 13 and current_hour < 21

var float last_bos_high = na
var float last_bos_low = na
var float last_swing_high = na
var float last_swing_low = na
var string current_trend = "sideways"
var float mss_high = na
var float mss_low = na
var bool in_range = false
var int bars_without_new_high = 0
var int bars_without_new_low = 0

var float entry_price = na
var float stop_loss = na
var float take_profit = na
var string trade_direction = ""
var bool trade_active = false
var float position_size = na

htf_high = request.security(syminfo.tickerid, htf_timeframe, high, lookahead=barmerge.lookahead_off)
htf_low = request.security(syminfo.tickerid, htf_timeframe, low, lookahead=barmerge.lookahead_off)
htf_close = request.security(syminfo.tickerid, htf_timeframe, close, lookahead=barmerge.lookahead_off)
htf_swing_high = request.security(syminfo.tickerid, htf_timeframe, ta.pivothigh(high, 5, 5), lookahead=barmerge.lookahead_off)
htf_swing_low = request.security(syminfo.tickerid, htf_timeframe, ta.pivotlow(low, 5, 5), lookahead=barmerge.lookahead_off)

volume_ma = ta.sma(volume, volume_ma_length)
volume_ratio = volume / volume_ma
money_flow_index = ta.mfi(hlc3, 14)
rsi_value = ta.rsi(close, 14)

var float fib_high = na
var float fib_low = na
var bool fib_active = false

var line bullish_trend_line = na
var line bearish_trend_line = na
var array<float> trend_highs = array.new<float>()
var array<float> trend_lows = array.new<float>()
var array<int> trend_high_bars = array.new<int>()
var array<int> trend_low_bars = array.new<int>()

var float bullish_strength = 0.0
var float bearish_strength = 0.0
var float overall_strength = 0.0

var int bullish_confluence = 0
var int bearish_confluence = 0

if not na(swing_high) and show_bos
    if not na(last_bos_high) and swing_high > last_bos_high
        bos_y = swing_high
        line.new(bar_index - swing_len, bos_y, bar_index + 25, bos_y, color=color.lime, width=2)
        price_text = "BOS: " + str.tostring(bos_y, "#.#####")
        label.new(bar_index + 10, bos_y, price_text, style=label.style_none, color=color.new(color.white, 100), textcolor=color.lime)
        current_trend := "bullish"
    last_bos_high := swing_high

if not na(swing_low) and show_bos
    if not na(last_bos_low) and swing_low < last_bos_low
        bos_y = swing_low
        line.new(bar_index - swing_len, bos_y, bar_index + 25, bos_y, color=color.red, width=2)
        price_text = "BOS: " + str.tostring(bos_y, "#.#####")
        label.new(bar_index + 10, bos_y, price_text, style=label.style_none, color=color.new(color.white, 100), textcolor=color.red)
        current_trend := "bearish"
    last_bos_low := swing_low

if show_mss
    if not na(swing_high) and not na(mss_high)
        if swing_high > mss_high and math.abs(close - open) > atr_value * 0.5
            mss_y = swing_high
            line.new(bar_index - swing_len, mss_y, bar_index + 30, mss_y, color=color.aqua, width=3)
            price_text = "MSS: " + str.tostring(mss_y, "#.#####")
            label.new(bar_index + 12, mss_y, price_text, style=label.style_none, color=color.new(color.white, 100), textcolor=color.aqua)
            label.new(bar_index - swing_len, mss_y, "MSS↑", style=label.style_label_down, color=color.aqua, textcolor=color.white)
            current_trend := "strong_bullish"
    if not na(swing_low) and not na(mss_low)
        if swing_low < mss_low and math.abs(close - open) > atr_value * 0.5
            mss_y = swing_low
            line.new(bar_index - swing_len, mss_y, bar_index + 30, mss_y, color=color.fuchsia, width=3)
            price_text = "MSS: " + str.tostring(mss_y, "#.#####")
            label.new(bar_index + 12, mss_y, price_text, style=label.style_none, color=color.new(color.white, 100), textcolor=color.fuchsia)
            label.new(bar_index - swing_len, mss_y, "MSS↓", style=label.style_label_up, color=color.fuchsia, textcolor=color.white)
            current_trend := "strong_bearish"
    if not na(swing_high)
        mss_high := swing_high
    if not na(swing_low)
        mss_low := swing_low

if show_kill_zones
    if is_asian_kz
        box.new(bar_index, low, bar_index + 1, high, bgcolor=color.new(color.yellow, 85), border_color=color.yellow)
        if current_hour == 0
            label.new(bar_index, high, "ASIAN KZ", style=label.style_label_down, color=color.yellow, textcolor=color.black)
    if is_london_kz
        box.new(bar_index, low, bar_index + 1, high, bgcolor=color.new(color.yellow, 85), border_color=color.yellow)
        if current_hour == 8
            label.new(bar_index, high, "LONDON KZ", style=label.style_label_down, color=color.yellow, textcolor=color.black)
    if is_ny_kz
        box.new(bar_index, low, bar_index + 1, high, bgcolor=color.new(color.yellow, 85), border_color=color.yellow)
        if current_hour == 13
            label.new(bar_index, high, "NY KZ", style=label.style_label_down, color=color.yellow, textcolor=color.black)

if show_sessions
    if is_asian_session
        box.new(bar_index, low, bar_index + 1, high, bgcolor=color.new(color.blue, 95), border_color=color.new(color.blue, 90))
    else if is_london_session
        box.new(bar_index, low, bar_index + 1, high, bgcolor=color.new(color.green, 95), border_color=color.new(color.green, 90))
    else if is_ny_session
        box.new(bar_index, low, bar_index + 1, high, bgcolor=color.new(color.red, 95), border_color=color.new(color.red, 90))

if show_daily_levels and isNewDay
    pdh = high[1]
    pdl = low[1]
    line.new(bar_index, pdh, bar_index + 50, pdh, color=color.orange, width=2)
    label.new(bar_index + 25, pdh, "PDH: " + str.tostring(pdh, "#.#####"), style=label.style_none, color=color.new(color.white, 100), textcolor=color.orange)
    line.new(bar_index, pdl, bar_index + 50, pdl, color=color.orange, width=2)
    label.new(bar_index + 25, pdl, "PDL: " + str.tostring(pdl, "#.#####"), style=label.style_none, color=color.new(color.white, 100), textcolor=color.orange)

if show_displacement
    candle_body = math.abs(close - open)
    displacement_size = atr_value * displacement_threshold
    if close > open and candle_body > displacement_size and high - close < candle_body * 0.1
        label.new(bar_index, high, "DISP↑", style=label.style_label_down, color=color.new(color.lime, 50), textcolor=color.black)
    if close < open and candle_body > displacement_size and close - low < candle_body * 0.1
        label.new(bar_index, low, "DISP↓", style=label.style_label_up, color=color.new(color.red, 50), textcolor=color.white)

if show_range
    if high > high[1]
        bars_without_new_high := 0
    else
        bars_without_new_high += 1
    if low < low[1]
        bars_without_new_low := 0
    else
        bars_without_new_low += 1
    if bars_without_new_high >= range_threshold and bars_without_new_low >= range_threshold and not in_range
        in_range := true
        range_high = ta.highest(high, range_threshold)
        range_low = ta.lowest(low, range_threshold)
        box.new(bar_index - range_threshold, range_low, bar_index + 10, range_high, bgcolor=color.new(color.gray, 90), border_color=color.gray)
        label.new(bar_index, (range_high + range_low) / 2, "RANGE", style=label.style_none, color=color.new(color.white, 100), textcolor=color.gray)

if show_internal and not na(internal_high)
    label.new(bar_index - internal_swing_len, internal_high, "h", style=label.style_circle, color=color.new(color.green, 50), textcolor=color.green, size=size.tiny)
if show_internal and not na(internal_low)
    label.new(bar_index - internal_swing_len, internal_low, "l", style=label.style_circle, color=color.new(color.red, 50), textcolor=color.red, size=size.tiny)

var float prev_swing_high = na
var float prev_swing_low = na
var bool bull_inducement = false
var bool bear_inducement = false
if not na(swing_high) and show_inducement
    if not na(prev_swing_high) and high > prev_swing_high and close < prev_swing_high
        bull_inducement := true
        label.new(bar_index, high, "IND", style=label.style_label_down, color=color.yellow, textcolor=color.black)
    prev_swing_high := swing_high
if not na(swing_low) and show_inducement
    if not na(prev_swing_low) and low < prev_swing_low and close > prev_swing_low
        bear_inducement := true
        label.new(bar_index, low, "IND", style=label.style_label_up, color=color.yellow, textcolor=color.black)
    prev_swing_low := swing_low

if not na(swing_high)
    engulf_condition = not na(last_swing_low) and swing_high > last_swing_low
    if (bull_inducement or bear_inducement) or engulf_condition
        hl_text = not na(last_swing_high) ? (swing_high > last_swing_high ? "HH" : "LH") : "H"

    last_swing_high := swing_high
    bull_inducement := false

if not na(swing_low)
    engulf_condition = not na(last_swing_high) and swing_low < last_swing_high
    if (bull_inducement or bear_inducement) or engulf_condition
        ll_text = not na(last_swing_low) ? (swing_low < last_swing_low ? "LL" : "HL") : "L"

    last_swing_low := swing_low
    bear_inducement := false

if show_fvg
    if low[2] > high[0]
        box.new(bar_index[2], low[2], bar_index + extend_bars, high[0], bgcolor=color.new(color.blue, 80), border_color=color.blue)
        label.new(bar_index[1], low[2], "FVG↑", style=label.style_label_up, color=color.blue, textcolor=color.white, size=size.tiny)
    if high[2] < low[0]
        box.new(bar_index[2], high[2], bar_index + extend_bars, low[0], bgcolor=color.new(color.orange, 80), border_color=color.orange)
        label.new(bar_index[1], high[2], "FVG↓", style=label.style_label_down, color=color.orange, textcolor=color.white, size=size.tiny)

if show_ob
    if close[1] < open[1] and close > high[1]
        box.new(bar_index[1], low[1], bar_index + extend_bars, high[1], bgcolor=color.new(color.green, 85), border_color=color.green)
        label.new(bar_index[1], low[1], "OB↑", style=label.style_label_up, color=color.green, textcolor=color.white, size=size.tiny)
    if close[1] > open[1] and close < low[1]
        box.new(bar_index[1], low[1], bar_index + extend_bars, high[1], bgcolor=color.new(color.red, 85), border_color=color.red)
        label.new(bar_index[1], high[1], "OB↓", style=label.style_label_down, color=color.red, textcolor=color.white, size=size.tiny)

if show_htf_structure
    if not na(htf_swing_high) and htf_swing_high != htf_swing_high[1]
        line.new(bar_index, htf_swing_high, bar_index + 20, htf_swing_high, color=color.blue, width=2, style=line.style_dashed)
        label.new(bar_index + 10, htf_swing_high, "HTF H", style=label.style_none, color=color.new(color.white, 100), textcolor=color.blue)
    if not na(htf_swing_low) and htf_swing_low != htf_swing_low[1]
        line.new(bar_index, htf_swing_low, bar_index + 20, htf_swing_low, color=color.blue, width=2, style=line.style_dashed)
        label.new(bar_index + 10, htf_swing_low, "HTF L", style=label.style_none, color=color.new(color.white, 100), textcolor=color.blue)

if show_entry_triggers

    bullish_confluence := 0
    bearish_confluence := 0

    structure_bullish = current_trend == "bullish" or current_trend == "strong_bullish"
    structure_bearish = current_trend == "bearish" or current_trend == "strong_bearish"

    active_session = is_london_session or is_ny_session
    kill_zone_active = is_london_kz or is_ny_kz

    in_discount = not na(last_swing_high) and not na(last_swing_low) and close < (last_swing_low + (last_swing_high - last_swing_low) * 0.4)
    in_premium = not na(last_swing_high) and not na(last_swing_low) and close > (last_swing_low + (last_swing_high - last_swing_low) * 0.6)

    bullish_ob = close[1] < open[1] and close > high[1]
    bearish_ob = close[1] > open[1] and close < low[1]

    smart_buying = volume > volume_ma * 1.2 and close > open and in_discount
    smart_selling = volume > volume_ma * 1.2 and close < open and in_premium

    htf_bullish_bias = not na(htf_close) and close > htf_close
    htf_bearish_bias = not na(htf_close) and close < htf_close

    strength_bullish = overall_strength > 0
    strength_bearish = overall_strength < 0

    if structure_bullish
        bullish_confluence := bullish_confluence + 1
    if active_session
        bullish_confluence := bullish_confluence + 1
    if in_discount and bullish_ob
        bullish_confluence := bullish_confluence + 1
    if smart_buying
        bullish_confluence := bullish_confluence + 1
    if htf_bullish_bias
        bullish_confluence := bullish_confluence + 1
    if strength_bullish
        bullish_confluence := bullish_confluence + 1

    if structure_bearish
        bearish_confluence := bearish_confluence + 1
    if active_session
        bearish_confluence := bearish_confluence + 1
    if in_premium and bearish_ob
        bearish_confluence := bearish_confluence + 1
    if smart_selling
        bearish_confluence := bearish_confluence + 1
    if htf_bearish_bias
        bearish_confluence := bearish_confluence + 1
    if strength_bearish
        bearish_confluence := bearish_confluence + 1

    if show_discipline_mode

        valid_buy_setup = bullish_confluence >= min_confluence_score and
                          (not require_kill_zone or kill_zone_active) and
                          (not require_strength_bias or strength_bullish) and
                          not trade_active

        valid_sell_setup = bearish_confluence >= min_confluence_score and
                           (not require_kill_zone or kill_zone_active) and
                           (not require_strength_bias or strength_bearish) and
                           not trade_active

        if valid_sell_setup and not trade_active and barstate.isconfirmed
            trade_direction := "SHORT"
            trade_active    := true
            entry_px_fix    := close
            sl_px_fix       := sl_short_src + atr_value * 0.5
            tp_px_fix       := entry_px_fix - (sl_px_fix - entry_px_fix) * risk_reward_ratio
            entry_bar_idx   := bar_index

            line.new(bar_index, entry_px_fix, bar_index + 50, entry_px_fix, color=color.new(color.blue, 0), width=2)
            line.new(bar_index, sl_px_fix,    bar_index + 50, sl_px_fix,    color=color.new(color.red,  0), width=1, style=line.style_dashed)
            line.new(bar_index, tp_px_fix,    bar_index + 50, tp_px_fix,    color=color.new(color.green,0), width=2)
            label.new(bar_index, entry_px_fix, "ENTRY", style=label.style_label_right, color=color.blue,  textcolor=color.white, size=size.small)
            label.new(bar_index, sl_px_fix,    "SL",    style=label.style_label_right, color=color.red,   textcolor=color.white, size=size.small)
            label.new(bar_index, tp_px_fix,    "TP",    style=label.style_label_right, color=color.green, textcolor=color.white, size=size.small)

        if valid_sell_setup
            entry_price := close

            stop_loss := ta.highest(high, 5)
            take_profit := entry_price - (math.abs(stop_loss - entry_price) * risk_reward_ratio)
            trade_direction := "SHORT"
            trade_active := true

            label.new(bar_index, high, "SELL", style=label.style_label_down, color=color.red, textcolor=color.white, size=size.normal)
            label.new(bar_index, entry_price, "ENTRY: " + str.tostring(entry_price, "#.#####"), 
                     style=label.style_label_right, color=color.blue, textcolor=color.white, size=size.small)
            label.new(bar_index, stop_loss, "SL: " + str.tostring(stop_loss, "#.#####"), 
                     style=label.style_label_right, color=color.red, textcolor=color.white, size=size.small)
            label.new(bar_index, take_profit, "TP: " + str.tostring(take_profit, "#.#####"), 
                     style=label.style_label_right, color=color.green, textcolor=color.white, size=size.small)
    else

        bullish_setup = in_discount and (is_london_session or is_ny_session) and close[1] < open[1] and close > high[1]
        bearish_setup = in_premium and (is_london_session or is_ny_session) and close[1] > open[1] and close < low[1]
        if bullish_setup and not trade_active
            entry_price := close
            stop_loss := low[1] - (atr_value * 0.5)
            trade_direction := "LONG"
            trade_active := true
            label.new(bar_index, low, "LONG ENTRY", style=label.style_label_up, color=color.lime, textcolor=color.black, size=size.normal)
            line.new(bar_index, entry_price, bar_index + 50, entry_price, color=color.lime, width=2)
            line.new(bar_index, stop_loss, bar_index + 50, stop_loss, color=color.red, width=1, style=line.style_dashed)
        if bearish_setup and not trade_active
            entry_price := close
            stop_loss := high[1] + (atr_value * 0.5)
            trade_direction := "SHORT"
            trade_active := true
            label.new(bar_index, high, "SHORT ENTRY", st

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

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

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

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

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

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

Стоимость полного кода
3 368,20₽ ≈ $41.17