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

TM Sniper Pro

tm sniper pro.pine

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

xauusd_gold_perfect.mq4MQL4 / MetaTrader 4 · 2 общих теговsniper pro.mq5MQL5 / MetaTrader 5 · 2 общих теговpro +.pineTradingView · 2 общих теговofada_gold_trader_v230.mq5MQL5 / MetaTrader 5 · 2 общих теговmulti strategy algo combined by enigma mode.pineTradingView · 2 общих теговkirin ea.mq4MQL4 / MetaTrader 4 · 2 общих тегов
Вы автор или правообладатель?

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

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

О программе

Индикатор предоставляет динамические оповещения о новых сигналах, сильном рыночном уклоне и закрытии позиции. Настраиваются периоды EMA, множитель ATR для стоп-лосса, количество уровней тейк-профита, автоматический сброс позиции, сдвиг стоп-лосса в безубыток и минимальное количество баров после выхода перед новой сигнатурой.

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

НастройкаОписание
fastMaPeriodInput Период быстрой EMA — Период быстрой экспоненциальной скользящей средней
slowMaPeriodInput Период медленной EMA — Период медленной экспоненциальной скользящей средней
barCloseConfirmInput Подтверждение по закрытию бара — Сигналы срабатывают только на подтверждённых закрытых барах
barsAfterExitInput Минимум баров после выхода — Минимальное количество баров ожидания после закрытия позиции перед новой сигнатурой
useConfluenceFilterInput Включить фильтр конфлюэнса — Требует минимальный балл конфлюэнса для срабатывания сигналов
minConfluenceScoreInput Минимальный балл (из 7) — Минимальное количество совпавших факторов для триггера сигнала
atrSlMultiplierInput Множитель ATR для SL — Множитель ATR для расстояния стоп-лосса
atrPeriodInput Период ATR — Период расчёта ATR для уровней стоп-лосса и тейк-профита
targetCountInput Количество уровней TP — Количество отображаемых уровней тейк-профита от 1 до 5
trailSlToBreakevenInput Сдвиг SL в безубыток при TP1 — При достижении первого тейк-профита стоп-лосс перемещается в точку входа
autoResetPositionInput Автосброс позиции при TP/SL — Автоматически сбрасывает позицию при достижении максимального тейк-профита или стоп-лосса
secondaryTfInput Таймфрейм подтверждения RSI — Таймфрейм для вторичного подтверждения RSI
showDashboardInput Показать панель — Включает или выключает таблицу анализа рынка на графике
dashPositionInput Позиция панели — Экранная позиция таблицы с данными
dashFontSizeInput Размер шрифта панели — Размер шрифта текста панели
showRibbonInput Показать заливку EMA-ленты — Отображает цветную заливку между быстрой и медленной EMA
ribbonTransparencyInput Прозрачность EMA-ленты — Уровень прозрачности заливки EMA-ленты
showVwapInput Показать VWAP — Отображает линию объёмно-взвешенной средней цены
showTpLinesInput Показать линии и метки TP/SL — Отображает линии и ценовые метки входа, стоп-лосса и тейк-профита
tradeLabelSizeInput Размер меток сделок — Размер шрифта меток TP, SL и Entry на графике
labelBarOffsetInput Смещение меток вправо (бары) — Количество баров вправо для размещения меток ценовых уровней
showRetestHighlightInput Подсвечивать бары ретеста — Подсвечивает свечи оранжевым при ретесте быстрой EMA после сигнала
optimizePerformanceInput Оптимизация производительности (TF<5мин) — Уменьшает визуальные элементы на низких таймфреймах для лучшей производительности
Получить полный код

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

indicator("TM Sniper Pro", overlay=true, max_labels_count=200, max_boxes_count=200, max_bars_back=1000)

const int    TOTAL_FACTORS        = 7
const color  COLOR_BULL_STRONG    = #00C853
const color  COLOR_BULL_MILD      = #66BB6A
const color  COLOR_BEAR_STRONG    = #FF1744
const color  COLOR_BEAR_MILD      = #EF5350
const color  COLOR_NEUTRAL        = #9E9E9E
const color  COLOR_ENTRY          = #2196F3
const color  COLOR_STOPLOSS       = #FF1744
const color  COLOR_TARGET         = #00E676
const color  COLOR_TARGET_HIT     = #40E0D0
const color  COLOR_TARGET_DEEP    = #00695C
const color  COLOR_TARGET_DEEPEST = #004D40
const color  COLOR_VWAP_BULL      = #26A69A
const color  COLOR_VWAP_BEAR      = #EF5350
const color  COLOR_RETEST         = #FF9800
const color  COLOR_DASHBOARD_BG   = #1A1A2E
const color  COLOR_DASHBOARD_HDR  = #0F3460
const string VP_LABEL             = "TM"

