Is it possible to programmatically find ALL horizontal channels/floats at a certain time interval or at least formulate the ToR correctly? - page 7

 
Rayder69:

Here's a script I can't remember where or when I found it.

Maybe someone could use it!?


What does it do?
 
You enter in the variable what kind of a flop you are interested in during the whole history and it gives you the longest flop in the specified number of pips, when and how long it lasted.
 

Thank you

 
Rayder69:
You enter in the variable what flip in pips you are interested in throughout the history, and it gives you the longest flip in the specified number of pips, when and how long it lasted.


Error: The script cannot work on this chart.

What am I doing wrong?

 
I can't say. It works fine for me. I put it in the experts/scripts folder and everything works fine, whether it's currencies or futures.
 
it doesn't work on five digits
 
alsu:
it doesn't work on five digits

is it possible to fix it? and dare I ask to put in variables the time interval at which it looks for a flat
 
sever30:

possible to fix? and dare I ask to put in variables the time interval at which it looks for a flat
//////////////////////////////////////////////////////////////////////
//   ПОИСК САМОГО ДЛИННОГО ФЛЕТА ПО ВРЕМЕНИ      +111.mq4           //
//////////////////////////////////////////////////////////////////////
#property show_inputs  
  extern int ПУНКТЫ=300;
  extern datetime НАЧАЛО=D'2010.9.3';
  extern datetime КОНЕЦ=D'2010.1.1';
//----------Переменные для вывода данных--------------  
  int FBars,          //кол-во баров в коридоре      
      SiftBars;       //индекс бара
  double PriceMin,    //минимум коридора
         PriceMax;    //максимум коридора
//----------------------------------------------------
int init()
  {
   НАЧАЛО=iBarShift(0,0,НАЧАЛО);
   КОНЕЦ=iBarShift(0,0,КОНЕЦ);
  }
//----------------------------------------------------
int start()
  {
   int i,n,D,ST,Bar;
//----
   Alert("*********************");
   int Shift_Min=iLowest(Symbol(),0,MODE_LOW,Bars,0);     //Находим индекс минимального бара
   int Shift_Max=iHighest(Symbol(),0,MODE_HIGH,Bars,0);   //Находим индекс максимального бара
   double Min=iLow(Symbol(),0,Shift_Min);                 //Находим минимум на графике
   double Max=iHigh(Symbol(),0,Shift_Max);                //Нходим максимум на графике
   double Z=(Max-Min)/Point;             //Растояние в пунктах от минимума до максимума на всем графике
   double W=Z-ПУНКТЫ;                //Переменная W нужна для ограничения бесполезных циклов по ценам ось(Y)  
//--------------------------------------------------------   
   for (i=0;i<=W;i++)//Цикл по ценам ось(Y) 
    { 
     ST=0;                                
     for(n=НАЧАЛО;n<=КОНЕЦ&&n<Bars;n++)//Цикл по барам ось(X)
      {
       if(Low[n]>Min && High[n]<Min+ПУНКТЫ*Point)
        {
         if(ST==0)
          {
           Bar=n;
          }
         ST++;
        }else
        {
         if(FBars<ST)
          {
           FBars=ST;                   //Сохраним кол-во баров в коридоре
           PriceMin=Min;               //Сохраним минимум коридора
           PriceMax=Min+ПУНКТЫ*Point;  //Сохраним максимум коридора
           SiftBars=Bar;               //Сохраним индекс бара
           ST=0;                       //Обнуляем счетчик
          }else
          {
           ST=0;                       //Обнуляем счетчик
          }
        }
      }
     Min+=1*Point;                     //Сдвигаем коридор на один пункт вверх                   
    }
//--------------------- ВЫВОД ДАННЫХ --------------------
   ObjectDelete("q9w8e5");
   ObjectCreate("q9w8e5",OBJ_RECTANGLE,0,Time[SiftBars],PriceMin,Time[SiftBars+FBars],PriceMax);
   
   datetime Нач=Time[SiftBars+FBars];
   datetime Кон=Time[SiftBars];
   
   Alert("Самый длинны флет в ",ПУНКТЫ," пунктов был с ",TimeDay(Нач),".",TimeMonth(Нач),".",TimeYear(Нач),"   ",TimeHour(Нач),":",TimeMinute(Нач),
        "  по ",TimeDay(Кон),".",TimeMonth(Кон),".",TimeYear(Кон),"   ",TimeHour(Кон),":",TimeMinute(Кон),"    Цена :  MAX = ",PriceMax,"  MIN = ",PriceMin,
        "   Кол-во баров в коридоре = ",FBars,"       :)"); 
   
   return(0);
  }
//+------------------------------------------------------------------+
 
sever29:

If you want to use the script to evaluate the performance of avalanche-like EAs, this is only suitable for a classic avalanche with stationary channels. If non-stationary channels are used, diverging triangles are the most dangerous in this case.
 
khorosh:
If you want to use the script to evaluate the performance of avalanche-like EAs, this is only suitable for a classic avalanche with stationary channels. If non-stationary channels are used, diverging triangles are the most dangerous in this case.
Are stationary channels a channel with two parallel boundaries?