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

DonchianBreakoutSystem_v1.1.2 600+

donchianbreakoutsystem_v1.1.2 600+.mq5

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

#__slope direction line.mq5MQL5 / MetaTrader 5 · 1 общих теговrange breakout @meowforex1.pineTradingView · 1 общих тегов#1.mtf_collider_h4_close_13_v18bar.mq4MQL4 / MetaTrader 4 · 1 общих тегов!mth_fasttmaline_edit3.mq4MQL4 / MetaTrader 4 · 1 общих тегов!mth_fasttmaline_edit2.mq4MQL4 / MetaTrader 4 · 1 общих тегов!mth_fasttmaline_edit.mq4MQL4 / MetaTrader 4 · 1 общих тегов
Вы автор или правообладатель?

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

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

О программе

Поддерживает уведомления о сигналах через всплывающие алерты, звуковые оповещения, email и push-уведомления. Звуковые сигналы можно настроить по количеству повторений и паузе между ними. Направление сигнала определяется по смене тренда: переход от нисходящего к восходящему считается сигналом на покупку, наоборот — на продажу.

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

НастройкаОписание
UniqueName Уникальное имя — Идентификатор для именования графических объектов и комментариев индикатора на графике
Price Тип цены — Тип цены, используемый для расчёта: Close, Median, Typical, Weighted Close или варианты Heiken Ashi
ChannelPeriod Период канала — Базовый период для расчёта верхней и нижней границ канала Дончиана
MaxChannelPeriod Максимальный период канала — Максимальный период, до которого расширяется поиск канала при слишком узкой ширине
Margin Отступ — Множитель отступа от границ канала при расчёте линий канала
MinChannelWidth Минимальная ширина канала — Минимальная допустимая ширина канала в пунктах; при меньшей ширине период увеличивается
UpTrendColor Цвет восходящего тренда — Цвет элементов, связанных с восходящим трендом и сигналами на покупку
DnTrendColor Цвет нисходящего тренда — Цвет элементов, связанных с нисходящим трендом и сигналами на продажу
ShowFilledBoxes Показать заполненные блоки — Включает отображение залитых цветом прямоугольных блоков канала
ShowChannel Показать канал — Включает отрисовку линий верхней и нижней границ канала Дончиана
AnalysisSets Наборы анализа — Групповой заголовок для настроек анализа сделок
ShowAnalysis Показать анализ — Включает учёт и отображение статистики по сделкам (счётчики входов, прибыль, убытки)
ShowStatsComment Показать комментарий статистики — Отображает текстовый комментарий с общей статистикой на графике
ShowArrows Показать стрелки — Включает отображение стрелок на точках входа и выхода из сделок
ShowProfit Показать прибыль — Отображает числовые значения прибыли или убытка по каждой закрытой сделке
ShowExits Показать выходы — Отмечает на графике точки выхода из позиций
WinColor Цвет прибыли — Цвет для обозначения прибыльных сделок
LossColor Цвет убытков — Цвет для обозначения убыточных сделок
alerts Оповещения — Групповой заголовок для настроек уведомлений
AlertOn Алерты включены — Включает или отключает всплывающие алерты при появлении сигнала
Alert Shift:0-current bar,1-previous bar (AlertShift) Сдвиг алерта — Смещение бара для формирования сигнала: 0 — текущий бар, 1 — предыдущий бар
Number of sounds after Signal (SoundsNumber) Количество звуков — Число повторений звукового сигнала после появления сигнала
Pause in sec between sounds (SoundsPause) Пауза между звуками — Пауза в секундах между повторениями звукового сигнала
UpTrendSound Звук восходящего тренда — Файл звука для восходящего сигнала
DnTrendSound Звук нисходящего тренда — Файл звука для нисходящего сигнала
EmailOn Email включён — Включает или отключает отправку email-уведомлений при сигнале
EmailsNumber Количество писем — Число email-сообщений, отправляемых за один сигнал
PushNotificationOn Push-уведомления включены — Включает или отключает отправку push-уведомлений при сигнале
Получить полный код

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