string GRP_SIGNAL = "Signal Settings"
int fastMaPeriodInput = input.int(9, "Fast EMA Period", minval=2, maxval=50, group=GRP_SIGNAL,
     tooltip="Period for the fast exponential moving average. Lower values = more responsive, more signals.")
int slowMaPeriodInput = input.int(21, "Slow EMA Period", minval=5, maxval=200, group=GRP_SIGNAL,
     tooltip="Period for the slow exponential moving average. Higher values = smoother, fewer signals.")
bool barCloseConfirmInput = input.bool(true, "Bar-Close Confirmation", group=GRP_SIGNAL,
     tooltip="When enabled, signals only fire on confirmed (closed) bars, reducing false signals from wicks.")
int barsAfterExitInput = input.int(3, "Min Bars After Exit", minval=1, maxval=20, group=GRP_SIGNAL,
     tooltip="Minimum number of bars to wait after position closed before new signal.")

string GRP_CONFLUENCE = "Confluence Filter"
bool useConfluenceFilterInput = input.bool(true, "Enable Confluence Filter", group=GRP_CONFLUENCE,
     tooltip="When enabled, buy/sell signals require a minimum confluence score to fire. This filters out weak setups.")
int minConfluenceScoreInput = input.int(4, "Minimum Score (out of 7)", minval=1, maxval=7, group=GRP_CONFLUENCE,
     tooltip="Minimum number of factors that must align for a signal to trigger. Higher = fewer but higher-quality signals.")

string GRP_RISK = "Risk Management"
float atrSlMultiplierInput = input.float(1.5, "SL ATR Multiplier", minval=0.1, step=0.1, group=GRP_RISK,
     tooltip="ATR multiplier for stop-loss distance. Higher values = wider stops, fewer stop-outs but larger risk per trade.")
int atrPeriodInput = input.int(14, "ATR Period", minval=1, maxval=50, group=GRP_RISK,
     tooltip="Lookback period for ATR calculation used in SL/TP levels.")
int targetCountInput = input.int(5, "Number of TP Levels", minval=1, maxval=5, group=GRP_RISK,
     tooltip="How many take-profit levels to display (1 to 5). Each level is 1x ATR risk further from entry.")
bool trailSlToBreakevenInput = input.bool(true, "Trail SL to Breakeven at TP1", group=GRP_RISK,
     tooltip="When TP1 is hit, the stop-loss line moves to the entry price (breakeven).")
bool autoResetPositionInput = input.bool(true, "Auto Reset Position at TP/SL", group=GRP_RISK,
     tooltip="Automatically reset position when TP5 or SL is hit to allow new signals.")

string GRP_MTF = "Secondary Timeframe"
string secondaryTfInput = input.timeframe("5", "RSI Confirmation Timeframe", group=GRP_MTF,
     tooltip="Timeframe for the secondary RSI confirmation factor. Default is 5-minute.")

string GRP_DASH = "Dashboard"
bool showDashboardInput = input.bool(true, "Show Dashboard", group=GRP_DASH,
     tooltip="Toggle the market analysis dashboard on/off.")
string dashPositionInput = input.string("Middle Left", "Dashboard Position",
     options=["Top Left", "Top Right", "Middle Left", "Middle Right", "Bottom Left", "Bottom Right"], group=GRP_DASH,
     tooltip="Screen position for the dashboard table.")
string dashFontSizeInput = input.string("small", "Dashboard Font Size",
     options=["tiny", "small", "normal", "large", "huge"], group=GRP_DASH,
     tooltip="Font size for all dashboard text.")

string GRP_VIS = "Visuals"
bool showRibbonInput = input.bool(true, "Show EMA Ribbon Fill", group=GRP_VIS,
     tooltip="Display the colored fill between fast and slow EMAs.")
int ribbonTransparencyInput = input.int(75, "EMA Ribbon Transparency", minval=0, maxval=100, group=GRP_VIS,
     tooltip="Transparency of the EMA ribbon fill. 0 = opaque, 100 = invisible.")
bool showVwapInput = input.bool(true, "Show VWAP", group=GRP_VIS,
     tooltip="Display the Volume Weighted Average Price line.")
bool showTpLinesInput = input.bool(true, "Show TP/SL Lines & Labels", group=GRP_VIS,
     tooltip="Display entry, stop-loss, and take-profit lines with price labels.")
string tradeLabelSizeInput = input.string("small", "Trade Label Size",
     options=["tiny", "small", "normal", "large", "huge"], group=GRP_VIS,
     tooltip="Font size for TP/SL/Entry labels on the chart.")
int labelBarOffsetInput = input.int(12, "Label Right Offset (Bars)", minval=1, maxval=50, group=GRP_VIS,
     tooltip="How many bars to the right the TP/Entry/SL labels are placed.")
