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

Fresh Algo v24

fresh algo v24 tradingview indicator_5918156155804195406.pine

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

2 to 1 strategy with signals.pineTradingView · 4 общих теговfresh algo signals & overlays v25_6334471093901859175.pineTradingView · 4 общих теговday trading.mq4MQL4 / MetaTrader 4 · 4 общих теговea robofibo source v.11.2.mq4MQL4 / MetaTrader 4 · 3 общих теговpro +.pineTradingView · 3 общих теговofada_gold_trader_v230.mq5MQL5 / MetaTrader 5 · 3 общих тегов
Вы автор или правообладатель?

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

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

О программе

Fresh Algo v24 — это индикатор для TradingView, написанный на Pine Script v5 и отображаемый поверх ценового графика. Он объединяет множество технических инструментов: скользящие средние EMA, осцилляторы на основе RSI, MACD, Supertrend, волновые и фрактальные детекторы, а также инструменты анализа мультитаймфрейма. Индикатор генерирует сигналы покупки и продажи на основе совпадения нескольких фильтров и отображает их в виде меток на графике.

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

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

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

НастройкаОписание
showSignals Показать сигналы — Включает или отключает отображение меток сигналов покупки и продажи на графике.
sensitivity Чувствительность — Шаг чувствительности Supertrend. Чем выше значение, тем позже сигнал меняет направление тренда.
STuner Настройка сигнала — Диапазон: 1–25. Определяет чувствительность индикатора Supertrend, используемого для определения направления тренда.
filterstyle Режим сигналов / Фильтры — Выбор режима и фильтра сигналов: трендовые, контрагентные, фильтр объёма, сильные сигналы или различные облачные фильтры.
assistantenable Включить помощника — Включает или отключает режим торгового помощника с отображением облачной зоны тренда.
assistantmode Режим помощника — Выбор режима помощника: «Trend Assistant» (облачный анализ) или «Trend Tracker» (отслеживание тренда через EMA).
Show_PR Показать точки разворота — Включает или отключает отображение точек разворота в виде маленьких меток под или над свечами.
MSTuner Настройка точки разворота — Диапазон: 2–30. Определяет чувствительность детектора точек разворота, влияющую на отображение меток разворота на графике.
showDashboard Умная панель — Включает или отключает отображение умной панели с информацией о трендах, волатильности и сессиях.
locationDashboard Расположение панели — Выбор расположения умной панели на графике: верхний/средний/нижний, правый/центральный/левый.
sizeDashboard Размер панели — Размер текста и элементов умной панели: большой, нормальный, маленький или миниатюрный.
tpLabels Метки тейк-профита — Включает или отключает отображение динамических меток тейк-профита на графике.
ShowTpSlAreas Показать область тейк-профита/стоп-лосса — Включает или отключает отображение зон и линий тейк-профита и стоп-лосса на графике.
ShowTrailingSL Показать скользящий стоп-лосс — Включает или отключает отображение скользящей линии стоп-лосса на графике.
usePercSL Процентный стоп-лосс — Переключает расчёт скользящего стоп-лосса между процентным и стандартным (на основе ATR).
percTrailingSL Значение скользящего стоп-лосса — Процентное значение для расчёта скользящего стоп-лосса, если включён процентный режим.
useTP1 Использовать тейк-профит 1 — Включает или отключает первый уровень тейк-профита.
multTP1 Множитель тейк-профита 1 — Множитель для расчёта первого уровня тейк-профита относительно расстояния до стоп-лосса.
useTP2 Использовать тейк-профит 2 — Включает или отключает второй уровень тейк-профита.
multTP2 Множитель тейк-профита 2 — Множитель для расчёта второго уровня тейк-профита относительно расстояния до стоп-лосса.
useTP3 Использовать тейк-профит 3 — Включает или отключает третий уровень тейк-профита.
multTP3 Множитель тейк-профита 3 — Множитель для расчёта третьего уровня тейк-профита относительно расстояния до стоп-лосса.
ShowSwings Показать рыночную структуру — Включает или отключает отображение маркеров рыночной структуры (развороты и продолжения) на графике.
periodSwings Период рыночной структуры — Период в свечах для определения точек разворота рыночной структуры.
Normalbuy_alert Сигнал покупки — Включает или отключает оповещение при появлении обычного сигнала покупки.
Strongbuy_alert Сильная покупка — Включает или отключает оповещение при появлении сигнала сильной покупки.
Normalsell_alert Сигнал продажи — Включает или отключает оповещение при появлении обычного сигнала продажи.
Strongsell_alert Сильная продажа — Включает или отключает оповещение при появлении сигнала сильной продажи.
slalert Стоп-лосс — Включает или отключает оповещение при срабатывании уровня стоп-лосса.
tp1alert Цель 1 — Включает или отключает оповещение при достижении первого уровня тейк-профита.
tp2alert Цель 2 — Включает или отключает оповещение при достижении второго уровня тейк-профита.
tp3alert Цель 3 — Включает или отключает оповещение при достижении третьего уровня тейк-профита.
bullcrosscloud_alert Бычий облако — Включает или отключает оповещение при переходе облачного уровня в бычий режим.
bearcrosscloud_alert Медвежий облако — Включает или отключает оповещение при переходе облачного уровня в медвежий режим.
Получить полный код

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

