0
Завтра буду смотреть.
avatar

AM2

  • 14 июня 2017, 21:03
0
В тестере не тестируется, а онлайн сигналит: www.opentraders.ru/downloads/1606/

avatar

AM2

  • 14 июня 2017, 19:52
0
Помню в хейкен просто так не получишь цвет свечки. посмотрю еще сегодня.
avatar

AM2

  • 14 июня 2017, 17:32
0
Поставьте в свойствах:

#property indicator_chart_window
avatar

AM2

  • 14 июня 2017, 17:29
0
Посмотрю сегодня.
avatar

AM2

  • 14 июня 2017, 17:24
0
Включить галку:
if(Mobila==True) SendNotification("Вам пуш! :-)");

Подробнее о пуш: docs.mql4.com/ru/common/sendnotification

avatar

AM2

  • 13 июня 2017, 17:37
0

datetime t=0;

if(t!=Time[0])
{
...//открытие по сигналу
t=Time[0];
}
avatar

AM2

  • 13 июня 2017, 07:02
0
делайте в следующий раз максимально подробное тз, чтобы не было никаких разночтений, тогда шансы получить то что нужно возрастут. и помните здесь делаю только то что можно быстро сделать.
avatar

AM2

  • 12 июня 2017, 21:13
0
через каждые 5 пунктов не дает алерт

Длину луча показывает.
avatar

AM2

  • 12 июня 2017, 21:04
0
Это все надо было сразу делать, чтобы у меня никаких вопросов не было. А так я с ним уже достаточно намучился. Лучше к платному.
avatar

AM2

  • 12 июня 2017, 20:43
0
На М5 гоняете?
avatar

AM2

  • 12 июня 2017, 20:41
0
И скрины с условиями для постановки отложек, а то без наглядности я могу только догадываться как все это может выглядеть.
avatar

AM2

  • 12 июня 2017, 20:34
0
На скринах все покажите как надо?
avatar

AM2

  • 12 июня 2017, 18:53
0
Вариант совмещенный с зигзагом:



//+------------------------------------------------------------------+
//|                                                       ZigZag.mq4 |
//|                   Copyright 2006-2014, MetaQuotes Software Corp. |
//|                                              http://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright "2006-2014, MetaQuotes Software Corp."
#property link      "http://www.mql4.com"
#property strict

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1  Red
//---- indicator parameters
input int InpDepth=12;     // Depth
input int InpDeviation=5;  // Deviation
input int InpBackstep=3;   // Backstep
//---- indicator buffers
double ExtZigzagBuffer[];
double ExtHighBuffer[];
double ExtLowBuffer[];
double z=0;
//--- globals
int    ExtLevel=3; // recounting's depth of extremums
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   if(InpBackstep>=InpDepth)
     {
      Print("Backstep cannot be greater or equal to Depth");
      return(INIT_FAILED);
     }
//--- 2 additional buffers
   IndicatorBuffers(3);
//---- drawing settings
   SetIndexStyle(0,DRAW_SECTION);
//---- indicator buffers
   SetIndexBuffer(0,ExtZigzagBuffer);
   SetIndexBuffer(1,ExtHighBuffer);
   SetIndexBuffer(2,ExtLowBuffer);
   SetIndexEmptyValue(0,0.0);
//---- indicator short name
   IndicatorShortName("ZigZag("+string(InpDepth)+","+string(InpDeviation)+","+string(InpBackstep)+")");