bool showRetestHighlightInput = input.bool(true, "Highlight Retest Candles", group=GRP_VIS,
     tooltip="Color candles orange when price retests the fast EMA after a signal.")
bool optimizePerformanceInput = input.bool(true, "Optimize Performance (TF<5min)", group=GRP_VIS,
     tooltip="Reduces visual elements on lower timeframes for better performance.")

getDashPosition(string pos) =>
    switch pos
        "Top Left"     => position.top_left
        "Top Right"    => position.top_right
        "Middle Left"  => position.middle_left
        "Middle Right" => position.middle_right
        "Bottom Left"  => position.bottom_left
        "Bottom Right" => position.bottom_right

getFontSize(string sz) =>
    switch sz
        "tiny"   => size.tiny
        "small"  => size.small
        "normal" => size.normal
        "large"  => size.large
        "huge"   => size.huge

appendDashRow(table tbl, int rowIdx, string title, string val, color valColor, string fontSize) =>
    table.cell(tbl, 0, rowIdx, title, text_color=color.new(color.white, 20), text_halign=text.align_left,
         text_size=getFontSize(fontSize), bgcolor=COLOR_DASHBOARD_BG)
    table.cell(tbl, 1, rowIdx, val, text_color=valColor, text_size=getFontSize(fontSize),
         text_halign=text.align_right, bgcolor=COLOR_DASHBOARD_BG)

isLowTimeframe() =>
    optimizePerformanceInput and (timeframe.isseconds or (timeframe.isintraday and timeframe.multiplier < 5))

float fastMaLine       = ta.ema(close, fastMaPeriodInput)
float slowMaLine       = ta.ema(close, slowMaPeriodInput)
float vwapLine         = ta.vwap(hlc3)
float avgTrueRange     = ta.atr(atrPeriodInput)
float rsiValue         = ta.rsi(close, 14)
float secondaryRsi     = request.security(syminfo.tickerid, secondaryTfInput, ta.rsi(close, 14), lookahead=barmerge.lookahead_off)
[macdMain, macdSignal, _macdHist] = ta.macd(close, 12, 26, 9)
[_diPlus, _diMinus, adxValue]     = ta.dmi(14, 14)
float volumeAverage    = ta.sma(volume, 20)

float bullishScore = 0
bullishScore += close > vwapLine                              ? 1 : 0
bullishScore += rsiValue > 50                                 ? 1 : 0
bullishScore += macdMain > macdSignal                         ? 1 : 0
bullishScore += fastMaLine > slowMaLine                       ? 1 : 0
bullishScore += adxValue > 25 and close > fastMaLine          ? 1 : 0
bullishScore += volume > volumeAverage and close > open       ? 1 : 0
bullishScore += secondaryRsi > 50                             ? 1 : 0
float bullishPct = (bullishScore / TOTAL_FACTORS) * 100

float bearishScore = 0
bearishScore += close < vwapLine                              ? 1 : 0
bearishScore += rsiValue < 50                                 ? 1 : 0
bearishScore += macdMain < macdSignal                         ? 1 : 0
bearishScore += fastMaLine < slowMaLine                       ? 1 : 0
bearishScore += adxValue > 25 and close < fastMaLine          ? 1 : 0
bearishScore += volume > volumeAverage and close < open       ? 1 : 0
bearishScore += secondaryRsi < 50                             ? 1 : 0
float bearishPct = (bearishScore / TOTAL_FACTORS) * 100

string biasLabel = (bullishPct - bearishPct) >= 40 ? "STRONG BULL" :
     (bearishPct - bullishPct) >= 40 ? "STRONG BEAR" :
     bullishPct > bearishPct ? "MILD BULL" : "MILD BEAR"
color biasColor = biasLabel == "STRONG BULL" ? COLOR_BULL_STRONG :
     biasLabel == "STRONG BEAR" ? COLOR_BEAR_STRONG :
     biasLabel == "MILD BULL" ? COLOR_BULL_MILD : COLOR_BEAR_MILD

var int   activeDirection   = 0
var float entryPrice        = 0.0
var float stopLossPrice     = 0.0
var float targetPrice1      = 0.0
var float targetPrice2      = 0.0
var float targetPrice3      = 0.0
var float targetPrice4      = 0.0
var float targetPrice5      = 0.0
var bool  target1Reached    = false
var bool  target2Reached    = false
var bool  target3Reached    = false
var bool  target4Reached    = false
var bool  target5Reached    = false
var bool  slMovedToBreakeven = false
var int   barsSinceExit     = 0
var int   lastSignalBar     = 0
var float lastEntryPrice    = 0.0  // Para alertas precisas