indicator("Fresh Algo v24", overlay=true, max_lines_count=500, max_labels_count=500, max_boxes_count=350)
bullcolor = #00dbff
bearcolor = #b2b5be
ema150 = ta.ema(close, 150)
ema250 = ta.ema(close, 250)

gr_customalert = "Custom Alerts"

gr_signal = "General Configurations"
gr_PullBacksignal = "Trading Assistants"
gr_RiskManage = "Risk Management"
gr_dash = "Dashboard Configurations"

showSignals       = input(true, "Show Signal's", group=gr_signal)

sensitivity       = input.float(2.4, "Sensitivity", 0.1, step=0.1, group=gr_signal)
STuner            = input.int(10, "Signal Tuner(1-25)", minval = 1, maxval = 25, group=gr_signal)
Presets           = "All Signals"

filterstyle       = input.string("Trending Signals [Mode]", "Signal Mode / Filters", ["Trending Signals [Mode]", "Contrarian Signals [Mode]", "High Volume [Filter]", "Strong [Filter]", "Swing [Cloud Filter]", "Smooth [Cloud Filter]", "Scalping [Cloud Filter]", "Scalping+ [Cloud Filter]"], group=gr_signal)

TextStyle         = "Minimal"

consSignalsFilter = filterstyle == "Trending Signals [Mode]" ? true : false
StrongSignalsOnly  = filterstyle == "Strong [Filter]" ? true : false
highVolSignals    = filterstyle == "High Volume [Filter]" ? true : false
signalsTrendCloud = (filterstyle == "Smooth [Cloud Filter]") ? true : (filterstyle == "Scalping [Cloud Filter]") ? true : (filterstyle == "Scalping+ [Cloud Filter]") ? true : (filterstyle == "Swing [Cloud Filter]") ? true : false
ContrarianOnly = filterstyle == "Contrarian Signals [Mode]" ? true : false

TrendMap = 'Trend Gradient'
momentumCandles   = false
assistantenable   = input(true,'', group=gr_PullBacksignal, inline = 'sexyshit')
assistantmode     = input.string('Trend Assistant', 'Assistant | Mode',['Trend Assistant', 'Trend Tracker'], group = gr_PullBacksignal, inline = 'sexyshit')

Show_PR   = input.bool(true, title="", group = gr_PullBacksignal , inline = "Features1")
MSTuner       = input.int(8, "Reversal Dot | Tuner(2-30)", minval = 2, maxval = 30, group=gr_PullBacksignal, inline = "Features1")

LongTrendAverage  = assistantmode == 'Trend Tracker' and assistantenable == true ? true : false
analyscloud       = assistantmode == 'Trend Assistant' and assistantenable == true ? true : false
showTrendCloud    = (filterstyle == "Smooth [Cloud Filter]") ? true : (filterstyle == "Scalping [Cloud Filter]") ? true : (filterstyle == "Scalping+ [Cloud Filter]") ? true : (filterstyle == "Swing [Cloud Filter]") ? true : false
periodTrendCloud  = (filterstyle == "Smooth [Cloud Filter]") ? "Smooth" : (filterstyle == "Scalping [Cloud Filter]") ? "Scalping" : (filterstyle == "Scalping+ [Cloud Filter]") ? "Scalping+" : (filterstyle == "Swing [Cloud Filter]") ? "Swing" : na