//---- initialization done
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
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[])
  {
   int    i,limit,counterZ,whatlookfor=0;
   int    back,pos,lasthighpos=0,lastlowpos=0;
   double extremum;
   double curlow=0.0,curhigh=0.0,lasthigh=0.0,lastlow=0.0;
//--- check for history and inputs
   if(rates_total<InpDepth || InpBackstep>=InpDepth)
      return(0);
//--- first calculations
   if(prev_calculated==0)
      limit=InitializeAll();
   else
     {
      //--- find first extremum in the depth ExtLevel or 100 last bars
      i=counterZ=0;
      while(counterZ<ExtLevel && i<100)
        {
         if(ExtZigzagBuffer[i]!=0.0)
            counterZ++;
         i++;
        }
      //--- no extremum found - recounting all from begin
      if(counterZ==0)
         limit=InitializeAll();
      else
        {
         //--- set start position to found extremum position
         limit=i-1;
         //--- what kind of extremum?
         if(ExtLowBuffer[i]!=0.0)
           {
            //--- low extremum
            curlow=ExtLowBuffer[i];
            //--- will look for the next high extremum
            whatlookfor=1;
           }
         else
           {
            //--- high extremum
            curhigh=ExtHighBuffer[i];
            //--- will look for the next low extremum
            whatlookfor=-1;
           }
         //--- clear the rest data
         for(i=limit-1; i>=0; i--)
           {
            ExtZigzagBuffer[i]=0.0;
            ExtLowBuffer[i]=0.0;
            ExtHighBuffer[i]=0.0;
           }
        }
     }
//--- main loop      
   for(i=limit; i>=0; i--)
     {
      //--- find lowest low in depth of bars
      extremum=low[iLowest(NULL,0,MODE_LOW,InpDepth,i)];
      //--- this lowest has been found previously
      if(extremum==lastlow)
         extremum=0.0;
      else
        {
         //--- new last low
         lastlow=extremum;
         //--- discard extremum if current low is too high
         if(low[i]-extremum>InpDeviation*Point)
            extremum=0.0;
         else
           {
            //--- clear previous extremums in backstep bars
            for(back=1; back<=InpBackstep; back++)
              {
               pos=i+back;
               if(ExtLowBuffer[pos]!=0 && ExtLowBuffer[pos]>extremum)
                  ExtLowBuffer[pos]=0.0;
              }
           }
        }
      //--- found extremum is current low
      if(low[i]==extremum)
         ExtLowBuffer[i]=extremum;
      else
         ExtLowBuffer[i]=0.0;
      //--- find highest high in depth of bars
      extremum=high[iHighest(NULL,0,MODE_HIGH,InpDepth,i)];
      //--- this highest has been found previously
      if(extremum==lasthigh)
         extremum=0.0;
      else
        {
         //--- new last high
         lasthigh=extremum;
         //--- discard extremum if current high is too low
         if(extremum-high[i]>InpDeviation*Point)
            extremum=0.0;
         else
           {
            //--- clear previous extremums in backstep bars
            for(back=1; back<=InpBackstep; back++)
              {
               pos=i+back;
               if(ExtHighBuffer[pos]!=0 && ExtHighBuffer[pos]<extremum)
                  ExtHighBuffer[pos]=0.0;
              }
           }
        }
      //--- found extremum is current high
      if(high[i]==extremum)
         ExtHighBuffer[i]=extremum;
      else
         ExtHighBuffer[i]=0.0;
     }
//--- final cutting 
   if(whatlookfor==0)
     {
      lastlow=0.0;
      lasthigh=0.0;
     }
   else
     {
      lastlow=curlow;
      lasthigh=curhigh;
     }
   for(i=limit; i>=0; i--)
     {
      switch(whatlookfor)
        {
         case 0: // look for peak or lawn 
            if(lastlow==0.0 && lasthigh==0.0)
              {
               if(ExtHighBuffer[i]!=0.0)
                 {
                  lasthigh=High[i];
                  lasthighpos=i;
                  whatlookfor=-1;
                  ExtZigzagBuffer[i]=lasthigh;
                 }
               if(ExtLowBuffer[i]!=0.0)
                 {
                  lastlow=Low[i];
                  lastlowpos=i;
                  whatlookfor=1;
                  ExtZigzagBuffer[i]=lastlow;
                 }
              }
            break;
         case 1: // look for peak
            if(ExtLowBuffer[i]!=0.0 && ExtLowBuffer[i]<lastlow && ExtHighBuffer[i]==0.0)
              {
               ExtZigzagBuffer[lastlowpos]=0.0;
               lastlowpos=i;
               lastlow=ExtLowBuffer[i];
               ExtZigzagBuffer[i]=lastlow;
              }
            if(ExtHighBuffer[i]!=0.0 && ExtLowBuffer[i]==0.0)
              {
               lasthigh=ExtHighBuffer[i];
               lasthighpos=i;
               ExtZigzagBuffer[i]=lasthigh;
               whatlookfor=-1;
              }
            break;
         case -1: // look for lawn
            if(ExtHighBuffer[i]!=0.0 && ExtHighBuffer[i]>lasthigh && ExtLowBuffer[i]==0.0)
              {
               ExtZigzagBuffer[lasthighpos]=0.0;
               lasthighpos=i;
               lasthigh=ExtHighBuffer[i];
               ExtZigzagBuffer[i]=lasthigh;
              }
            if(ExtLowBuffer[i]!=0.0 && ExtHighBuffer[i]==0.0)
              {
               lastlow=ExtLowBuffer[i];
               lastlowpos=i;
               ExtZigzagBuffer[i]=lastlow;
               whatlookfor=1;
              }
            break;
        }
     }

   double zz0=ZZPrice(0);
   double zz1=ZZPrice(1);
   double delta=(int)(MathAbs(zz1-zz0)/Point);

   if(z!=zz0)
     {
      Alert(Symbol()+"ZigZag прошел "+(string)delta+" пунктов!!!");
      z=zz0;
     }

   Comment("\n ZZ0:",zz0,
           "\n ZZ1:",zz1,
           "\n ZigZag прошел "+(string)delta+" пунктов!!!");

//--- done
   return(rates_total);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double ZZPrice(int ne=0)
  {
   double zz;
   int    i,k=iBars(NULL,0),ke=0;

   for(i=1; i<k; i++)
     {
      zz=ExtZigzagBuffer[i];

      if(zz!=0)
        {
         ke++;
         if(ke>ne) return(zz);
        }
     }
   Print("GetExtremumZZPrice(): Экстремум ЗигЗага номер ",ne," не найден");
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int InitializeAll()
  {
   ArrayInitialize(ExtZigzagBuffer,0.0);
   ArrayInitialize(ExtHighBuffer,0.0);
   ArrayInitialize(ExtLowBuffer,0.0);
//--- first counting position
   return(Bars-InpDepth);
  }
//+------------------------------------------------------------------+

avatar

AM2

  • 12 июня 2017, 11:40
0
Самый первый набросок:


//+------------------------------------------------------------------+
//|                                                     ZZPoints.mq4 |
//|                                              Copyright 2017, AM2 |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, AM2"
#property link      "http://www.forexsystems.biz"
#property version   "1.00"
#property strict
#property indicator_chart_window

//---- indicator parameters
input int Depth=12;     // Depth
input int Deviation=5;  // Deviation
input int Backstep=3;   // Backstep

double z=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double ZZPrice(int ne=0)
  {
   double zz;
   int    i,k=iBars(NULL,0),ke=0;

   for(i=1; i<k; i++)
     {
      zz=iCustom(NULL,0,"ZigZag",Depth,Deviation,Backstep,0,i);

      if(zz!=0)
        {
         ke++;
         if(ke>ne) return(zz);
        }
     }
   Print("GetExtremumZZPrice(): Экстремум ЗигЗага номер ",ne," не найден");
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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[])
  {
//---
   double zz0=ZZPrice(0);
   double zz1=ZZPrice(1);
   double delta=(int)(MathAbs(zz1-zz0)/Point);

   if(z!=zz0)
     {
      Alert(Symbol()+"ZigZag прошел "+(string)delta+" пунктов!!!");
      z=zz0;
     }

   Comment("\n ZigZag прошел "+(string)delta+" пунктов!!!");

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

avatar

AM2

  • 12 июня 2017, 11:37
0
Вариант с удалением ордеров при обновлении луча зигзага:




//+------------------------------------------------------------------+
//|                                                      Zigmund.mq4 |
//|                                              Copyright 2017, AM2 |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, AM2"
#property link      "http://www.forexsystems.biz"
#property version   "1.00"
#property strict

//--- Inputs
extern double Lots        = 0.1;      // лот
extern int StopLoss       = 300;      // лось
extern int TakeProfit     = 600;      // язь
extern int Delta          = 50;       // расстояние до экстремума
extern int Gamma          = 50;       // длина луча
extern int Slip           = 30;       // реквот
extern int Magic          = 123;      // магик

double z=0;
datetime t=0;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   Comment("");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   Comment("");
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void PutOrder(int type,double price)
  {
   int r=0;
   color clr=Green;
   double sl=0,tp=0;
   double zz0 = ZZPrice(0);
   double zz1 = ZZPrice(1);
   double zz2 = ZZPrice(2);

   if(type==1 || type==3 || type==5)
     {
      clr=Red;
      if(StopLoss>0) sl=NormalizeDouble(price+StopLoss*Point,Digits); else sl=zz2;
      if(TakeProfit>0) tp=NormalizeDouble(price-TakeProfit*Point,Digits); else tp=price-MathAbs(zz0-zz1)*2;
     }

   if(type==0 || type==2 || type==4)
     {
      clr=Blue;
      if(StopLoss>0) sl=NormalizeDouble(price-StopLoss*Point,Digits); else sl=zz2;
      if(TakeProfit>0) tp=NormalizeDouble(price+TakeProfit*Point,Digits); else tp=price+MathAbs(zz0-zz1)*2;
     }

   r=OrderSend(NULL,type,Lots,NormalizeDouble(price,Digits),Slip,sl,tp,"",Magic,0,clr);
   return;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountTrades()
  {
   int count=0;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()<2) count++;
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//| Подсчет ордеров по типу                                          |
//+------------------------------------------------------------------+
int CountOrders(int type=-1)
  {
   int count=0;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==type || (OrderType()>=0 && type==-1)) count++;
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//| Удаление отложенных ордеров                                      |
//+------------------------------------------------------------------+
void DelOrder()
  {
   bool del;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()>1) del=OrderDelete(OrderTicket());
           }
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double ZZPrice(int ne=0)
  {
   double zz;
   int    i,k=iBars(NULL,0),ke=0;

   for(i=1; i<k; i++)
     {
      zz=iCustom(NULL,0,"ZigZag",12,5,3,0,i);
      if(zz!=0)
        {
         ke++;
         if(ke>ne) return(zz);
        }
     }
   Print("GetExtremumZZPrice(): Экстремум ЗигЗага номер ",ne," не найден");
   return(0);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   double zz0 = ZZPrice(0);
   double zz1 = ZZPrice(1);
   double zz2 = ZZPrice(2);
   double gamma = MathAbs(zz0-zz1)/Point;
   double delta = MathAbs(zz0-zz2)/Point;

   if(t!=Time[0])
     {
      if(z!=zz0) DelOrder();
      
      if(CountTrades()<1)
        {
         if(gamma>Gamma && delta>Delta)
           {
            if(CountOrders(4)<1 && zz0<zz1) PutOrder(4,zz1);
            if(CountOrders(5)<1 && zz0>zz1) PutOrder(5,zz1);
           }
        }
      z=zz0;
      t=Time[0];
     }

   Comment("\n zz0: ",ZZPrice(0),
           "\n zz1: ",ZZPrice(1),
           "\n zz2: ",ZZPrice(2));
  }
//+------------------------------------------------------------------+

avatar

AM2

  • 11 июня 2017, 19:57
0
Сделал набросок:




//+------------------------------------------------------------------+
//|                                                      Zigmund.mq4 |
//|                                              Copyright 2017, AM2 |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, AM2"
#property link      "http://www.forexsystems.biz"
#property version   "1.00"
#property strict

//--- Inputs
extern double Lots        = 0.1;      // лот
extern int StopLoss       = 300;      // лось
extern int TakeProfit     = 600;      // язь
extern int Delta          = 50;       // расстояние до экстремума
extern int Gamma          = 50;       // длина луча
extern int Slip           = 30;       // реквот
extern int Magic          = 123;      // магик

double up=0,dn=0;
datetime t=0;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   Comment("");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   Comment("");
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void PutOrder(int type,double price)
  {
   int r=0;
   color clr=Green;
   double sl=0,tp=0;
   double zz0 = ZZPrice(0);
   double zz1 = ZZPrice(1);
   double zz2 = ZZPrice(2);
   
   if(type==1 || type==3 || type==5)
     {
      clr=Red;
      if(StopLoss>0) sl=NormalizeDouble(price+StopLoss*Point,Digits); else sl=zz2;
      if(TakeProfit>0) tp=NormalizeDouble(price-TakeProfit*Point,Digits); else tp=price-MathAbs(zz0-zz1)*2;
     }

   if(type==0 || type==2 || type==4)
     {
      clr=Blue;
      if(StopLoss>0) sl=NormalizeDouble(price-StopLoss*Point,Digits); else sl=zz2;
      if(TakeProfit>0) tp=NormalizeDouble(price+TakeProfit*Point,Digits); else tp=price+MathAbs(zz0-zz1)*2;
     }

   r=OrderSend(NULL,type,Lots,NormalizeDouble(price,Digits),Slip,sl,tp,"",Magic,TimeCurrent()+PeriodSeconds(),clr);
   return;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountTrades()
  {
   int count=0;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()<2) count++;
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//| Подсчет ордеров по типу                                          |
//+------------------------------------------------------------------+
int CountOrders(int type=-1)
  {
   int count=0;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==type || (OrderType()>=0 && type==-1)) count++;
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//| Удаление отложенных ордеров                                      |
//+------------------------------------------------------------------+
void DelOrder()
  {
   bool del;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()>1) del=OrderDelete(OrderTicket());
           }
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double ZZPrice(int ne=0)
  {
   double zz;
   int    i,k=iBars(NULL,0),ke=0;

   for(i=1; i<k; i++)
     {
      zz=iCustom(NULL,0,"ZigZag",12,5,3,0,i);
      if(zz!=0)
        {
         ke++;
         if(ke>ne) return(zz);
        }
     }
   Print("GetExtremumZZPrice(): Экстремум ЗигЗага номер ",ne," не найден");
   return(0);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   double zz0 = ZZPrice(0);
   double zz1 = ZZPrice(1);
   double zz2 = ZZPrice(2);
   double gamma = MathAbs(zz0-zz1)/Point;
   double delta = MathAbs(zz0-zz2)/Point;

   if(t!=Time[0])
     {
      if(CountTrades()<1)
        {
         if(gamma>Gamma && delta>Delta)
           {
            if(CountOrders(4)<1 && zz0<zz1) {PutOrder(4,zz1); up=zz1;}
            if(CountOrders(5)<1 && zz0>zz1) {PutOrder(5,zz1); dn=zz1;}
           }
        }
      t=Time[0];
     }

   Comment("\n zz0: ",ZZPrice(0),
           "\n zz1: ",ZZPrice(1),
           "\n zz2: ",ZZPrice(2));
  }
//+------------------------------------------------------------------+

avatar

AM2

  • 11 июня 2017, 16:21
0
Один работает:



Кватерлей поправил: www.opentraders.ru/downloads/1603/

avatar

AM2

  • 11 июня 2017, 15:02
0
После выходных посмотрю.
avatar

AM2

  • 10 июня 2017, 15:25