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

Failed Breakout Detector

failedbreakoutdetector.mq5
Вы автор или правообладатель?

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

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

О программе

«Failed Breakout Detector» — это индикатор для MetaTrader 5, предназначенный для выявления неудачных пробоев торгового диапазона. Он анализирует последние N баров, формирующих диапазон цен, и отслеживает ситуации, когда цена закрывается за пределами этого диапазона, но затем возвращается обратно в течение заданного числа баров.

Индикатор отображает пробои в виде точек, а неудачные пробои — в виде стрелок над или под баром. Стрелки выше бара указывают на неудачный пробой вверх (медвежий сигнал), стрелки ниже бара — на неудачный пробой вниз (бычий сигнал). Дополнительно на графике отображается метка с количеством неудачных пробоев за текущий день.

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

Индикатор работает только с закрытыми барами и не перерисовывается. Два вычислительных буфера (сигнал и количество неудачных пробоев за день) доступны для чтения из советника через iCustom, что позволяет интегрировать сигналы в торговую логику.

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

НастройкаОписание
InpRangeBars Количество баров, формирующих торговый диапазон
InpConfirmBars Количество баров, в течение которых пробой должен удержаться, иначе он считается неудачным
InpAtrPeriod Период ATR (используется для фильтрации высоты диапазона)
InpMinRangeAtr Минимальная высота диапазона (в кратных ATR)
InpMaxRangeAtr Максимальная высота диапазона (в кратных ATR)
InpBufferAtr Насколько закрытие должно выходить за пределы диапазона (в кратных ATR)
InpShowBreakouts Отображать точки пробоя
InpShowLabel Отображать метку «неудачные пробои сегодня»
InpCorner Угол расположения метки
InpLabelX Смещение метки по X
InpLabelY Смещение метки по Y
InpFontSize Размер шрифта метки
InpLabelColor Цвет метки
InpAlert Всплывающее уведомление при неудачном пробое
InpPush Push-уведомление при неудачном пробое
InpSound Звуковой сигнал при неудачном пробое
InpSoundFile Звуковой файл
Получить полный код

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

#property version     "1.00"
#property description "Marks breakouts of the recent trading range and the ones that fail (price closes back inside within a few bars). Failed breakouts trap traders and often start a move the other way. Closed bars only, no repaint."
#property indicator_chart_window
#property indicator_buffers 7
#property indicator_plots   4

#property indicator_label1  "Breakout up"
#property indicator_type1   DRAW_ARROW
#property indicator_color1  clrDodgerBlue
#property indicator_width1  2

#property indicator_label2  "Breakout down"
#property indicator_type2   DRAW_ARROW
#property indicator_color2  clrDodgerBlue
#property indicator_width2  2

#property indicator_label3  "Failed breakout up (bearish)"
#property indicator_type3   DRAW_ARROW
#property indicator_color3  clrTomato
#property indicator_width3  2

#property indicator_label4  "Failed breakout down (bullish)"
#property indicator_type4   DRAW_ARROW
#property indicator_color4  clrMediumSeaGreen
#property indicator_width4  2

input int              InpRangeBars     = 12;                // Bars that form the range
input int              InpConfirmBars   = 3;                 // Bars in which the breakout must hold or it has failed
input int              InpAtrPeriod     = 14;                // ATR period (used to filter the range height)
input double           InpMinRangeAtr   = 0.5;               // Minimum range height (x ATR)
input double           InpMaxRangeAtr   = 4.0;               // Maximum range height (x ATR)
input double           InpBufferAtr     = 0.1;               // Close must be this far beyond the range (x ATR)
input bool             InpShowBreakouts = true;              // Show the breakout dots
input bool             InpShowLabel     = true;              // Show the "failed breakouts today" label
input ENUM_BASE_CORNER InpCorner        = CORNER_LEFT_UPPER; // Label corner
input int              InpLabelX        = 10;                // Label X offset
input int              InpLabelY        = 25;                // Label Y offset
input int              InpFontSize      = 10;                // Label font size
input color            InpLabelColor    = clrGray;           // Label colour
input bool             InpAlert         = false;             // Pop-up alert on a failed breakout
input bool             InpPush          = false;             // Push notification on a failed breakout
input bool             InpSound         = false;             // Sound on a failed breakout
input string           InpSoundFile     = "alert.wav";       // Sound file

double BufBreakUp[];     // plot 0: breakout up, dot below the bar
double BufBreakDown[];   // plot 1: breakout down, dot above the bar
double BufFailUp[];      // plot 2: failed breakout up, arrow above the bar
double BufFailDown[];    // plot 3: failed breakout down, arrow below the bar
double BufSignal[];      // calc: +1 failed breakout down (bullish), -1 failed breakout up (bearish), 0 nothing
double BufFailedToday[]; // calc: number of failed breakouts on the bar's day (so far)
double BufAtr[];         // calc: Wilder ATR

int    g_rangeBars;
int    g_confirmBars;
int    g_atrPeriod;

int      g_boDir=0;          // +1 up, -1 down, 0 nothing pending
int      g_boBar=-1;         // index of the breakout bar
double   g_boHi=0;           // range high at the time of the breakout
double   g_boLo=0;           // range low
int      g_failedToday=0;    // failed breakouts on the current day
int      g_failedUp=0;       // ... of them up
int      g_failedDown=0;     // ... of them down
datetime g_day=0;            // day of the last processed bar
int      g_lastProcessed=-1; // index of the last closed bar that was read

const string LABEL_NAME="FBD_count_label";

int OnInit()
  {
      // код доступен только после оплаты
   }

void OnDeinit(const int reason)
  {
   ObjectDelete(0,LABEL_NAME);
  }

void ResetState()
  {
   g_boDir=0;
   g_boBar=-1

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

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

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

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

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

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

Стоимость полного кода
731,40₽ ≈ $8.94