fill(plot(showTrendCloud and periodTrendCloud == "Smooth" ? na : assistantenable == true and assistantmode == 'Trend Tracker' ? ema150 : na, "", na, editable=false), plot(showTrendCloud and periodTrendCloud == "Smooth" ? na : assistantenable == true and assistantmode == 'Trend Tracker' ? ema250 : na, "", na, editable=false), ema150 > ema250 ? color.new(bullcolor, 70) : ema150 < ema250 ? color.new(bearcolor, 70) : na)

showDashboard     = input(true, "Smart Panel", group = gr_dash , inline = "Features1")
locationDashboard = input.string("Bottom Right", "Dashboard Location", ["Top Right", "Middle Right", "Bottom Right", "Top Center", "Middle Center", "Bottom Center", "Top Left", "Middle Left", "Bottom Left"], group = gr_dash , tooltip="Smart Panel")
sizeDashboard     = input.string("Small", "Dashboard Size", ["Large", "Normal", "Small", "Tiny"], group = gr_dash , tooltip="Smart Panel")

tpLabels          = input(true, "Dynamic Take Profit Lables", group=gr_RiskManage)
ShowTpSlAreas   = input(true, "Show take Profit/Stop-loss Area", group=gr_RiskManage)

ShowTrailingSL  = input(false, "Show trailing Stop-loss", group=gr_RiskManage)

usePercSL         = input(false, "SL/TRAILING", inline="1", group=gr_RiskManage)
percTrailingSL    = input.float(1, "", 0, step=0.1, inline="1", group=gr_RiskManage)
useTP1            = input(true, "", inline="1", group=gr_RiskManage)
multTP1           = input.float(1, "TP 1", 0, inline="1", group=gr_RiskManage)

useTP2            = input(true, "", inline="4", group=gr_RiskManage)
multTP2           = input.float(2, "TP 2           ", 0, inline="4", group=gr_RiskManage)
useTP3            = input(true, "", inline="4", group=gr_RiskManage)
multTP3           = input.float(3, "TP 3", 0, inline="4", group=gr_RiskManage)

ShowSwings      = input(false, "Show Market Structure      ", inline="3", group=gr_RiskManage)
periodSwings      = input.int(10, "        ", 2, inline="3", group=gr_RiskManage)

Normalbuy_alert = input.bool(title='Buy Signal   ', defval=false, inline = "NB", group=gr_customalert)
Strongbuy_alert = input.bool(title='Strong Buy', defval=false, inline = "NB", group=gr_customalert)

Normalsell_alert = input.bool(title='Sell Signal   ', defval=false , inline = "NS", group=gr_customalert)
Strongsell_alert = input.bool(title='Strong Sell', defval=false , inline = "NS", group=gr_customalert)

slalert = input.bool(title='Stop-Loss     ', defval=false , inline = "SLTP1", group=gr_customalert)
tp1alert = input.bool(title='Target 1', defval=false , inline = "SLTP1", group=gr_customalert)
tp2alert = input.bool(title='Target 2       ', defval=false , inline = "TP2TP3", group=gr_customalert)
tp3alert = input.bool(title='Target 3', defval=false , inline = "TP2TP3", group=gr_customalert)

bullcrosscloud_alert = input.bool(title='Bullish Cloud', defval=false, inline = "CD", group=gr_customalert)
bearcrosscloud_alert = input.bool(title='Bearish Cloud', defval=false, inline = "CD", group=gr_customalert)

showCons          = false
paintCons         = false

SimpleBuy = "Buy"
StrongB = "Strong\nBuy"
SimpleSell = "Sell"
StrongS = "Strong\nSell"

if TextStyle == "Normal"
    SimpleBuy := "Buy"
    StrongB   := "Strong\nBuy"
    SimpleSell:= "Sell"
    StrongS   := "Strong\nSell"

if TextStyle == "Minimal"
    SimpleBuy := "BUY"
    StrongB   := "BUY+"
    SimpleSell:= "SELL"
    StrongS   := "SELL+"

src = close

RSII = ta.ema(ta.rsi(src, 50), 30)

TR = math.abs(RSII - RSII[1])

wwalpha = 1 / 50

WWMA = 0.0

WWMA := wwalpha * TR + (1 - wwalpha) * nz(WWMA[1])

ATRRSI = 0.0

ATRRSI := wwalpha * WWMA + (1 - wwalpha) * nz(ATRRSI[1])

