Auction Failure (Liquidity Sweep)
Сообщите нам, если считаете, что материал размещён без разрешения.
Сообщить о материале
Обращение по товару «auction failure (liquidity sweepfakeout).pine» отправится на рассмотрение. Укажите контакт для ответа и опишите причину.
О программе
Индикатор «Auction Failure (Liquidity Sweep)» предназначен для анализа графиков на платформе TradingView. Он выявляет паттерны «аукционного провала» — ситуации, когда цена пробивает экстремум недавнего диапазона (верх или низ), но затем закрывается обратно внутри него, что может указывать на ложный пробой и потенциальный разворот.
Индикатор работает только на подтверждённых свечах (без перерисовки) и отображает сигналы в виде графических маркеров, линий, зон и подписей на графике. Доступны фильтры направления тренда и защита от сигналов против сильного тренда на основе ADX и скользящей средней SMA.
Встроенные оповещения TradingView срабатывают при появлении сигналов LONG (пробой низа диапазона) и SHORT (пробой верха диапазона). Все параметры настраиваются пользователем через панель входных данных индикатора.
Настройки программы
| Настройка | Описание |
|---|---|
| dirMode | Направление сигналов: Both — оба направления, Long only — только LONG, Short only — только SHORT. |
| lookback | Количество свечей для определения диапазона: наивысший максимум и наинизший минимум за этот период (до текущей свечи) задают границы диапазона. |
| failWindow | Количество свечей после пробыва, в течение которых должен произойти возврат (отклонение) внутрь диапазона. 0 — возврат должен случиться на свече пробоя. |
| cooldownBars | Минимальное количество свечей между сигналами одного направления. После сигнала LONG новые LONG-сигналы игнорируются до истечения этого периода (аналогично для SHORT). 0 — отключено. |
| useTrend | Фильтрация сигналов по направлению тренда: LONG только при цене выше SMA, SHORT — при цене ниже SMA (измеряется на свече перед пробоем). |
| smaLen | Период скользящей средней SMA, используемой для фильтра направления тренда и защиты от сильного тренда. |
| slopeBars | Количество свечей для проверки наклона SMA. Если больше 0, SMA должна возрастать (для LONG) или убывать (для SHORT) по сравнению с указанным числом свечей назад. 0 — отключено. |
| showSma | Отображение линии скользящей средней SMA на графике. |
| useStrong | Блокировка контртрендовых сигналов при обнаружении сильного тренда: LONG блокируются при сильном росте, SHORT — при сильном падении. |
| adxLen | Период расчёта индикатора ADX, используемого для определения силы тренда в блокировке контртрендовых сигналов. |
| adxMin | Минимальное значение ADX, при котором тренд считается сильным. При более высоком значении блокировка срабатывает реже. |
| strongBars | Количество свечей, за которые оценивается перемещение SMA для определения сильного тренда (в единицах ATR). |
| strongSlope | Минимальное перемещение SMA за окно strongBars, измеренное в ATR. 0 — проверка только по ADX. |
| showStrongBg | Заливка фона графика при обнаружении сильного тренда: зелёный — сильный рост (SHORT заблокированы), красный — сильное падение (LONG заблокированы). |
| minBreakAtr | Минимальное расстояние пробоя за пределы уровня, выраженное в кратных ATR. 0 — любой пробой за уровень считается допустимым. |
| minRangeAtr | Минимальная высота диапазона в кратных ATR. Исключает слишком мелкие и нестабильные диапазоны. 0 — отключено. |
| needColor | Если включено, свеча отклонения должна закрыться в направлении сигнала: бычья закрытие для LONG, медвежья для SHORT. |
| showLine | Отображение пунктирной линии спринта от свечи, сформировавшей уровень, до свечи сигнала. |
| showZone | Отображение зоны спринта — полосы между уровнем пробоя и экстремальной точкой отката. |
| showDot | Отображение круглого маркера на экстремальной точке спринта (максимуме или минимуме). |
| showRange | Отображение рамки (коробки), обозначающей границы ценового диапазона. |
| lblStyle | Стиль подписей сигналов: Pill — прямоугольная метка, Arrow — стрелка. |
| lblSize | Размер текста подписей сигналов на графике. |
| colRange | Цвет рамки диапазона (коробки), отображающей недавний ценовой диапазон на графике. |
| colRef | Цвет пунктирной линии, проведённой от уровня пробоя до свечи сигнала. |
| colLong | Цвет маркера и подписи для сигнала LONG (пробой низа диапазона с возвратом внутрь). |
| colShort | Цвет маркера и подписи для сигнала SHORT (пробой верха диапазона с возвратом внутрь). |
| colSma | Цвет линии скользящей средней SMA, отображаемой на графике. |
Поиск по коду файла
indicator("Auction Failure (Liquidity Sweep)", shorttitle="AuctionFail", overlay=true, max_boxes_count=500, max_lines_count=500, max_labels_count=500)
grpS = "Signal"
dirMode = input.string("Both", "Signal direction", options=["Both", "Long only", "Short only"], group=grpS, tooltip="Long = sweep of the range LOW (price breaks below, then closes back inside). Short = sweep of the range HIGH (price breaks above, then closes back inside). The trend filters below can further restrict direction.")
lookback = input.int(50, "Range lookback (candles)", minval=3, maxval=300, group=grpS, tooltip="The highest high and lowest low of this many candles (before the current one) define the range.")
failWindow = input.int(2, "Candles allowed to reject after the break", minval=0, maxval=20, group=grpS, tooltip="0 = the breakout candle itself must close back inside the range. 2 = the breakout candle or either of the next 2 candles.")
cooldownBars = input.int(10, "Min candles between same-direction signals", minval=0, maxval=100, group=grpS, tooltip="After a long signal, new long setups are ignored until more than this many candles have passed. Same for shorts (tracked separately). 0 = off. Helps avoid repeated counter-trend signals in a strong trend.")
grpT = "Trend filter (SMA)"
useTrend = input.bool(false, "Signal only in the direction of the trend", group=grpT, tooltip="Long signals only when price is above the SMA, short signals only when price is below it. Measured on the candle before the break.")
smaLen = input.int(50, "SMA length", minval=2, maxval=500, group=grpT, tooltip="Used by the trend filter and by the strong trend guard.")
slopeBars = input.int(0, "SMA slope check (candles, 0 = off)", minval=0, maxval=50, group=grpT, tooltip="If above 0, the SMA must also be rising (longs) or falling (shorts) compared with this many candles earlier.")
showSma = input.bool(false, "Show SMA on chart", group=grpT)
grpX = "Strong trend guard"
useStrong = input.bool(true, "Block counter-trend signals in a strong trend", group=grpX, tooltip="When a strong uptrend is detected, short signals are blocked. When a strong downtrend is detected, long signals are blocked. Can be used with or without the trend filter above (it uses the same SMA length).")
adxLen = input.int(14, "ADX length", minval=2, maxval=100, group=grpX)
adxMin = input.float(25.0, "Min ADX for a strong trend", minval=5.0, maxval=60.0, step=1.0, group=grpX, tooltip="Lower = the guard triggers more often (blocks more signals). Higher = only very strong trends block signals.")
strongBars = input.int(10, "SMA move window (candles)", minval=1, maxval=100, group=grpX, tooltip="The SMA must have moved enough over this many candles (see next setting) to count as a strong trend.")
strongSlope = input.float(1.0, "Min SMA move (× ATR)", minval=0.0, step=0.1, group=grpX, tooltip="How far the SMA must have travelled over the window, measured in ATR. 0 = ignore this check and use ADX only.")
showStrongBg = input.bool(true, "Tint background in strong trend", group=grpX, tooltip="Green tint = strong uptrend (shorts blocked). Red tint = strong downtrend (longs blocked).")
grpF = "Sweep quality"
minBreakAtr = input.float(0.1, "Min break beyond the level (× ATR)", minval=0.0, step=0.05, group=grpF, tooltip="How far price must push beyond the range high/low for it to count as a break. 0 = any tick beyond the level.")
minRangeAtr = input.float(1.0, "Min range height (× ATR)", minval=0.0, step=0.1, group=grpF, tooltip="The range must be at least this tall. Avoids tiny choppy ranges. 0 = off.")
needColor = input.bool(true, "Rejection candle must close in signal direction", group=grpF, tooltip="On: bearish rejection candle for short signals, bullish for long signals.")
grpD = "Display"
showLine = input.bool(true, "Show sweep line", group=grpD)
showZone = input.bool(true, "Show sweep zone", group=grpD)
showDot = input.bool(true, "Show wick marker", group=grpD)
showRange = input.bool(true, "Show range box", group=grpD)
lblStyle = input.string("Pill", "Label style", options=["Pill", "Arrow"], group=grpD)
lblSize = input.string("small", "Label text size", options=["tiny", "small", "normal", "large"], group=grpD)
grpC = "Colors"
colRange = input.color(#9AA5B8, "Range box", group=grpC)
colRef = input.color(#F5C542, "Sweep line", group=grpC)
colLong = input.color(#089981, "Long signal", group=grpC)
colShort = input.color(#F23645, "Short signal", group=grpC)
colSma = input.color(#FFB74D, "Trend SMA", group=grpC)
f_textOn(color c) =>
(color.r(c) * 0.299 + color.g(c) * 0.587 + color.b(c) * 0.114) > 160 ? color.black : color.white
string lblSz = switch lblSize
"tiny" => size.tiny
"normal" => size.normal
"large" => size.large
=> size.small
float atrV = ta.atr(14)
float rngHi = ta.highest(high, lookback)[1]
float rngLo = ta.lowest(low, lookback)[1]
int hiOff = nz(ta.highestbars(high, lookback)[1]) // offset (<= 0) of the range high, relative to the previous bar
int loOff = nz(ta.lowestbars(low, lookback)[1]) // offset (<= 0) of the range low, relative to the previous bar
float smaV = ta.sma(close, smaLen)
bool trendUp = not useTrend or (not na(smaV[1]) and close[1] > smaV[1] and (slopeBars == 0 or smaV[1] > smaV[1 + slopeBars]))
bool trendDn = not useTrend or (not na(smaV[1]) and close[1] < smaV[1] and (slopeBars == 0 or smaV[1] < smaV[1 + slopeBars]))
[diP, diM, adxV] = ta.dmi(adxLen, adxLen)
float atrPrev = math.max(nz(atrV[1]), syminfo.mintick)
float smaMove = (smaV[1] - smaV[1 + strongBars]) / atrPrev
bool strongOk = useStrong and not na(adxV[1]) and adxV[1] >= adxMin and (strongSlope == 0 or (not na(smaMove) and math.abs(smaMove) >= strongSlope))
bool strongUp = strongOk and diP[1] > diM[1] and (strongSlope == 0 or smaMove > 0)
bool strongDn = strongOk aПоказано первые 50% кода (символов: 9094)