var line  lineEntry         = na
var line  lineSl            = na
var line  lineTp1           = na
var line  lineTp2           = na
var line  lineTp3           = na
var line  lineTp4           = na
var line  lineTp5           = na
var label lblEntry          = na
var label lblSl             = na
var label lblTp1            = na
var label lblTp2            = na
var label lblTp3            = na
var label lblTp4            = na
var label lblTp5            = na

if na(lblEntry)
    lblEntry := label.new(na, na, "", color=COLOR_ENTRY, textcolor=color.white, style=label.style_label_left, size=getFontSize(tradeLabelSizeInput))
if na(lblSl)
    lblSl := label.new(na, na, "", color=COLOR_STOPLOSS, textcolor=color.white, style=label.style_label_left, size=getFontSize(tradeLabelSizeInput))
if na(lblTp1)
    lblTp1 := label.new(na, na, "", color=COLOR_TARGET, textcolor=color.white, style=label.style_label_left, size=getFontSize(tradeLabelSizeInput))
if na(lblTp2)
    lblTp2 := label.new(na, na, "", color=COLOR_TARGET, textcolor=color.white, style=label.style_label_left, size=getFontSize(tradeLabelSizeInput))
if na(lblTp3)
    lblTp3 := label.new(na, na, "", color=COLOR_TARGET, textcolor=color.white, style=label.style_label_left, size=getFontSize(tradeLabelSizeInput))
if na(lblTp4)
    lblTp4 := label.new(na, na, "", color=COLOR_TARGET_DEEP, textcolor=color.white, style=label.style_label_left, size=getFontSize(tradeLabelSizeInput))
if na(lblTp5)
    lblTp5 := label.new(na, na, "", color=COLOR_TARGET_DEEPEST, textcolor=color.white, style=label.style_label_left, size=getFontSize(tradeLabelSizeInput))

bool positionClosed = false
if autoResetPositionInput and activeDirection != 0
    if activeDirection == 1

        if low <= stopLossPrice or (targetCountInput >= 5 and high >= targetPrice5 and target5Reached)
            positionClosed := true
    else if activeDirection == -1

        if high >= stopLossPrice or (targetCountInput >= 5 and low <= targetPrice5 and target5Reached)
            positionClosed := true

if positionClosed
    activeDirection := 0
    entryPrice := 0.0
    stopLossPrice := 0.0
    targetPrice1 := 0.0
    targetPrice2 := 0.0
    targetPrice3 := 0.0
    targetPrice4 := 0.0
    targetPrice5 := 0.0
    target1Reached := false
    target2Reached := false
    target3Reached := false
    target4Reached := false
    target5Reached := false
    slMovedToBreakeven := false
    barsSinceExit := 0
    lastEntryPrice := 0.0

if activeDirection == 0
    barsSinceExit := barsSinceExit + 1
else
    barsSinceExit := 0

bool rawBullishCross = ta.crossover(fastMaLine, slowMaLine)
bool rawBearishCross = ta.crossunder(fastMaLine, slowMaLine)

bool confirmedBullCross = barCloseConfirmInput ? (rawBullishCross and barstate.isconfirmed) : rawBullishCross
bool confirmedBearCross = barCloseConfirmInput ? (rawBearishCross and barstate.isconfirmed) : rawBearishCross

bool confluenceBullPass = useConfluenceFilterInput ? bullishScore >= minConfluenceScoreInput : true
bool confluenceBearPass = useConfluenceFilterInput ? bearishScore >= minConfluenceScoreInput : true

bool canEnter = barsSinceExit >= barsAfterExitInput or activeDirection == 0

bool entryLongSignal  = confirmedBullCross and activeDirection <= 0 and confluenceBullPass and canEnter and bar_index > lastSignalBar
bool entryShortSignal = confirmedBearCross and activeDirection >= 0 and confluenceBearPass and canEnter and bar_index > lastSignalBar

if entryLongSignal or entryShortSignal
    activeDirection := entryLongSignal ? 1 : -1
    entryPrice      := close
    lastEntryPrice  := close  // Guardar para alertas
    float riskAmount = avgTrueRange * atrSlMultiplierInput
    stopLossPrice   := entryLongSignal ? entryPrice - riskAmount : entryPrice + riskAmount
    targetPrice1    := entryLongSignal ? entryPrice + riskAmount         : entryPrice - riskAmount
    targetPrice2    := entryLongSignal ? entryPrice + (riskAmount * 2)   : entryPrice - (riskAmount * 2)
    targetPrice3    := entryLongSignal ? entryPrice + (riskAmount * 3)   : entryPrice - (riskAmount * 3)
    targetPrice4    := entryLongSignal ? entryPrice + (riskAmount * 4)   : entryPrice - (riskAmount * 4)
    targetPrice5    := entryLongSignal ? entryPrice + (riskAmount * 5)   : entryPrice - (riskAmount * 5)
    targe

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

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

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

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

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

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

Стоимость полного кода
2 142,20₽ ≈ $26.19