TsFast = ta.ema(ta.rsi(src, 50), 30)

TsUP = TsFast + ATRRSI * 4.236
TsDN = TsFast - ATRRSI * 4.236

TsSlow = 0.0

TsSlow := TsUP < nz(TsSlow[1]) ? TsUP : TsFast > nz(TsSlow[1]) and TsFast[1] < nz(TsSlow[1]) ? TsDN : TsDN > nz(TsSlow[1]) ? TsDN : TsFast < nz(TsSlow[1]) and TsFast[1] > nz(TsSlow[1]) ? TsUP : nz(TsSlow[1])

Colorh = TsFast > 55 ? color.rgb(255, 0, 0) : TsFast < 45 ? color.rgb(0, 255, 8) : #ffffff

bulllim = 45
bearlim = 55
BullSignalr = ta.crossover(TsFast, TsSlow) and TsFast < bulllim
BearSignallr = ta.crossunder(TsFast, TsSlow) and TsFast > bearlim

wavetrend(src, chlLen, avgLen) =>
    esa = ta.ema(src, chlLen)
    d = ta.ema(math.abs(src - esa), chlLen)
    ci = (src - esa) / (0.015 * d)
    wt1 = ta.ema(ci, avgLen)
    wt2 = ta.sma(wt1, 3)
    [wt1, wt2]
f_top_fractal(src) => src[4] < src[2] and src[3] < src[2] and src[2] > src[1] and src[2] > src[0]
f_bot_fractal(src) => src[4] > src[2] and src[3] > src[2] and src[2] < src[1] and src[2] < src[0]
f_fractalize (src) => f_top_fractal(src) ? 1 : f_bot_fractal(src) ? -1 : 0
f_findDivs(src, topLimit, botLimit) =>
    fractalTop = f_fractalize(src) > 0 and src[2] >= topLimit ? src[2] : na
    fractalBot = f_fractalize(src) < 0 and src[2] <= botLimit ? src[2] : na
    highPrev = ta.valuewhen(fractalTop, src[2], 0)[2]
    highPrice = ta.valuewhen(fractalTop, high[2], 0)[2]
    lowPrev = ta.valuewhen(fractalBot, src[2], 0)[2]
    lowPrice = ta.valuewhen(fractalBot, low[2], 0)[2]
    bearSignal = fractalTop and high[1] > highPrice and src[1] < highPrev
    bullSignal = fractalBot and low[1] < lowPrice and src[1] > lowPrev
    [bearSignal, bullSignal]

[wt1, wt2] = wavetrend(close, 5*MSTuner, 10*MSTuner)
[wtDivBear1, wtDivBull1] = f_findDivs(wt2, 10, -35)
[wtDivBear2, wtDivBull2] = f_findDivs(wt2, 40, -70)
wtDivBull = wtDivBull1 or wtDivBull2
wtDivBear = wtDivBear1 or wtDivBear2

plotshape(ta.crossover(wt1, wt2) and Show_PR and wt2 <= -60, "Reversal Dot Buy" , shape.circle, location.belowbar, color.new(bullcolor,60), size=size.tiny)
plotshape(ta.crossunder(wt1, wt2) and Show_PR and wt2 >= 60, "Reversal Dot Sell", shape.circle, location.abovebar, color.new(bearcolor,60), size=size.tiny)

rsi = ta.rsi(close ,14)

f_chartTfInMinutes() =>
    float _resInMinutes = timeframe.multiplier * (
      timeframe.isseconds ? 1. / 60             :
      timeframe.isminutes ? 1.                  :
      timeframe.isdaily   ? 60. * 24            :
      timeframe.isweekly  ? 60. * 24 * 7        :
      timeframe.ismonthly ? 60. * 24 * 30.4375  : na)
atr(len) =>
	tr = ta.tr
    atr = 0.0
    atr := nz(atr[1] + (tr - atr[1]) / len, tr)
supertrend(src, factor, len) =>
	atr = ta.atr(len)
	upperBand = src + factor * atr
	lowerBand = src - factor * atr
	prevLowerBand = nz(lowerBand[1])
	prevUpperBand = nz(upperBand[1])
	lowerBand := lowerBand > prevLowerBand or close[1] < prevLowerBand ? lowerBand : prevLowerBand
	upperBand := upperBand < prevUpperBand or close[1] > prevUpperBand ? upperBand : prevUpperBand
	int direction = na
	float superTrend = na
	prevSuperTrend = superTrend[1]
	if prevSuperTrend == prevUpperBand
		direction := close > upperBand ? 1 : -1
	else
		direction := close < lowerBand ? -1 : 1
	superTrend := direction == 1 ? lowerBand : direction == -1 ? upperBand : na