#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 clrLimeGreen
#property indicator_color2 clrCoral
#property indicator_color3 clrGreen
#property indicator_color4 clrFireBrick

#property indicator_color5 clrLimeGreen
#property indicator_color6 clrCoral

enum ENUM_PRICE
{
   close,               // Close
   median,              // Median
   typical,             // Typical
   weightedClose,       // Weighted Close
   heikenAshiClose,     // Heiken Ashi Close
   heikenAshiMedian,    // Heiken Ashi Median
   heikenAshiTypical,   // Heiken Ashi Typical
   heikenAshiWeighted   // Heiken Ashi Weighted Close   
};

input string      UniqueName           = "DonchianBrk";
input ENUM_PRICE  Price                = heikenAshiClose;
input int         ChannelPeriod        =        5;
input int         MaxChannelPeriod     =       30;
input double      Margin               =        0;
input double      MinChannelWidth      =       10;  
input color       UpTrendColor         = clrDodgerBlue;   
input color       DnTrendColor         = clrLightCoral;
input bool        ShowFilledBoxes      =     true;
input bool        ShowChannel          =     true;

input string      AnalysisSets         = "=== Trade Analysis ===";
input bool        ShowAnalysis         =     true;
input bool        ShowStatsComment     =     true;
input bool        ShowArrows           =     true;
input bool        ShowProfit           =     true;
input bool        ShowExits            =     true;
input color       WinColor             = clrLimeGreen;   
input color       LossColor            = clrTomato;

input string      alerts               = "==== Alerts & Emails: ====";
input bool        AlertOn              =    false;       //
input int         AlertShift           =        1;       // Alert Shift:0-current bar,1-previous bar
input int         SoundsNumber         =        5;       // Number of sounds after Signal
input int         SoundsPause          =        5;       // Pause in sec between sounds 
input string      UpTrendSound         = "alert.wav";
input string      DnTrendSound         = "alert2.wav";
input bool        EmailOn              =    false;       // 
input int         EmailsNumber         =        *;       //
input bool        PushNotificationOn   =    false;

double UpSignal[];
double DnSignal[];
double UpBand[];
double LoBand[];
double buyexit[];
double sellexit[];
double trend[];
double buycnt[];
double sellcnt[];
double pf[];

int      timeframe, buylosscnt[2], selllosscnt[2];
bool     buystop[2], sellstop[2];
double   _point, buyopen[], buyclose[], sellopen[], sellclose[], lobound, upbound, totbuyprofit[2], totsellprofit[2], totbuyloss[2], totsellloss[2];
datetime buyopentime[], buyclosetime[], sellopentime[], sellclosetime[], prevtime;
string   short_name, TF, IndicatorName;

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

void OnDeinit(const int reason)
{

   Comment("");
   ObjectsDeleteAll(0,UniqueName);

   ChartRedraw();
}

