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

zigzagsignal.mq5

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

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

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

О программе

Индикатор рассчитывает уровни верхнего и нижнего пределов на основе свинг-хайдов и свинг-лоу ценовой истории с настраиваемыми параметрами глубины, отклонения и возврата. Определяется направление сигнала — бычье или медвежье — в зависимости от последнего сформированного уровня.

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

Дополнительно индикатор отображает информационную панель через функцию Comment, показывающую данные об аккаунте, текущем состоянии сигнала и уровнях. На графике также рисуются трендовые линии, соединяющие уровни сигналов.

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

НастройкаОписание
Depth (InpDepth) Depth — Depth
Deviation (InpDeviation) Deviation — Deviation
Backstep (InpBackstep) Backstep — Backstep
Display Alerts / Messages (Yes) or (No) (alerts) Display Alerts / Messages — Display Alerts / Messages (Yes) or (No)
Email Alert (Yes) or (No) (EmailAlert) Email Alert — Email Alert (Yes) or (No)
Alert On Bar after Limit (alertonbar) Alert On Bar after Limit — Alert On Bar after Limit
Send Notification (Yes) or (No) (sendnotify) Send Notification — Send Notification (Yes) or (No)
Display Trade Info (displayinfo) Display Trade Info — Display Trade Info
Получить полный код

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

#property description "Indicator ZigZag System with Signal and Alert"
#property description "Added Alert and modify by Roberto Jacobs 3rjfx @ 2018/12/29"
/* Update_01: 2019/01/27 ~ added Push Notification. */
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 clrRed
#property indicator_style1 STYLE_SOLID
#property indicator_width1 2
#property indicator_color2 clrBlue
#property indicator_style2 STYLE_SOLID
#property indicator_width2 2

enum YN
 {
   No,
   Yes
 };

input int               InpDepth = 62;         // Depth 
input int           InpDeviation = 15;         // Deviation
input int            InpBackstep = 9;         // Backstep
input YN                  alerts = Yes;        // Display Alerts / Messages (Yes) or (No)
input YN              EmailAlert = No;         // Email Alert (Yes) or (No)
input int             alertonbar = 3;          // Alert On Bar after Limit
input YN              sendnotify = No;         // Send Notification (Yes) or (No)
input YN             displayinfo = Yes;        // Display Trade Info

double ZZBufferHi[];
double ZZBufferLo[];

double 
   pricepos,
   latprice,
   lbwprice;
datetime 
   fbartime,
   pbartime,
   cbartime;
datetime 
   lat,lbw,
   alcb,alcs;
int za,zb;
int xzb,xzs;
int cur=5,prv=2;
int cmnt,pmnt;
static int fbar;
string posisi,
       sigpos,
       msgText;
string frtext;
string iname,ulimit;
static bool bull,bear;

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

int deinit()
  {

    Comment("");
    ObjectsDeleteAll();
    GlobalVariablesDeleteAll();

   return(0);
  }

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
      // код доступен только после оплаты
   }

   ArraySetAsSeries(high,true);
   ArraySetAsSeries(low,true);
   ArraySetAsSeries(time,true);

   int    shift,back,lasthighpos,lastlowpos;
   double val,res;
   double curlow,curhigh,lasthigh=0.0,lastlow=0.0;

   if(rates_total<InpDepth || InpBackstep>=InpDepth)
      return(0);

   for(shift=rates_total-InpDepth; shift>=0; shift--)
     {
      val=low[iLowest(_Symbol,0,MODE_LOW,InpDepth,shift)];
      if(val==lastlow) val=0.0;
      else 
        { 
         lastlow=val; 
         if((low[shift]-val)>(InpDeviation*_Point)) val=0.0;
         else
           {
            for(back=1; back<=InpBackstep; back++)
              {
               res=ZZBufferLo[shift+back];
               if((res!=0)&&(res>val)) ZZBufferLo[shift+back]=0.0; 
              }
           }
        } 
      ZZBufferLo[shift]=val;

      val=high[iHighest(_Symbol,0,MODE_HIGH,InpDepth,shift)];
      if(val==lasthigh) val=0.0;
      else 
        {
         lasthigh=val;
         if((val-high[shift])>(InpDeviation*_Point)) val=0.0;
         else
           {
            for(back=1; back<=InpBackstep; back++)
              {
               res=ZZBufferHi[shift+back];
               if((res!=0)&&(res<val)) ZZBufferHi[shift+back]=0.0; 
              } 
           }
        }
      ZZBufferHi[shift]=val;
     }

   lasthigh=-1; lasthighpos=-1;
   lastlow=-1;  lastlowpos=-1;

   for(shift=rates_total-InpDepth; shift>=0; shift--)
     {
      curlow=ZZBufferLo[shift];
      curhigh=ZZBufferHi[shift];
      if((curlow==0)&&(curhigh==0)) continue;

      if(curhigh!=0)
        {
         if(lasthigh>0) 
           {
            if(lasthigh<curhigh) ZZBufferHi[lasthighpos]=0;
            else ZZBufferHi[shift]=0;
           }

         if(lasthigh<curhigh || lasthigh<0)
           {
            lasthigh=curhigh;
            lasthighpos=shift;
           }
         lastlow=-1;
        }

      if(curlow!=0)
        {
         if(lastlow>0)
           {
            if(lastlow>curlow) ZZBufferLo[lastlowpos]=0;
            else ZZBufferLo[shift]=0;
           }

         if((curlow<lastlow)||(lastlow<0))
           {
            lastlow=curlow;
            lastlowpos=shift;
           } 
         lasthigh=-1;
        }
     }

   for(shift=rates_total-1; shift>=0; shift--)
     {
      if(shift>=rates_total-InpDepth) ZZBufferLo[shift]=0.0;
      else
        {
         res=ZZBufferHi[shift];
         if(res!=0.0) ZZBufferHi[shift]=res;
        }
     }

   for(int zi=360; zi>=0 && !IsStopped(); zi--)
     {
       if(high[zi]==ZZBufferHi[zi]) za=zi;
       if(low[zi]==ZZBufferLo[zi]) zb=zi;
     }

   if(za<zb && za>alertonbar && alcs!=time[za])
     {
       xzb=0;
       xzs++;
       cbartime=time[za];
       alcs=time[za];
       fbar=iBarShift(_Symbol,0,cbartime,false);
       pricepos=high[za];
       ulimit="Upper Limit_"+string(xzs);
       cur=-1;
     }
   if(za>zb && zb>alertonbar && alcb!=time[zb])
     {
       xzs=0;
       xzb++;
       cbartime=time[zb];
       alcb=time[zb];
       fbar=iBarShift(_Symbol,0,cbartime,false); 
       pricepos=low[zb];
       ulimit="Lower Limit_

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

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

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

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

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

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

Стоимость полного кода
773,70₽ ≈ $9.46