dchannel(len)=>
    hh = ta.highest(len)
    ll = ta.lowest (len)
    trend = 0
    trend := close > hh[1] ? 1 : close < ll[1] ? -1 : nz(trend[1])
trendScalper(show, len1, len2, len3, colorBull, colorBear, colorBarBull, colorBarBear) =>
    avgOC = math.avg(open, close)
    ha_o = 0.0, ha_o := na(ha_o[1]) ? avgOC : (ha_o[1] + ohlc4[1]) / 2
    ema1 = ta.ema(ha_o, len1), ema2 = ta.ema(ha_o, len2), ema3 = ta.ema(ha_o, len3)
    ris1 = ema1 > ema1[1], ris2 = ema2 > ema2[1], ris3 = ema3 > ema3[1]
    fal1 = ema1 < ema1[1], fal2 = ema2 < ema2[1], fal3 = ema3 < ema3[1]
    colorEma1 = ris1 ? colorBull : fal1 ? colorBear : na, colorEma2 = ris2 ? colorBull : fal2 ? colorBear : na, colorEma3 = ris3 ? colorBull : fal3 ? colorBear : na
    fillEma1 = avgOC > ema1 ? colorBull : avgOC < ema1 ? colorBear : na, fillEma2 = ema1 > ema2 ? colorBull : ema1 < ema2 ? colorBear : na, fillEma3 = ema2 > ema3 ? colorBull : ema2 < ema3 ? colorBear : na
    colorBar = close < ema1 and close < ema2 ? colorBarBear : colorBarBull
    [avgOC, show ? ema1 : na, show ? ema2 : na, show ? ema3 : na, color.new(colorEma1, 55), color.new(colorEma2, 45), color.new(colorEma3, 35), color.new(fillEma1, 85), color.new(fillEma2, 80), color.new(fillEma3, 75), colorBar]

candlesMom() =>
	[_, _, macd] = ta.macd(close, 2, 4, 3)
	(macd > 10 and macd > macd[1]) or (macd < 10 and macd < macd[1])

trailingSL(buy, sell, factor, len, usePerc, perc) =>
	atr = atr(len)
	upperBand = high + (usePerc ? high * (perc / 100) : factor * atr)
	lowerBand = low  - (usePerc ? low  * (perc / 100) : factor * atr)
	prevLowerBand = nz(lowerBand[1])
	prevUpperBand = nz(upperBand[1])
	lowerBand := lowerBand > prevLowerBand or buy  ? lowerBand : prevLowerBand
	upperBand := upperBand < prevUpperBand or sell ? upperBand : prevUpperBand
	int direction = na
	float stop = na
	prevSuperTrend = stop[1]
	if prevSuperTrend == prevUpperBand
		direction := buy ? 1 : -1
	else
		direction := sell ? -1 : 1
	stop := direction == 1 ? lowerBand : direction == -1 ? upperBand : na
add_to_zz(zz, val, bi) =>
    array.unshift(zz, bi)
    array.unshift(zz, val)
    if array.size(zz) > 12
        array.pop(zz)
update_zz(zz, val, bi, dir) =>
    if array.size(zz) == 0
        add_to_zz(zz, val, bi)
    else
        if dir == 1 and val > array.get(zz, 0) or dir == -1 and val < array.get(zz, 0)
            array.set(zz, 0, val)
            array.set(zz, 1, bi)
        0

vosc = ta.obv - ta.ema(ta.obv, 20)
bs   = ta.ema(nz(math.abs((open - close) / (high - low) * 100)), 3)
ema  = ta.ema(close, 200)
emaBull = close > ema
equal_tf(res) => str.tonumber(res) == f_chartTfInMinutes()
higher_tf(res) => str.tonumber(res) > f_chartTfInMinutes()
too_small_tf(res) => (timeframe.isweekly and res=="1") or (timeframe.ismonthly and str.tonumber(res) < 10)
securityNoRep(sym, res, src) =>
    bool bull = na
    bull := equal_tf(res) ? src : bull
    bull := higher_tf(res) ? request.security(sym, res, src, barmerge.gaps_off, barmerge.lookahead_on) : bull
    bull_array = request.security_lower_tf(syminfo.tickerid, higher_tf(res) ? str.tostring(f_chartTfInMinutes()) : too_small_tf(res) ? (timeframe.isweekly ? "3" : "10") : res, src)
    if array.size(bull_array) > 1 and not equal_tf(res) and not higher_tf(res)
        bull := array.pop(bull_array)
    array.clear(bull_array)
    bull

