Fair Value Gaps - Significant Displacement
Сообщите нам, если считаете, что материал размещён без разрешения.
Сообщить о материале
Обращение по товару «indicator_fair_value_gaps_significant_displacement_for_tradingview.pine» отправится на рассмотрение. Укажите контакт для ответа и опишите причину.
О программе
Индикатор «Fair Value Gaps - Significant Displacement» отображает на графике TradingView так называемые пробелы стоимости (Fair Value Gaps, FVG) — зоны между тремя свечами, где цена не пересекала промежуточный диапазон. Бычий FVG определяется, когда текущая свеча имеет минимум выше максимума двух свечей назад; медвежий — когда максимум ниже минимума двух свечей назад. Для подтверждения применяются фильтры: относительный объём, размер разрыва относительно ATR и критерии тела свечи смещения.
Подтверждённые FVG отрисовываются в виде цветных прямоугольников с настраиваемой прозрачностью и границами. По желанию добавляются пунктирные линии уровня 50 % и текстовые метки. Индикатор управляет отображением в рамках выбранного исторического периода: прямоугольники завершаются в конце торгового дня, а устаревшие по возрасту удаляются. При полном заполнении разрыва соответствующий прямоугольник удаляется.
Индикатор поддерживает четыре условия оповещений: появление нового бычьего или медвежьего FVG и полное заполнение каждого из них. Все параметры доступны через настройки пользователя.
Настройки программы
| Настройка | Описание |
|---|---|
| showFVG | Показывать FVG — Общая настройка отображения всех прямоугольников FVG на графике. |
| showBullishFVG | Показывать бычьи FVG — Включает отображение прямоугольников бычьих FVG. |
| showBearishFVG | Показывать медвежьи FVG — Включает отображение прямоугольников медвежьих FVG. |
| maxFvgHistory | Максимальная история FVG — Максимальное количество одновременно отображаемых прямоугольников FVG на графике. |
| historicalLookbackDays | Исторический период (торговые дни) — Количество завершённых торговых дней, в течение которых FVG остаются видимыми на графике помимо текущего дня. |
| bullishFvgColor | Цвет бычьей FVG — Цвет заливки и границ прямоугольников бычьих FVG. |
| bearishFvgColor | Цвет медвежьей FVG — Цвет заливки и границ прямоугольников медвежьих FVG. |
| boxTransparency | Прозрачность коробки — Степень прозрачности заливки прямоугольников FVG (0 — непрозрачные, 100 — невидимые). |
| borderTransparency | Прозрачность границы — Степень прозрачности границ прямоугольников FVG (0 — непрозрачные, 100 — невидимые). |
| showFvgText | Показывать текст FVG — Включает отображение текстовых меток «FVG» рядом с прямоугольниками. |
| showMidpoint | Показывать середину 50% — Включает отображение пунктирных линий уровня 50 % (середина каждого FVG). |
| midpointTransparency | Прозрачность линии середины — Степень прозрачности пунктирных линий уровня 50 % (середина FVG). |
| volumeLength | Длина среднего объёма — Период усреднения объёма для расчёта относительного объёма средней свечи смещения. |
| minRelativeVolume | Минимальный относительный объём — Минимальное кратное среднего объёма, которое должна достигать средняя свеча смещения (от 1,0 до 5,0). |
| atrLength | Длина ATR — Период расчёта индикатора Average True Range (ATR), используемого для фильтрации минимального размера разрыва и тела смещения. |
| minGapAtr | Минимальный размер FVG (ATR) — Минимальный размер ценового разрыва в единицах ATR для признания FVG значимым. |
| minDisplacementBodyAtr | Минимальное тело смещения (ATR) — Минимальный размер тела средней свечи в единицах ATR, необходимый для подтверждения смещения. |
| minBodyPercentOfRange | Минимум % тела от диапазона свечи — Минимальная доля тела средней свечи от её полного диапазона (от 0,30 до 1,00). |
| requireDirectionalDisplacement | Требовать направленное свечение смещения — При включении бычьи FVG требуют бычьей свечи смещения (close > open), медвежьи — медвежьей (close < open). |
Поиск по коду файла
indicator(
"Fair Value Gaps - Significant Displacement",
overlay = true,
max_boxes_count = 500
)
showFVG = input.bool(
true,
"Show FVG",
group = "Fair Value Gaps"
)
showBullishFVG = input.bool(
true,
"Show Bullish FVG",
group = "Fair Value Gaps"
)
showBearishFVG = input.bool(
true,
"Show Bearish FVG",
group = "Fair Value Gaps"
)
maxFvgHistory = input.int(
50,
"Maximum FVG History",
minval = 10,
maxval = 200,
group = "Fair Value Gaps"
)
historicalLookbackDays = input.int(
3,
"Historical Lookback (Trading Days)",
options = [1, 3, 5, 10],
group = "Fair Value Gaps",
tooltip = "Keeps FVGs visible for this many completed trading days in addition to the current trading day."
)
bullishFvgColor = input.color(
color.green,
"Bullish FVG Color",
group = "Visuals"
)
bearishFvgColor = input.color(
color.red,
"Bearish FVG Color",
group = "Visuals"
)
boxTransparency = input.int(
90,
"Box Transparency",
minval = 0,
maxval = 100,
group = "Visuals"
)
borderTransparency = input.int(
20,
"Border Transparency",
minval = 0,
maxval = 100,
group = "Visuals"
)
showFvgText = input.bool(
true,
"Show FVG Text",
group = "Visuals"
)
showMidpoint = input.bool(
true,
"Show 50% Midpoint",
group = "Visuals",
tooltip = "Draws the 50% level of each FVG. Off by default to keep the chart clean."
)
midpointTransparency = input.int(
35,
"Midpoint Transparency",
minval = 0,
maxval = 100,
group = "Visuals"
)
volumeLength = input.int(
20,
"Volume Average Length",
minval = 5,
maxval = 100,
group = "Quality Filters"
)
minRelativeVolume = input.float(
1.25,
"Minimum Relative Volume",
minval = 1.0,
maxval = 5.0,
step = 0.05,
group = "Quality Filters",
tooltip = "The middle displacement candle must have at least this multiple of its recent average volume."
)
atrLength = input.int(
14,
"ATR Length",
minval = 5,
maxval = 100,
group = "Quality Filters"
)
minGapAtr = input.float(
0.10,
"Minimum FVG Size (ATR)",
minval = 0.0,
maxval = 2.0,
step = 0.05,
group = "Quality Filters",
tooltip = "Minimum size of the actual fair value gap as a fraction of ATR."
)
minDisplacementBodyAtr = input.float(
0.70,
"Minimum Displacement Body (ATR)",
minval = 0.10,
maxval = 3.0,
step = 0.05,
group = "Quality Filters",
tooltip = "The middle candle body must be at least this large relative to ATR."
)
minBodyPercentOfRange = input.float(
0.60,
"Minimum Body % Of Candle Range",
minval = 0.30,
maxval = 1.0,
step = 0.05,
group = "Quality Filters",
tooltip = "Requires the displacement candle body to occupy a meaningful percentage of the full candle range."
)
requireDirectionalDisplacement = input.bool(
true,
"Require Directional Displacement Candle",
group = "Quality Filters",
tooltip = "Bullish FVGs require a bullish displacement candle and bearish FVGs require a bearish displacement candle."
)
float volumeAverage =
ta.sma(
volume,
volumeLength
)
float atrValue =
ta.atr(
atrLength
)
bool enoughBars =
bar_index >= 2
bool validVolumeData =
enoughBars and
not na(volume[1]) and
not na(volumeAverage[1]) and
volumeAverage[1] > 0
float middleRelativeVolume =
validVolumeData ?
volume[1] /
volumeAverage[1] :
na
bool volumeQualified =
validVolumeData and
middleRelativeVolume >=
minRelativeVolume
float middleBody =
enoughBars ?
math.abs(
close[1] -
open[1]
) :
na
float middleRange =
enoughBars ?
high[1] -
low[1] :
na
float middleBodyPercent =
enoughBars and
middleRange > 0 ?
middleBody /
middleRange :
0.0
bool displacementBodyQualified =
enoughBars and
not na(atrValue[1]) and
middleBody >=
atrValue[1] *
minDisplacementBodyAtr and
middleBodyPercent >=
minBodyPercentOfRange
bool bullishDisplacementDirection =
not requireDirectionalDisplacement or
close[1] >
open[1]
bool bearishDisplacementDirection =
not requireDirectionalDisplacement or
close[1] <
open[1]
float bullishGapSize =
enoughBars ?
low -
high[2] :
na
float bearishGapSize =
enoughBars ?
low[2] -
high :
na
bool bullishGapSizeQualified =
enoughBars and
not na(atrValue) and
bullishGapSize >=
atrValue *
minGapAtr
bool bearishGapSizeQualified =
enoughBars and
not na(atrValue) and
bearishGapSize >=
atrValue *
minGapAtr
var array<box> fvgBoxes =
array.new_box()
var array<int> fvgDirs =
array.new_int()
var array<float> fvgTops =
array.new_float()
var array<float> fvgBottoms =
array.new_float()
var array<int> fvgCreatedBars =
array.new_int()
var array<int> fvgAgeDays =
array.new_int()
var array<bool> fvgTouched =
array.new_bool()
var array<bool> fvgFinalized =
array.new_bool()
var array<line> fvgMidpointLines =
array.new_line()
var array<label> fvgTextLabels =
array.new_label()
bool newTradingDay =
ta.change(
time("D")
) != 0
if newTradingDay
int dayIndex =
array.size(
fvgBoxes
) -
1
while dayIndex >= 0
int ageDays =
array.get(
fvgAgeDays,
dayIndex
) +
1
array.set(
fvgAgeDays,
dayIndex,
ageDays
)
bool removeForAge =
ageDays >
historicalLookbackDays
if removeForAge
box expiredHistoryBox =
array.get(
fvgBoxes,
dayIndex
)
if not na(
expiredHistoryBox
)
box.delete(
expiredHistoryBox
)
line expiredMidpointLine =
array.get(
fvgMidpointLines,
dayIndex
)
if not na(
expiredMidpointLine
)
line.delete(
expiredMidpointLine
)
label expiredTextLabel =
array.get(
fvgTextLabels,
dayIndex
)
if not na(
expiredTextLabel
)
label.delete(
expiredTextLabel
)
array.remove(
fvgBoxes,
dayIndex
)
array.remove(
fvgDirs,
dayIndex
)
array.remove(
fvgTops,
dayIndex
)
array.remove(
fvgBottoms,
dayIndex
)
array.remove(
fvgCreatedBars,
dayIndex
)
array.remove(
fvgAgeDays,
dayIndex
)
array.remove(
fvgTouched,
dayIndex
)
array.remove(
fvgFinalized,
dayIndex
)
array.remove(
fvgMidpointLines,
dayIndex
)
array.remove(
fvgTextLabels,
dayIndex
)
else
bool finalized =
array.get(
fvgFinalized,
dayIndex
)
if not finalized
box dayBox =
array.get(
fvgBoxes,
dayIndex
)
if not na(
dayBox
)
box.set_extend(
dayBox,
extend.none
)
box.set_right(
dayBox,
bar_index -
1
)
line dayMidpointLine =
array.get(
fvgMidpointLines,
dayIndex
)
if not na(
dayMidpointLine
)
line.set_extend(
dayMidpointLine,
extend.none
)
line.set_x2(
dayMidpointLine,
bar_index -
1
)
array.set(
fvgFinalized,
dayIndex,
true
)
dayIndex -=
1
bool newBullishFVG =
false
bool newBearishFVG =
false
bool bullishFvgFilled =
false
bool bearishFvgFilled =
false
bool bullishFVG =
enoughBars and
barstate.isconfirmed and
low >
high[2] and
volumeQualified and
bullishGapSizeQualified and
displacementBodyQualified and
bullishDisplacementDirection
bool bearishFVG =
enoughBars and
barstate.isconfirmed and
high <
low[2] and
volumeQualified and
bearishGapSizeQualified and
displacementBodyQualified and
bearishDisplacementDirection
var table wm = table.new(position.bottom_right, 1, 1)
if barstate.isfirst
table.cell(wm, 0, 0, "Telegram @SimpleForexTools", text_color = color.new(color.gray, 70), text_size = size.large)
if bullishFVG
float fvgTop =
low
float fvgBottom =
high[2]
box newFvgBox =
na
if showFVG and
showBullishFVG
newFvgBox :=
box.new(
left =
bar_index -
1,
top =
fvgTop,
right =
bar_index,
bottom =
fvgBottom,
xloc =
xloc.bar_index,
extend =
extend.right,
border_color =
color.new(
bullishFvgColor,
borderTransparency
),
border_width =
1,
bgcolor =
color.new(
bullishFvgColor,
boxTransparency
)
)
array.push(
fvgBoxes,
newFvgBox
)
array.push(
fvgDirs,
1
)
array.push(
Показано первые 50% кода (символов: 10433)
Открыть по тарифу
Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.
Разовая покупка файла
На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.
Зачем нужен email? После подтверждения оплаты файл сохранится в кабинете на этот email. Если аккаунта ещё нет, мы создадим его и пришлём ссылку для задания пароля. Если аккаунт уже есть, покупка добавится в него. Укажите адрес, к которому у вас есть доступ.
Чтобы оформить заказ, введите email и перейдите к оплате.