int start()
{
      // код доступен только после оплаты
   }
   int   shift, limit, counted_bars = IndicatorCounted();
   double buyprofit, sellprofit;

   if(counted_bars > 0) limit = Bars - counted_bars - 1;
   if(counted_bars < 0) return(0);
   if(counted_bars < 1)
   { 
   limit = Bars - 1;   
      for(int i=limit;i>=0;i--) 
      {
      UpBand[i]   = EMPTY_VALUE; 
      LoBand[i]   = EMPTY_VALUE;
      UpSignal[i] = EMPTY_VALUE;
      DnSignal[i] = EMPTY_VALUE;
      buyexit[i]  = 0;
      sellexit[i] = 0;
      } 
   }   

   for(shift=limit; shift>=0; shift--)
   {
      if(Time[shift] != prevtime)
      {
      buystop[1]  = buystop[0];
      sellstop[1] = sellstop[0];
      prevtime    = Time[shift];    
      }

   int maxperiod = MaxChannelPeriod;
   int hhbar     = iHighest(NULL,0,MODE_HIGH,ChannelPeriod,shift);
   int llbar     = iLowest (NULL,0,MODE_LOW ,ChannelPeriod,shift);   
   double hh     = High[hhbar];
   double ll     = Low [llbar];
   double width  = (hh - ll)*(1 - 2*Margin);

   if(shift > Bars - maxperiod) continue;

      if(width < MinChannelWidth*_point)
      { 
         for(i=ChannelPeriod+1;i<=maxperiod;i++)  
         {
         hhbar = iHighest(NULL,0,MODE_HIGH,i,shift); 
         llbar = iLowest (NULL,0,MODE_LOW ,i,shift);

         hh = High[hhbar];
         ll = Low [llbar];

         width = (hh - ll)*(1 - 2*Margin);

            if(width >= MinChannelWidth*_point) break; 
            else
            { 
               if(i >= maxperiod && shift + i < Bars - 2) maxperiod = maxperiod + 1;
               else
               continue;
            }
         }
      }

   UpBand[shift] = hh - width*Margin;
   LoBand[shift] = ll + width*Margin;

   trend[shift] = trend[shift+1];

      if(priceWrapper(Price,shift) > UpBand[shift+1]) trend[shift] = 1;
      if(priceWrapper(Price,shift) < LoBand[shift+1]) trend[shift] =-1;

      if(trend[shift+1] != trend[shift+2])
      {
      if(trend[shift+1] > 0) {totsellprofit[1] = totsellprofit[0]; totsellloss[1] = totsellloss[0]; selllosscnt[1] = selllosscnt[0];}
      if(trend[shift+1] < 0) {totbuyprofit[1]  =  totbuyprofit[0]; totbuyloss[1]  =  totbuyloss[0]; buylosscnt[1]  = buylosscnt[0];}
      }

   UpSignal[shift]  = EMPTY_VALUE;
   DnSignal[shift]  = EMPTY_VALUE;
   buycnt[shift]    = buycnt[shift+1];
   sellcnt[shift]   = sellcnt[shift+1];
   buyexit[shift]   = 0;
   sellexit[shift]  = 0;
   buystop[0]       = buystop[1];
   sellstop[0]      = sellstop[1];   

      if(trend[shift] > 0)
      {
         if(trend[shift+1] <= 0) 
         {
         lobound  = MathMin(LoBand[llbar],LoBand[MathMax(llbar,shift+ChannelPeriod)]);

            if(UpBand[shift+1] > 0 && UpBand[shift+1] != EMPTY_VALUE && lobound > 0 && lobound != EMPTY_VALUE)
            {
            SetBox(UniqueName+" UpBox "+TimeToString(Time[shift]),0,Time[shift],UpBand[shift+1],Time[MathMax(llbar,shift+ChannelPeriod)],lobound,ShowFilledBoxes,clrNONE,1,UpTrendColor,1); 
            UpSignal[shift] = lobound;

               if(ShowAnalysis)
               {
               buycnt[shift] = buycnt[shift+1] + 1;

               ArrayResize(buyopen ,buycnt[shift]);
               ArrayResize(buyclose,buycnt[shift]);
               ArrayResize(buyopentime ,buycnt[shift]);
               ArrayResize(buyclosetime,buycnt[shift]);

               buyopen[(int)buycnt[shift]-1]     = Close[shift];
               buyopentime[(int)buycnt[shift]-1] = Time[shift];
               buyclose[(int)buycnt[shift]-1]    = buyopen[(int)buycnt[shift]-1];
               buystop[0] = false;

                  if(ShowArrows) 
                  {
                  ObjectDelete(UniqueName+" BuyOpen "+DoubleToStr(buycnt[shift],0)); 
                  plotArrow(UniqueName+" BuyOpen "+DoubleToStr(buycnt[shift],0),buyopentime[(int)buycnt[shift]-1],buyopen[(int)buycnt[shift]-1],1,UpTrendColor);
                  }
               }
            }

            if(High[shift] >= upbound && !sellstop[0] && sellclose[(int)sellcnt[shift]-1] == sellopen[(int)sellcnt[shift]-1]) 
            {
            sellclose[(int)sellcnt[shift]-1]     = upbound; 
            sellclosetime[(int)sellcnt[shift]-1] = Time[shift];
            sellstop[0]     = true;

               if(sellopentime[(int)sellcnt[shift]-1] > 0 && sellclosetime[(int)sellcnt[shift]-1] > 0)
               {   
               if(sellclose[(int)sellcnt[shift]-1] <= sellopen[(int)sellcnt[shift]-1]) color sellcolor = WinColor; else sellcolor = LossColor;
               plotTrend(UniqueName+" SellTrend "+DoubleToStr(sellcnt[shift],0),sellopentime[(int)sellcnt[shift]-1],sellopen[(int)sellcnt[shift]-1],sellclosetime[(int)sellcnt[shift]-1],sellclose[(int)sellcnt[shift]-1],2,0,sellcolor);   
               if(ShowArrows && trend[shift+1] < 0) plotArrow(UniqueName+" SellClose "+DoubleToStr(sellcnt[shift],0),sellclosetime[(int)sellcnt[shift]-1],sellclose[(int)sellcnt[shift]-1],3,DnTrendColor);
               if(ShowExits) sellexit[shift] = sellclose[(int)sellcnt[shift]-1];
               }

               if(ShowProfit)
               { 
               sellprofit = (sellopen[(int)sellcnt[shift]-1] - sellclose[(int)sellcnt[shift]-1])/_point;
                  if(sellprofit >= 0) totsellprofit[0] = totsellprofit[1] + sellprofit; 
                  else 
                  {
                  totsellloss[0] = totsellloss[1] - sellprofit; 
                  selllosscnt[0] = selllosscnt[1] + 1;
                  }

               ObjectDelete(0,UniqueName+" SellProfit "+DoubleToStr(sellcnt[shift],0));

                  if(sellprofit >= 0) plotText(UniqueName+" SellProfit "+DoubleToStr(sellcnt[shift],0),0,"+"+DoubleToStr(sellprofit,1),sellclosetime[(int)sellcnt[shift]-1],sellclose[(int)sellcnt[shift]-1],ANCHOR_RIGHT_UPPER,WinColor,"Arial",8);
                  else plotText(UniqueName+" SellProfit "+DoubleToStr(sellcnt[shift],0),0,DoubleToStr(sellprofit,1),sellclosetime[(int)sellcnt[shift]-1],sellclose[(int)sellcnt[shift]-1],ANCHOR_RIGHT_LOWER,LossColor,"Arial",8);
               }   
            }  
         }

      ObjectDelete(0,UniqueName+" DnBox "+TimeToString(Time[shift]));

         if(ShowAnalysis) 
         {
            if(trend[shift+1] > 0)
            {
               if(High[shift] > buyclose[(int)buycnt[shift]-1] && !buystop[0]) 
               {
               buyclose[(int)buycnt[shift]-1]     = High[shift]; 
               buyclosetime[(int)buycnt[shift]-1] = Time[shift];
               }

               if(Low[shift] <= lobound && !buystop[0] && buyclose[(int)buycnt[shift]-1] == buyopen[(int)buycnt[shift]-1]) 
               {
               buyclose[(int)buycnt[shift]-1]     = lobound;
               buyclosetime[(int)buycnt[shift]-1] = Time[shift];
               buystop[0] = true;
               }
            }

        ObjectDelete(0,UniqueName+" BuyTrend "+DoubleToStr(buycnt[shift],0)); 
        if(ShowArrows) ObjectDelete(0,UniqueName+" BuyClose "+DoubleToStr(buycnt[shift],0));

            if(buyopentime[(int)buycnt[shift]-1] > 0 && buyclosetime[(int)buycnt[shift]-1] > 0)
            {   
            if(buyclose[(int)buycnt[shift]-1] >= buyopen[(int)buycnt[shift]-1]) color buycolor = WinColor; else buycolor = LossColor;
            plotTrend(UniqueName+" BuyTrend "+DoubleToStr(buycnt[shift],0),buyopentime[(int)buycnt[shift]-1],buyopen[(int)buycnt[shift]-1],buyclosetime[(int)buycnt[shift]-1],buyclose[(int)buycnt[shift]-1],2,0,buycolor);   
            if(ShowArrows && trend[shift+1] > 0) plotArrow(UniqueName+" BuyClose "+DoubleToStr(buycnt[shift],0),buyclosetime[(int)buycnt[shift]-1],buyclose[(int)buycnt[shift]-1],3,UpTrendColor);
            if(ShowExits) buyexit[shift] = buyclose[(int)buycnt[shift]-1];
            }

            if(ShowProfit)
            { 
            buyprofit = (buyclose[(int)buycnt[shift]-1] - buyopen[(int)buycnt[shift]-1])/_point;
               if(buyprofit >= 0) totbuyprofit[0] = totbuyprofit[1] + buyprofit; 
               else 
               {
               totbuyloss[0] = totbuyloss[1] - buyprofit;
               buylosscnt[0] = buylosscnt[1] + 1;
               }

            ObjectDelete(0,UniqueName+" BuyProfit "+DoubleToStr(buycnt[shift],0));

               if(buyprofit >= 0) plotText(UniqueName+" BuyProfit "+DoubleToStr(buycnt[shift],0),0,"+"+DoubleToStr(buyprofit,1),buyclosetime[(int)buycnt[shift]-1],buyclose[(int)buycnt[shift]-1],ANCHOR_RIGHT_LOWER,WinColor,"Arial",8);
               else plotText(UniqueName+" BuyProfit "+DoubleToStr(buycnt[shift],0),0,DoubleToStr(buyprofit,1),buyclosetime[(int)buycnt[shift]-1],buyclose[(int)buycnt[shift]-1],ANCHOR_RIGHT_UPPER,LossColor,"Arial",8);
            }

         if(ShowArrows) 
            if(ObjectGetInteger(0,UniqueName+" SellOpen "+DoubleToStr(sellcnt[shift]+1,0),OBJPROP_TIME) == Time[shift]) ObjectDelete(0,UniqueName+" SellOpen "+DoubleToStr(sellcnt[shift]+1,0));
         }
      }

      if(trend[shift] < 0)
      {
         if(trend[shift+1] >= 0) 
         {
         upbound = MathMax(UpBand[hhbar],UpBand[MathMax(hhbar,shift+ChannelPeriod)]); //High[iHighest(NULL,0,MODE_HIGH,MathMax(hhbar - shift,ChannelPeriod),shift+1)]; 

            if(LoBand[shift+1] > 0 && LoBand[shift+1] != EMPTY_VALUE && upbound > 0 && upbound != EMPTY_VALUE)
            {
            SetBox(UniqueName+" DnBox "+TimeToString(Time[shift]),0,Time[shift],LoBand[shift+1],Time[MathMax(hhbar,shift+ChannelPeriod)],upbound,ShowFilledBoxes,clrNONE,1,DnTrendColor,1); 
            DnSignal[shift] = upbound;

               if(ShowAnalysis)
               {
               sellcnt[shift] = sellcnt[shift+1] + 1;

               ArrayResize(sellopen ,sellcnt[shift]);
               ArrayResize(sellclose,sellcnt[shift]);
               ArrayResize(sellopentime ,sellcnt[shift]);
               ArrayResize(sellclosetime,sellcnt[shift]);

               sellopen[(int)sellcnt[shift]-1]     = Close[shift];
               sellopentime[(int)sellcnt[shift]-1] = Time[shift];
               sellclose[(int)sellcnt[shift]-1]    = sellopen[(int)sellcnt[shift]-1];
               sellstop[0] = false;

     

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

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

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

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

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

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

Стоимость полного кода
2 133,50₽ ≈ $26.08