TF5Bull   = securityNoRep(syminfo.tickerid, "5"   , emaBull)

TF15Bull  = securityNoRep(syminfo.tickerid, "15"  , emaBull)
TF30Bull  = securityNoRep(syminfo.tickerid, "30"  , emaBull)
TF60Bull  = securityNoRep(syminfo.tickerid, "60"  , emaBull)

TF240Bull = securityNoRep(syminfo.tickerid, "240" , emaBull)

hma55  = ta.hma(close, 55 )

[_, _, macd] = ta.macd(close, 12, 26, 9)
supertrend = supertrend(close, sensitivity, STuner)
maintrend  = dchannel(30)

confBull   = (ta.crossover (close, supertrend) or (ta.crossover (close, supertrend)[1] and maintrend[1] < 0)) and macd > 0 and macd > macd[1] and ema150 > ema250 and hma55 > hma55[2] and maintrend > 0
confBear   = (ta.crossunder(close, supertrend) or (ta.crossunder(close, supertrend)[1] and maintrend[1] > 0)) and macd < 0 and macd < macd[1] and ema150 < ema250 and hma55 < hma55[2] and maintrend < 0

trendcloud = supertrend(ohlc4, periodTrendCloud == "Swing" ? 7 : 4, 10)

hma = periodTrendCloud == "Scalping+" ? ta.hma(close, 55) : na

none = close > 0
[_, _, adx] = ta.dmi(14, 14)

consFilter = adx > 20

ContBear = TsFast > 65
ContBull = TsFast < 35

StrongFilter = ta.ema(close, 200)

volFilter = (ta.ema(volume, 15) - ta.ema(volume, 20)) / ta.ema(volume, 25) > 0

trendFilter = trendcloud

bull = (Presets == "All Signals" ? ta.crossover (close, supertrend) : confBull and not confBull[1]) and Presets != "Trend Scalper" and (StrongSignalsOnly ? close > StrongFilter : none) and (ContrarianOnly ? ContBull : none)  and (consSignalsFilter ? consFilter : none) and (highVolSignals ? volFilter : none) and (signalsTrendCloud ? (periodTrendCloud == "Smooth" ? ema150 > ema250 : close > trendFilter) : none)
bear = (Presets == "All Signals" ? ta.crossunder(close, supertrend) : confBear and not confBear[1]) and Presets != "Trend Scalper" and (StrongSignalsOnly ? close < StrongFilter : none) and (ContrarianOnly ? ContBear : none)  and (consSignalsFilter ? consFilter : none) and (highVolSignals ? volFilter : none) and (signalsTrendCloud ? (periodTrendCloud == "Smooth" ? ema150 < ema250 : close < trendFilter) : none)

countBull = ta.barssince(bull)
countBear = ta.barssince(bear)

trigger = nz(countBull, bar_index) < nz(countBear, bar_index) ? 1 : 0
[avgOC, ema5, ema9, ema21, colorEma5, colorEma9, colorEma21, fillEma5, fillEma9, fillEma21, colorBar] = trendScalper(Presets == "Trend Scalper" ? true : false, 5, 9, 21, bullcolor, bearcolor, bullcolor, bearcolor)

trailingStop = trailingSL(bull, bear, 2.2, 14, usePercSL, percTrailingSL)

float _ph    = ta.highestbars(high, periodSwings) == 0 ? high : na
float _pl    = ta.lowestbars (low,  periodSwings) == 0 ? low  : na
var   _dir   = 0, dir_ = _pl and na(_ph) ? -1 : _dir, _dir := _ph and na(_pl) ? 1 : dir_, dirChg = ta.change(_dir)
var   zz     = array.new_float(0), zzOld = array.copy(zz)
float zzLive = _ph or _pl ? (dirChg ? add_to_zz(zz, _dir == 1 ? _ph : _pl, bar_index) : update_zz(zz, _dir == 1 ? _ph : _pl, bar_index, _dir)) : na

