ALGO Combined by ENIGMA
Похожие материалы по тегам
Сообщите нам, если считаете, что материал размещён без разрешения.
Сообщить о материале
Обращение по товару «multi strategy algo combined by enigma mode.pine» отправится на рассмотрение. Укажите контакт для ответа и опишите причину.
О программе
Индикатор «ALGO Combined by ENIGMA» объединяет на одном графике несколько технических инструментов анализа для платформы TradingView. Он отображается поверх ценового графика и предоставляет визуальные уровни, сигналы и индикаторы тренда.
В основе индикатора лежит комбинация фильтра диапазона, Hull Moving Average с настраиваемыми вариациями, автоматических уровней Фибоначчи и пивотов, а также системы генерации сигналов на основе WaveTrend, Supertrend и скользящих средних. Пользователь может включать и выключать отдельные компоненты через переключатели.
Индикатор поддерживает получение данных с других таймфреймов, отображение полос и заливок, графические отметки в виде линий, меток и прямоугольников, а также настраиваемые условия для оповещений TradingView. Доступны настройки цветов, прозрачности, периодов и чувствительности для каждого компонента.
Настройки программы
| Настройка | Описание |
|---|---|
| DHighLow | Уровни AutoHighLow — Включает отображение автоматически определяемых уровней более высоких максимумов и более низких минимумов |
| AutoPeriod | Период AutoHighLow — Период для автоматического поиска экстремумов при определении уровней |
| switch_fibonacci | Фибоначчи — Включает отображение уровней Фибоначчи между пивотами |
| switch_pivot | Уровни пивотов — Включает отображение уровней пивотов на графике |
| threshold_multiplier2 | Отклонение — Множитель отклонения для определения значимых пивотов |
| depth2 | Глубина — Минимальное количество баров для подтверждения пивота |
| reverse2 | Переворот — Переворачивает направление отображения уровней Фибоначчи |
| extendLeft | Продлевать влево — Продлевает линии уровней Фибоначчи влево от пивота |
| extendRight | Продлевать вправо — Продлевает линии уровней Фибоначчи вправо от пивота |
| prices | Показать цены — Показывает цены на уровнях Фибоначчи |
| levels | Показать уровни — Показывает числовые значения уровней Фибоначчи |
| levelsFormat | Формат уровней — Формат отображения значений уровней (в ценах или процентах) |
| labelsPosition | Позиция подписей — Сторона графика, на которой отображаются подписи уровней |
| backgroundTransparency | Прозрачность фона — Степень прозрачности заливки между уровнями Фибоначчи |
| show_0 | Показать уровень 0 — Отображение уровня Фибоначчи 0 |
| value_0 | Значение уровня 0 — Значение уровня Фибоначчи 0 |
| _0 | Цвет уровня 0 — Цвет уровня Фибоначчи 0 |
| show_0_236 | Показать уровень 0.236 — Отображение уровня Фибоначчи 0.236 |
| value_0_236 | Значение уровня 0.236 — Значение уровня Фибоначчи 0.236 |
| _0_236 | Цвет уровня 0.236 — Цвет уровня Фибоначчи 0.236 |
| show_0_382 | Показать уровень 0.382 — Отображение уровня Фибоначчи 0.382 |
| value_0_382 | Значение уровня 0.382 — Значение уровня Фибоначчи 0.382 |
| _0_382 | Цвет уровня 0.382 — Цвет уровня Фибоначчи 0.382 |
| show_0_5 | Показать уровень 0.5 — Отображение уровня Фибоначчи 0.5 |
| value_0_5 | Значение уровня 0.5 — Значение уровня Фибоначчи 0.5 |
| _0_5 | Цвет уровня 0.5 — Цвет уровня Фибоначчи 0.5 |
| show_0_65 | Показать уровень 0.65 — Отображение уровня Фибоначчи 0.65 |
| value_0_65 | Значение уровня 0.65 — Значение уровня Фибоначчи 0.65 |
| _0_65 | Цвет уровня 0.65 — Цвет уровня Фибоначчи 0.65 |
| show_0_786 | Показать уровень 0.786 — Отображение уровня Фибоначчи 0.786 |
| value_0_786 | Значение уровня 0.786 — Значение уровня Фибоначчи 0.786 |
| _0_786 | Цвет уровня 0.786 — Цвет уровня Фибоначчи 0.786 |
| pivotTypeInput | Тип пивотов — Тип расчёта уровней пивотов |
| pivotAnchorInput | Таймфрейм пивотов — Таймфрейм, на основе которого рассчитываются пивоты |
| maxHistoricalPivotsInput | Количество пивотов назад — Количество сохраняемых исторических уровней пивотов |
| isDailyBasedInput | Дневные значения — Использует дневные OHLC-данные для расчёта пивотов |
| showLabelsInput | Показать подписи — Отображает текстовые подписи уровней пивотов |
| showPricesInput | Показать цены — Отображает цены на уровнях пивотов |
| positionLabelsInput | Позиция подписей пивотов — Сторона графика для подписей уровней пивотов |
| linewidthInput | Толщина линий — Толщина линий уровней пивотов |
| pColorInput | Цвет P — Цвет центрального уровня P пивотов |
| pShowInput | Показать P — Отображение центрального уровня P пивотов |
| s1ColorInput | Цвет S1 — Цвет уровня поддержки S1 |
| s1ShowInput | Показать S1 — Отображение уровня поддержки S1 |
| r1ColorInput | Цвет R1 — Цвет уровня сопротивления R1 |
| r1ShowInput | Показать R1 — Отображение уровня сопротивления R1 |
| s2ColorInput | Цвет S2 — Цвет уровня поддержки S2 |
| s2ShowInput | Показать S2 — Отображение уровня поддержки S2 |
| r2ColorInput | Цвет R2 — Цвет уровня сопротивления R2 |
| r2ShowInput | Показать R2 — Отображение уровня сопротивления R2 |
| s3ColorInput | Цвет S3 — Цвет уровня поддержки S3 |
| s3ShowInput | Показать S3 — Отображение уровня поддержки S3 |
| r3ColorInput | Цвет R3 — Цвет уровня сопротивления R3 |
| r3ShowInput | Показать R3 — Отображение уровня сопротивления R3 |
| showHullRibbon | Лента Hull — Отображает ленту Hull Moving Average |
| showRF | Фильтр диапазона — Отображает линию фильтра диапазона |
| showRFBands | Полосы фильтра — Отображает верхнюю и нижнюю полосы фильтра диапазона |
| upColor | Бычий цвет — Цвет для бычьих свечей и линий |
| downColor | Медвежий цвет — Цвет для медвежьих свечей и линий |
| midColor | Цвет консолидации — Цвет для свечей консолидации |
| src | Источник — Источник данных для расчётов |
| per001 | Период сэмплирования — Период сэмплирования для фильтра диапазона |
| mult | Множитель диапазона — Множитель диапазона для фильтра диапазона |
| hullsource | Источник Hull — Источник данных для Hull Moving Average |
| modeSwitch | Вариация Hull — Вариант Hull Moving Average (HMA, THMA, EHMA) |
| length | Длина Hull — Базовая длина Hull Moving Average |
| lengthMult | Множитель длины — Множитель длины Hull Moving Average |
| useHtf | Hull с верхнего ТФ — Использует Hull MA с более высокого таймфрейма |
| htf | Верхний таймфрейм — Таймфрейм для получения Hull MA |
| transpSwitch | Прозрачность полос — Прозрачность полос ленты Hull MA |
| showBuySell | Показать Buy & Sell — Отображает метки сигналов покупки и продажи |
| sensitivity | Чувствительность — Чувствительность генерации сигналов |
| percentStop | Стоп-лосс % — Процент стоп-лосса от цены входа |
| offsetSignal | Смещение сигналов — Вертикальное смещение сигналов покупки и продажи |
| sensitivitysuper | Чувствительность Supertrend — Чувствительность индикатора Supertrend |
| ShowSmartTrail | Умный трейл — Отображает адаптивный трейл-стоп с уровнями Фибоначчи |
| maj | Точки TP — Отображает точки тейк-профита major уровня |
| show_ha | Трекер тренда — Отображает трекер тренда на основе Heikin Ashi |
| usePsar | PSAR — Отображает Parabolic SAR |
| trailType | Тип трейла — Тип расчёта истинного диапазона для трейл-стопа |
| ATRPeriod | Период ATR — Период ATR для расчёта трейл-стопа |
| ATRFactor | Множитель ATR — Множитель ATR для определения расстояния трейл-стопа |
| smoothing | Сглаживание — Период сглаживания трейл-стопа |
| useRes | Альтернативные сигналы — Использует альтернативные сигналы с другого таймфрейма |
| Res | Множитель альтернативных сигналов — Множитель таймфрейма для альтернативных сигналов |
| basisType | Тип MA — Тип скользящей средней для сигнальной системы |
| basisLen | Период MA — Период скользящей средней |
| offsetSigma | Смещение / Sigma — Смещение для LSMA или значение sigma для ALMA |
| offsetALMA | Смещение ALMA — Параметр смещения для Arnaud Legoux Moving Average |
| scolor | Цветные свечи — Включает цветное окрашивание свечей для индикации направления тренда |
| delayOffset | Задержка MA — Задержка смещения для предотвращения перерисовки MA |
| tradeType | Тип сделок — Тип сделок для сигнальной системы (LONG, SHORT, BOTH, NONE) |
| i_lxLvlTP1 | Уровень TP1 — Процентный уровень первого тейк-профита |
| i_lxLvlTP2 | Уровень TP2 — Процентный уровень второго тейк-профита |
| i_lxLvlSL | Стоп-лосс — Процентный уровень стоп-лосса |
| i_alertOn | Оповещения — Включает отображение меток оповещений на графике |
| LenghtBool1 | Включить MA 1 — Включает отображение первой скользящей средней |
| len1 | MA 1 — Период первой скользящей средней |
| ma_1_type | Тип MA 1 — Тип первой скользящей средней (RMA, SMA, EMA, VWMA) |
| ma_1_colour | Цвет MA 1 — Цвет первой скользящей средней |
Поиск по коду файла
indicator("ALGO Combined by ENIGMA", max_lines_count=500, max_boxes_count=500,max_bars_back=5000, max_labels_count=500, overlay=true)
DHighLow = input.bool(true, title='Higher High and Lower Low',group = '????????"AutoHighLow" ????????')
AutoPeriod = input.int(50, title='AutoHighLow')
Fhigh = ta.highest(AutoPeriod)
Flow = ta.lowest(AutoPeriod)
FH = ta.highestbars(high, AutoPeriod)
FL = ta.lowestbars(low, AutoPeriod)
AutoHighLow = FH < FL
F0 = AutoHighLow ? Flow : Fhigh
plotshape(DHighLow ? Flow : na, style=shape.labelup, location=location.absolute, size=size.small, color=#0871c7, textcolor=color.white, show_last=1, text='Bottom', offset=FL)
plotshape(DHighLow ? Fhigh : na, style=shape.labeldown, location=location.absolute, size=size.small, color=#0871c7, textcolor=color.white, show_last=1, text='Top', offset=FH)
switchboard_group = "???? Switch Board (Turn On/Off Overlay Indicators) ????"
switch_fibonacci = input.bool(false, "Fibonacci", group=switchboard_group, inline='Switch2')
switch_pivot = input.bool (false, "Pivot Levels", group=switchboard_group, inline='Switch4')
fibgroup = "????????? Fibonacci Display Settting ?????????"
devTooltip = "Deviation is a multiplier that affects how much the price should deviate from the previous pivot in order for the bar to become a new pivot."
depthTooltip = "The minimum number of bars that will be taken into account when calculating the indicator."
threshold_multiplier2 = input.float(title="Deviation", defval=3, minval=0, tooltip=devTooltip,group=fibgroup)
depth2 = input.int(title="Depth", defval=10, minval=2, tooltip=depthTooltip,group=fibgroup)
reverse2 = input(false, "Reverse", display = display.data_window,group=fibgroup)
var extendLeft = input(false, "Extend Left | Extend Right", inline = "Extend Lines",group=fibgroup)
var extendRight = input(true, "", inline = "Extend Lines",group=fibgroup)
var extending = extend.none
if extendLeft and extendRight
extending := extend.both
if extendLeft and not extendRight
extending := extend.left
if not extendLeft and extendRight
extending := extend.right
prices = input(false, "Show Prices", display = display.data_window,group=fibgroup)
levels = input(true, "Show Levels", inline = "Levels", display = display.data_window,group=fibgroup)
levelsFormat = input.string("Values", "", options = ["Values", "Percent"], inline = "Levels", display = display.data_window,group=fibgroup)
labelsPosition = input.string("Left", "Labels Position", options = ["Left", "Right"], display = display.data_window,group=fibgroup)
var int backgroundTransparency = input.int(95, "Background Transparency", minval = 0, maxval = 100, display = display.data_window,group=fibgroup)
import TradingView/ZigZag/7 as zigzag
update() =>
var settings = zigzag.Settings.new(threshold_multiplier2, depth2, color(na), false, false, false, false, "Absolute", true)
var zigzag.ZigZag zigZag = zigzag.newInstance(settings)
var zigzag.Pivot lastP = na
var float startPrice2 = na
var float height = na
settings.devThreshold := ta.atr(10) / close * 100 * threshold_multiplier2
if zigZag.update()
lastP := zigZag.lastPivot()
if not na(lastP)
var line lineLast = na
if switch_fibonacci
if na(lineLast)
lineLast := line.new(lastP.start, lastP.end, xloc=xloc.bar_time, color=color.gray, width=1, style=line.style_dashed)
else
line.set_first_point(lineLast, lastP.start)
line.set_second_point(lineLast, lastP.end)
startPrice2 := reverse2 ? lastP.start.price : lastP.end.price
endPrice = reverse2 ? lastP.end.price : lastP.start.price
height := (startPrice2 > endPrice ? -1 : 1) * math.abs(startPrice2 - endPrice)
[lastP, startPrice2, height]
[lastP, startPrice2, height] = update()
_draw_line(price, col) =>
var id = line.new(lastP.start.time, lastP.start.price, time, price, xloc=xloc.bar_time, color=col, width=1, extend=extending)
line.set_xy1(id, lastP.start.time, price)
line.set_xy2(id, lastP.end.time, price)
id
_draw_label(price, txt, txtColor) =>
x = labelsPosition == "Left" ? lastP.start.time : not extendRight ? lastP.end.time : time
labelStyle = labelsPosition == "Left" ? label.style_label_right : label.style_label_left
align = labelsPosition == "Left" ? text.align_right : text.align_left
labelsAlignStrLeft = txt + '\n \n'
labelsAlignStrRight = ' ' + txt + '\n \n'
labelsAlignStr = labelsPosition == "Left" ? labelsAlignStrLeft : labelsAlignStrRight
var id = label.new(x=x, y=price, xloc=xloc.bar_time, text=labelsAlignStr, textcolor=txtColor, style=labelStyle, textalign=align, color=#00000000)
label.set_xy(id, x, price)
label.set_text(id, labelsAlignStr)
label.set_textcolor(id, txtColor)
_wrap(txt) =>
"(" + str.tostring(txt, format.mintick) + ")"
_label_txt(level, price) =>
l = levelsFormat == "Values" ? str.tostring(level) : str.tostring(level * 100) + "%"
(levels ? l : "") + (prices ? _wrap(price) : "")
_crossing_level(series float sr, series float r) =>
(r > sr and r < sr[1]) or (r < sr and r > sr[1])
processLevel(bool show, float value, color colorL, line lineIdOther) =>
float m = value
r = startPrice2 + height * m
crossed = _crossing_level(close, r)
if show and not na(lastP)
lineId = _draw_line(r, colorL)
_draw_label(r, _label_txt(m, r), colorL)
if crossed
alert("Autofib: " + syminfo.ticker + " crossing level " + str.tostring(value))
if not na(lineIdOther)
linefill.new(lineId, lineIdOther, color = color.new(colorL, backgroundTransparency))
lineId
else
lineIdOther
show_0 = input(true, "", inline = "Level0", display = display.data_window)
value_0 = input(0, "", inline = "Level0", display = display.data_window)
color_0 = input(#787b86, "", inline = "Level0", display = display.data_window)
show_0_236 = input(true, "", inline = "Level0", display = display.data_window)
value_0_236 = input(0.236, "", inline = "Level0", display = display.data_window)
color_0_236 = input(#f44336, "", inline = "Level0", display = display.data_window)
show_0_382 = input(true, "", inline = "Level1", display = display.data_window)
value_0_382 = input(0.382, "", inline = "Level1", display = display.data_window)
color_0_382 = input(#81c784, "", inline = "Level1", display = display.data_window)
show_0_5 = input(true, "", inline = "Level1", display = display.data_window)
value_0_5 = input(0.5, "", inline = "Level1", display = display.data_window)
color_0_5 = input(#4caf50, "", inline = "Level1", display = display.data_window)
show_0_65 = input(false, "", inline = "Level2", display = display.data_window)
value_0_65 = input(0.65, "", inline = "Level2", display = display.data_window)
color_0_65 = input(#009688, "", inline = "Level2", display = display.data_window)
show_0_786 = input(false, "", inline = "Level3", display = display.data_window)
value_0_786 = input(0.786, "", inline = "Level3", display = display.data_window)
color_0_786 = input(#64b5f6, "", inline = "Level3", display = display.data_window)
var line lineId0 = na
var line lineId1 = na
var line lineId2 = na
var line lineId3 = na
var line lineId4 = na
var line lineId5 = na
var line lineId6 = na
var line lineId7 = na
var line lineId8 = na
var line lineId9 = na
var line lineId10 = na
var line lineId11 = na
var line lineId12 = na
var line lineId13 = na
var line lineId14 = na
var line lineId15 = na
var line lineId16 = na
var line lineId17 = na
var line lineId18 = na
var line lineId19 = na
var line lineId20 = na
var line lineId21 = na
if (switch_fibonacci) // Check the boolean here
lineId4 := processLevel(show_0, value_0, color_0, lineId3)
lineId5 := processLevel(show_0_236, value_0_236, color_0_236, lineId4)
lineId6 := processLevel(show_0_382, value_0_382, color_0_382, lineId5)
lineId7 := processLevel(show_0_5, value_0_5, color_0_5, lineId6)
lineId9 := processLevel(show_0_65, value_0_65, color_0_65, lineId8)
lineId10 := processLevel(show_0_786, value_0_786, color_0_786, lineId9)
pivot_group = '?????????? Pivot Levels ??????????'
pivotTypeInput = input.string(title="Type", defval="Traditional", options=["Traditional", "Fibonacci", "Woodie", "Classic", "DM", "Camarilla"],group=pivot_group)
pivotAnchorInput = input.string(title="Pivots Timeframe", defval="Auto", options=["Auto", "Daily", "Weekly", "Monthly", "Quarterly", "Yearly", "Biyearly", "Triyearly", "Quinquennially", "Decennially"],group=pivot_group)
maxHistoricalPivotsInput = input.int(title="Number of Pivots Back", defval=1, minval=1, maxval=200, display = display.data_window,group=pivot_group)
isDailyBasedInput = input.bool(title="Use Daily-based Values", defval=true,group=pivot_group, display = display.data_window, tooltip="When this option is unchecked, Pivot Points will use intraday data while calculating on intraday charts. If Extended Hours are displayed on the chart, they will be taken into account during the pivot level calculation. If intraday OHLC values are different from daily-based values (normal for stocks), the pivot levels will also differ.")
showLabelsInput = input.bool(title="Show Labels", defval=true,group=pivot_group, display = display.data_window)
showPricesInput = input.bool(title="Show Prices", defval=true,group=pivot_group, display = display.data_window)
positionLabelsInput = input.string("Left", "Labels Position", options=["Left", "Right"],group=pivot_group, display = display.data_window)
linewidthInput = input.int(title="Line Width", defval=1, minval=1, maxval=100,group=pivot_group, display = display.data_window)
DEFAULT_COLOR = #FB8C00
pColorInput = input.color(DEFAULT_COLOR, "P ", inline="P",group=pivot_group, display = display.data_window)
pShowInput = input.bool(true, "", inline="P",group=pivot_group, display = display.data_window)
s1ColorInput = input.color(DEFAULT_COLOR, "S1", inline="S1/R1" ,group=pivot_group, display = display.data_window)
s1ShowInput = input.bool(true, "", inline="S1/R1",group=pivot_group, display = display.data_window)
r1ColorInput = input.color(DEFAULT_COLOR, " R1", inline="S1/R1",group=pivot_group, display = display.data_window)
r1ShowInput = input.bool(true, "", inline="S1/R1",group=pivot_group, display = display.data_window)
s2ColorInput = input.color(DEFAULT_COLOR, "S2", inline="S2/R2",group=pivot_group, display = display.data_window)
s2ShowInput = input.bool(true, "", inline="S2/R2",group=pivot_group, display = display.data_window)
r2ColorInput = input.color(DEFAULT_COLOR, " R2", inline="S2/R2",group=pivot_group, display = display.data_window)
r2ShowInput = input.bool(true, "", inline="S2/R2",group=pivot_group, tooltip = "Not applicable to DM", display = display.data_window)
s3ColorInput = input.color(DEFAULT_COLOR, "S3", inline="S3/R3",group=pivot_group, display = display.data_window)
s3ShowInput = input.bool(true, "", inline="S3/R3",group=pivot_group, display = display.data_window)
r3ColorInput = input.color(DEFAULT_COLOR, " R3", inline="S3/R3",group=pivot_group, display = display.data_window)
r3ShowInput = input.bool(true, "", inline="S3/R3",group=pivot_group, tooltip = "Not applicable to DM", display = display.data_window)
type graphicSettings
string levelName
color levelColor
bool showLevel
var graphicSettingsArray = array.from(
graphicSettings.new(" P", pColorInput, pShowInput),
graphicSettings.new("R1", r1ColorInput, r1ShowInput), graphicSettings.new("S1", s1ColorInput, s1ShowInput),
graphicSettings.new("R2", r2ColorInput, r2ShowInput), graphicSettings.new("S2", s2ColorInput, s2ShowInput),
graphicSettings.new("R3", r3ColorInput, r3ShowInput), graphicSettings.new("S3", s3ColorInput, s3ShowInput)),
autoAnchor = switch
timeframe.isintraday => timeframe.multiplier <= 15 ? "1D" : "1W"
timeframe.isdaily => "1M"
=> "12M"
pivotTimeframe = switch pivotAnchorInput
"Auto" => autoAnchor
"Daily" => "1D"
"Weekly" => "1W"
"Monthly" => "1M"
"Quarterly" => "3M"
=> "12M"
pivotYearMultiplier = switch pivotAnchorInput
"Biyearly" => 2
"Triyearly" => 3
"Quinquennially" => 5
"Decennially" => 10
=> 1
numOfPivotLevels = switch pivotTypeInput
"Traditional" => 11
"Camarilla" => 11
"Woodie" => 9
"Classic" => 9
"Fibonacci" => 7
"DM" => 3
type pivotGraphic
line pivotLine
label pivotLabel
method delete(pivotGraphic graphic) =>
graphic.pivotLine.delete()
graphic.pivotLabel.delete()
var drawnGraphics = matrix.new<pivotGraphic>()
localPivotTimeframeChange = timeframe.change(pivotTimeframe) and year % pivotYearMultiplier == 0
securityPivotTimeframeChange = timeframe.change(timeframe.period) and year % pivotYearMultiplier == 0
pivotTimeframeChangeCounter(condition) =>
var count = 0
if condition and bar_index > 0
count += 1
count
localPivots = ta.pivot_point_levels(pivotTypeInput, localPivotTimeframeChange)
securityPivotPointsArray = ta.pivot_point_levels(pivotTypeInput, securityPivotTimeframeChange)
securityTimeframe = timeframe.isintraday ? "1D" : timeframe.period
[securityPivots, securityPivotCounter] = request.security(syminfo.tickerid, pivotTimeframe, [securityPivotPointsArray, pivotTimeframeChangeCounter(securityPivotTimeframeChange)], lookahead = barmerge.lookahead_on)
pivotPointsArray = isDailyBasedInput ? securityPivots : localPivots
affixOldPivots(endTime) =>
if drawnGraphics.rows() > 0
lastGraphics = drawnGraphics.row(drawnGraphics.rows() - 1)
for graphic in lastGraphics
graphic.pivotLine.set_x2(endTime)
if positionLabelsInput == "Right"
graphic.pivotLabel.set_x(endTime)
drawNewPivots(startTime) =>
newGraphics = array.new<pivotGraphic>()
for [index, coord] in pivotPointsArray
levelSettings = graphicSettingsArray.get(index)
if not na(coord) and levelSettings.showLevel and switch_pivot
lineEndTime = startTime + timeframe.in_seconds(pivotTimeframe) * 1000 * pivotYearMultiplier
pivotLine = line.new(startTime, coord, lineEndTime, coord, xloc = xloc.bar_time, color=levelSettings.levelColor, width=linewidthInput)
pivotLabel = label.new(x = positionLabelsInput == "Left" ? startTime : lineEndTime,
y = coord,
text = (showLabelsInput ? levelSettings.levelName + " " : "") + (showPricesInput ? "(" + str.tostring(coord, format.mintick) + ")" : ""),
style = positionLabelsInput == "Left" ? label.style_label_right : label.style_label_left,
textcolor = levelSettings.levelColor,
color = #00000000,
xloc=xloc.bar_time)
newGraphics.push(pivotGraphic.new(pivotLine, pivotLabel))
drawnGraphics.add_row(array_id = newGraphics)
if drawnGraphics.rows() > maxHistoricalPivotsInput
oldGraphics = drawnGraphics.remove_row(0)
for graphic in oldGraphics
graphic.delete()
localPivotDrawConditionStatic = not isDailyBasedInput and localPivotTimeframeChange
securityPivotDrawConditionStatic = isDailyBasedInput and securityPivotCounter != securityPivotCounter[1]
var isMultiYearly = array.from("Biyearly", "Triyearly", "Quinquennially", "Decennially").includes(pivotAnchorInput)
localPivotDrawConditionDeveloping = not isDailyBasedInput and time_close == time_close(pivotTimeframe) and not isMultiYearly
securityPivotDrawConditionDeveloping = false
if (switch_pivot and (securityPivotDrawConditionStatic or localPivotDrawConditionStatic))
affixOldPivots(time)
drawNewPivots(time)
var FIRST_BAR_TIME = time
if (barstate.islastconfirmedhistory and drawnGraphics.columns() == 0 and switch_pivot)
if not na(securityPivots) and securityPivotCounter > 0
if isDailyBasedInput
drawNewPivots(FIRST_BAR_TIME)
else
runtime.error("Not enough intraday data to calculate Pivot Points. Lower the Pivots Timeframe or turn on the 'Use Daily-based Values' option in the indicator settings.")
else
runtime.error("Not enough data to calculate Pivot Points. Lower the Pivots Timeframe in the indicator settings.")
grp_MAIN = "General"
showHullRibbon = input.bool(true, title="Show Hull ribbon", group=grp_MAIN)
showRF = input.bool(false, title="Show Range Filter", group=grp_MAIN)
showRFBands = input.bool(false, title="Show Range Filter bands", group=grp_MAIN)
grp_THEME = "Theme"
upColor = input.color(color.rgb(8, 228, 8), title="Bullish*", group=grp_THEME)
downColor = input.color(color.rgb(226, 2, 2), title="Bearish*", group=grp_THEME)
midColor = input.color(color.orange, title="Consolidation candle", group=grp_THEME)
grp_RF = "Range Filter"
src = input.source(close, title="Source", group=grp_RF)
per001 = input.int(28, minval=1, title="Sampling period", group=grp_RF)
mult = input.float(2.7, minval=0.1, title="Range Multiplier", group=grp_RF)
smoothrng(x, t, m) =>
wper001 = t * 2 - 1
avrng = ta.ema(math.abs(x - x[1]), t)
smoothrng = ta.ema(avrng, wper001) * m
smoothrng
smrng = smoothrng(src, per001, mult)
rngfilt(x, r) =>
var float rngfilt = na
rngfilt := x > nz(rngfilt[1]) ? x - r < nz(rngfilt[1]) ? nz(rngfilt[1]) : x - r :
x + r > nz(rngfilt[1]) ? nz(rngfilt[1]) : x + r
rngfilt
filt = rngfilt(src, smrng)
var float upward = na
upward := filt > filt[1] ? nz(upward[1]) + 1 : filt < filt[1] ? 0 : nz(upward[1])
var float downward = na
downward := filt < filt[1] ? nz(downward[1]) + 1 : filt > filt[1] ? 0 : nz(downward[1])
hband = filt + smrng
lband = filt - smrng
filtcolor = upward > 0 ? upColor : downward > 0 ? downColor : midColor
isUpColor = src > filt and src > src[1] and upward > 0 ? true :
src > filt and src < src[1] and upward > 0 ? true : false
isDownColor = src < filt and src < src[1] and downward > 0 ? true :
src < filt and src > src[1] and downward > 0 ? true : false
filtplot = plot(showRF ? filt : na, color=filtcolor, linewidth=2, title="Range Filter")
hbandplot = plot(showRFBands ? hband : na, color=color.new(upColor, 70), title="High Target")
lbandplot = plot(showRFBands ? lband : na, color=color.new(downColor, 70), title="Low Target")
fill(hbandplot, filtplot, color=color.new(upColor, 90), title="High Target Range")
fill(lbandplot, filtplot, color=color.new(downColor, 90), title="Low Target Range")
grp_HULL = "Hull Suite"
hullsource = input.source(close, title="Hull Source", group=grp_HULL)
modeSwitch = input.string("Hma", title="Hull Variation", options=["Hma", "Thma", "Ehma"], group=grp_HULL)
length = input.int(28, title="Length", group=grp_HULL)
lengthMult = input.float(2.0, title="Length multiplier", group=grp_HULL)
useHtf = input.bool(false, title="Show Hull MA from higher timeframe", group=grp_HULL)
htf = input.timeframe("240", title="Higher timeframe", group=grp_HULL)
transpSwitch = input.int(80, title="Band Transparency", group=grp_HULL)
HMA(src, len) => ta.wma(2 * ta.wma(src, len / 2) - ta.wma(src, len), math.round(math.sqrt(len)))
EHMA(src, len) => ta.ema(2 * ta.ema(src, len / 2) - ta.ema(src, len), math.round(math.sqrt(len)))
THMA(src, len) => ta.wma(ta.wma(src, len / 3) * 3 - ta.wma(src, len / 2) - ta.wma(src, len), len)
Mode(modeSwitch, src, len) =>
switch modeSwitch
"Hma" => HMA(src, len)
"Ehma" => EHMA(src, len)
"Thma" => THMA(src, len / 2)
_hull = Mode(modeSwitch, hullsource, int(length * lengthMult))
HULL = useHtf ? request.security(syminfo.tickerid, htf, _hull) : _hull
MHULL = HULL
SHULL = HULL[2]
hullColor = HULL > HULL[2] ? color.new(upColor, transpSwitch - 35) : color.new(downColor, transpSwitch - 35)
Fi1 = plot(showHullRibbon ? MHULL : na, title="MHULL", color=hullColor, linewidth=1)
Fi2 = plot(showHullRibbon ? SHULL : na, title="SHULL", color=hullColor, linewidth=1)
fill(Fi1, Fi2, title="Band Filler", color=color.new(hullColor, transpSwitch))
alertcondition(ta.crossover(MHULL, SHULL), title="Hull trending up on RF+ Hull", message="Hull trending up on RF+ Hull")
alertcondition(ta.crossover(SHULL, MHULL), title="Hull trending down on RF+ Hull", message="Hull trending down on RF+ Hull")
showBuySell = input(true, "Show Buy & Sell", group="BUY & SELL SIGNALS")
sensitivity = input.float(3.3, "Sensitivity (1-6)", 1, 6, group="BUY & SELL SIGNALS")
percentStop = input.float(0.20, "Stop Loss % (0 to Disable)", 0, group="BUY & SELL SIGNALS")
offsetSignal = input.float(0, "Signals Offset", 0, group="BUY & SELL SIGNALS")
percWidth(len, perc) => (ta.highest(len) - ta.lowest(len)) * perc / 100
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[2] > highPrice and src[2] < highPrev
bullSignal = fractalBot and low[2] < lowPrice and src[2] > lowPrev
[bearSignal, bullSignal]
sourcex = close
smrng1 = smoothrng(sourcex, 27, 1.5)
smrng2 = smoothrng(sourcex, 55, sensitivity)
up = 0.0, up := filt > filt[1] ? nz(up[1]) + 1 : filt < filt[1] ? 0 : nz(up[1])
dn = 0.0, dn := filt < filt[1] ? nz(dn[1]) + 1 : filt > filt[1] ? 0 : nz(dn[1])
bullCond = sourcex > filt and sourcex > sourcex[1] and up > 0 or sourcex > filt and sourcex < sourcex[1] and up > 0
bearCond = sourcex < filt and sourcex < sourcex[1] and dn > 0 or sourcex < filt and sourcex > sourcex[1] and dn > 0
lastCond = 0, lastCond := bullCond ? 1 : bearCond ? -1 : lastCond[1]
bullx = bullCond and lastCond[1] == -1
bearx = bearCond and lastCond[1] == 1
countBull = ta.barssince(bullx)
countBear = ta.barssince(bearx)
trigger = nz(countBull, bar_index) < nz(countBear, bar_index) ? 1 : 0
rsi = ta.rsi(close, 10)
rsiOb = rsi > 80 and rsi > ta.ema(rsi, 10)
rsiOs = rsi < 20 and rsi < ta.ema(rsi, 10)
[wt1, wt2] = wavetrend(close, 9, 12)
[wtDivBear1, wtDivBull1] = f_findDivs(wt2, 15, -40)
[wtDivBear2, wtDivBull2] = f_findDivs(wt2, 45, -65)
wtDivBull = wtDivBull1 or wtDivBull2
wtDivBear = wtDivBear1 or wtDivBear2
off = percWidth(500, offsetSignal)
plotshape(showBuySell and bullx ? low - off : na, "Buy Label", shape.triangleup, location.belowbar, color=color.green, size=size.small)
plotshape(showBuySell and bearx ? high + off : na, "Sell Label", shape.triangledown, location.abovebar, color=color.red, size=size.small)
plotshape(ta.crossover(wt1, wt2) and wt2 <= -53, "Mild Buy", shape.xcross, location.belowbar, color=color.green, size=size.tiny)
plotshape(ta.crossunder(wt1, wt2) and wt2 >= 53, "Mild Sell", shape.xcross, location.abovebar, color=color.red, size=size.tiny)
plotshape(wtDivBull, "Divergence Buy", shape.triangleup, location.belowbar, color=#00DBFF, size=size.tiny)
plotshape(wtDivBear, "Divergence Sell", shape.triangledown, location.abovebar, color=color.maroon, size=size.tiny)
sensitivitysuper = input.float(5.5, "sensitivitysuper (0.5 - 12)", 0.5, 12, step=0.05, group = 'Settings')
ShowSmartTrail = input.bool(false, 'Smart Trail', inline = 'overlayLine1', group = 'Settings')
maj = input(true, title='TP Points', inline = 'overlayLine1', group = 'Settings')
show_ha = input.bool(false, 'Trend Tracker', inline = 'overlayLine2', group = 'Settings')
usePsar = input.bool(false, 'PSAR', inline = 'overlayLine3', group = 'Settings')
supertrend(_src, factor, atrLen) =>
atrat = ta.atr(atrLen)
upperBand = _src + factor * atrat
lowerBand = _src - factor * atrat
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 na(atrat[1])
direction := 1
else if prevSuperTrend == prevUpperBand
direction := close > upperBand ? -1 : 1
else
direction := close < lowerBand ? 1 : -1
superTrend := direction == -1 ? lowerBand : upperBand
[superTrend, direction]
ocAvg = math.avg(open, close)
ema1 = ta.ema(high, 9)
ema2 = ta.ema(high, 12)
ema3 = ta.ema(high, 15)
ema4 = ta.ema(high, 18)
sma1 = ta.sma(close, 5)
sma2 = ta.sma(close, 6)
sma3 = ta.sma(close, 7)
sma4 = ta.sma(close, 8)
sma5 = ta.sma(close, 9)
sma6 = ta.sma(close, 10)
sma7 = ta.sma(close, 11)
sma8 = ta.sma(close, 12)
sma9 = ta.sma(close, 13)
sma10 = ta.sma(close, 14)
sma11 = ta.sma(close, 15)
sma12 = ta.sma(close, 16)
sma13 = ta.sma(close, 17)
sma14 = ta.sma(close, 18)
sma15 = ta.sma(close, 19)
sma16 = ta.sma(close, 20)
psar = ta.sar(0.02, 0.02, 0.2)
[supertrend, direction] = supertrend(close, sensitivitysuper, 11)
barsL = 10
barsR = 10
pivotHigh = fixnan(ta.pivothigh(barsL, barsR)[1])
pivotLow = fixnan(ta.pivotlow(barsL, barsR)[1])
green = #04994b, green2 = #15c02a
red = #b4060d, red2 = #ff0002
p5 = plot(ocAvg, "", na, editable=false)
p6 = plot(psar, "PSAR", usePsar ? (psar < ocAvg ? green : red) : na, 1, plot.style_circles, editable=false)
fill(p5, p6, usePsar ? (psar < ocAvg ? color.new(green, 90) : color.new(red, 90)) : na, editable=false)
y1 = low - (ta.atr(30) * 2)
y2 = high + (ta.atr(30) * 2)
bull = ta.crossover(close, supertrend) and close >= sma9
bear = ta.crossunder(close, supertrend) and close <= sma9
buy = bull ? label.new(bar_index, y1, "?", xloc.bar_index, yloc.price, #04994b, label.style_label_up, color.white, size.small) : na
sell = bear ? label.new(bar_index, y2, "?", xloc.bar_index, yloc.price, #b4060d, label.style_label_down, color.white, size.small) : na
maj_qual = 13
maj_len = 40
min_qual = 5
min_len = 5
min = false
selll = 0.0
buyy = 0.0
lele(qual, len) =>
bindex = 0.0
sindex = 0.0
bindex := nz(bindex[1], 0)
sindex := nz(sindex[1], 0)
ret = 0
if close > close[4]
bindex += 1
bindex
if close < close[4]
sindex += 1
sindex
if bindex > qual and close < open and high >= ta.highest(high, len)
bindex := 0
ret := -1
ret
if sindex > qual and close > open and low <= ta.lowest(low, len)
sindex := 0
ret := 1
ret
return_1 = ret
return_1
major = lele(maj_qual, maj_len)
minor = lele(min_qual, min_len)
if minor == -1 and min == true
selll := 1
selll
if major == -1 and maj == true
selll := 2
selll
if major == -1 and maj == true and minor == -1 and min == true
selll := 3
selll
if minor == 1 and min == true
buyy := 1
buyy
if major == 1 and maj == true
buyy := 2
buyy
if major == 1 and maj == true and minor == 1 and min == true
buyy := 3
buyy
plotshape(selll == 2, style=shape.xcross, location=location.abovebar, size = size.tiny,color=color.new(#354996, 0), offset=0)
plotshape(buyy == 2, style=shape.xcross, location=location.belowbar,size = size.tiny, color=color.new(#354996, 0), offset=0)
tf(_res, _exp, gaps_on) =>
gaps_on == 0 ? request.security(syminfo.tickerid, _res, _exp) : gaps_on == true ? request.security(syminfo.tickerid, _res, _exp, barmerge.gaps_on, barmerge.lookahead_off) : request.security(syminfo.tickerid, _res, _exp, barmerge.gaps_off, barmerge.lookahead_off)
ha_htf = ''
ha_len = 100
ha_len2 = 100
o = ta.ema(open, ha_len)
c = ta.ema(close, ha_len)
h = ta.ema(high, ha_len)
l = ta.ema(low, ha_len)
haclose = tf(ha_htf, (o + h + l + c) / 4, 0)
xhaopen = tf(ha_htf, (o + c) / 2, 0)
haopen = na(xhaopen[1]) ? (o + c) / 2 : (xhaopen[1] + haclose[1]) / 2
hahigh = math.max(h, math.max(haopen, haclose))
halow = math.min(l, math.min(haopen, haclose))
o2 = tf(ha_htf, ta.ema(haopen, ha_len2), 0)
c2 = tf(ha_htf, ta.ema(haclose, ha_len2), 0)
h2 = tf(ha_htf, ta.ema(hahigh, ha_len2), 0)
l2 = tf(ha_htf, ta.ema(halow, ha_len2), 0)
ha_avg = (h2 + l2) / 2
osc_len = 7
osc_bias = 100 *(c2 - o2)
osc_smooth = ta.ema(osc_bias, osc_len)
sigcolor =
(osc_bias > 0) and (osc_bias >= osc_smooth) ? color.new(color.lime, 35) :
(osc_bias > 0) and (osc_bias < osc_smooth) ? color.new(color.lime, 75) :
(osc_bias < 0) and (osc_bias <= osc_smooth) ? color.new(color.red, 35) :
(osc_bias < 0) and (osc_bias > osc_smooth) ? color.new(color.red, 75) :
na
p_h = plot(h2, "Bias High", color=color(na), display=display.none, editable=false)
p_l = plot(l2, "Bias Low", color=color(na), display=display.none, editable=false)
p_avg = plot(ha_avg, "Bias Avergae", color=color(na), display=display.none, editable=false)
fill(p_l, p_h, show_ha ? sigcolor : na)
col = o2 > c2 ? color.red : color.lime
Cond_EMA(x, cond, n) =>
var val = array.new_float(0)
var ema_val = array.new_float(1)
if cond
array.push(val, x)
if array.size(val) > 1
array.remove(val, 0)
if na(array.get(ema_val, 0))
array.fill(ema_val, array.get(val, 0))
array.set(ema_val, 0, (array.get(val, 0) - array.get(ema_val, 0)) * (2 / (n + 1)) + array.get(ema_val, 0))
EMA = array.get(ema_val, 0)
EMA
Cond_SMA(x, cond, n) =>
var vals = array.new_float(0)
if cond
array.push(vals, x)
if array.size(vals) > n
array.remove(vals, 0)
SMA = array.avg(vals)
SMA
Stdev(x, n) =>
math.sqrt(Cond_SMA(math.pow(x, 2), 1, n) - math.pow(Cond_SMA(x, 1, n), 2))
rng_size(x, scale, qty, n) =>
ATR = Cond_EMA(ta.tr(true), 1, n)
AC = Cond_EMA(math.abs(x - x[1]), 1, n)
SD = Stdev(x, n)
rng_size = scale == 'Pips' ? qty * 0.0001 : scale == 'Points' ? qty * syminfo.pointvalue : scale == '% of Price' ? close * qty / 100 : scale == 'ATR' ? qty * ATR : scale == 'Average Change' ? qty * AC : scale == 'Standard Deviation' ? qty * SD : scale == 'Ticks' ? qty * syminfo.mintick : qty
rng_size
rng_filt(h, l,Показано первые 50% кода (символов: 49099)
Открыть по тарифу
Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.
Разовая покупка файла
На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.
Зачем нужен email? После подтверждения оплаты файл сохранится в кабинете на этот email. Если аккаунта ещё нет, мы создадим его и пришлём ссылку для задания пароля. Если аккаунт уже есть, покупка добавится в него. Укажите адрес, к которому у вас есть доступ.
Чтобы оформить заказ, введите email и перейдите к оплате.