float     hb_     = ta.highestbars(10) == 0 ? high : na
float     lb_     = ta.lowestbars (10) == 0 ? low  : na
var int   dir     = 0
float     zz_     = na
float     pp      = na
var int   consCnt = 0
var float condHi  = na
var float condLo  = na
float     H_      = ta.highest(5)
float     L_      = ta.lowest (5)
var line  lineUp  = na
var line  lineDn  = na
bool      breakUp = false
bool      breakDn = false
var float[] pvh1_price     = array.new_float(1000, na)
var int[]   pvh1_time      = array.new_int  (1000, na)
var float[] pvl1_price     = array.new_float(1000, na)
var int[]   pvl1_time      = array.new_int  (1000, na)
var float[] pvh2_price     = array.new_float(1000, na)
var int[]   pvh2_time      = array.new_int  (1000, na)
var float[] pvl2_price     = array.new_float(1000, na)
var int[]   pvl2_time      = array.new_int  (1000, na)
var float   htcmrll_price  = na
var int     htcmrll_time   = na
var float   ltcmrhh_price  = na
var int     ltcmrhh_time   = na
var box[]   long_boxes     = array.new_box()
var box[]   short_boxes    = array.new_box()
var float   temp_pv_0      = na
var float   temp_pv_1      = na
var float   temp_pv_2      = na
bool        pvh            = high < high[1] and high[1] > high[2]
bool        pvl            = low  > low [1] and low [1] < low [2]
int         pv1_time       = bar_index[1]
float       pv1_high       = high[1]
float       pv1_low        = low [1]

var buyBars  = array.new_box(365, na)
for i = 0 to 364
    box.delete(array.get(buyBars, i))
var sellBars = array.new_box(365, na)
for i = 0 to 364
    box.delete(array.get(sellBars, i))

green    = bullcolor, green50  = color.new(green, 50),  green20  = color.new(green, 80)
red      = bearcolor, red50    = color.new(red, 50),    red20    = color.new(red, 80)
silver   = #B2B5BE, silver50 = color.new(silver, 50), silver20 = color.new(silver, 80)

atrBand = usePercSL ? (trigger ? low : high) * (percTrailingSL / 100) : ta.atr(14) * 2.2

atrStop = trigger ? low - atrBand : high + atrBand

lastTrade(src) => ta.valuewhen(bull or bear, src, 0)

entry_y = lastTrade(close)

stop_y = lastTrade(atrStop)

tp1_y = (entry_y-lastTrade(atrStop))*multTP1 + entry_y

tp2_y = (entry_y-lastTrade(atrStop))*multTP2 + entry_y

tp3_y = (entry_y-lastTrade(atrStop))*multTP3 + entry_y

labelTpSl(cond, y, txt, color) =>
    label labelTpSl = ShowTpSlAreas and cond ? label.new(bar_index + 1, y, txt, xloc.bar_index, yloc.price, color, label.style_label_left, color.white, size.normal) : na
    label.delete(labelTpSl[1])
labelTpSl(none, entry_y, "Entry : " + str.tostring(math.round_to_mintick(entry_y)), color.orange)
labelTpSl(none, stop_y , "Stop loss : " + str.tostring(math.round_to_mintick(atrStop)), bearcolor)
labelTpSl(useTP1 and multTP1 != 0, tp1_y, "TP 1 : " + str.tostring(math.round_to_mintick(tp1_y)), bullcolor)
labelTpSl(useTP2 and multTP2 != 0, tp2_y, "TP 2 : " + str.tostring(math.round_to_mintick(tp2_y)), bullcolor)
labelTpSl(useTP3 and multTP3 != 0, tp3_y, "TP 3 : " + str.tostring(math.round_to_mintick(tp3_y)), bullcolor)
lineTpSl(cond, y, color, style) =>
    line lineTpSl = ShowTpSlAreas and cond ? line.new(bar_index - (trigger ? countBull : countBear), y, bar_index + 1, y, xloc.bar_index, extend.none, color, style) : na
    line.delete(lineTpSl[1])
lineTpSl(none, entry_y, color.orange, line.style_dashed)
lineTpSl(none, stop_y , bearcolor   , line.style_solid )
lineTpSl(useTP

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

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

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

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

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

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

Стоимость полного кода
3 098,70₽ ≈ $37.88