Methods of identifying a flat and a trend. - page 11

 
Алексей Тарабанов:

In any terminal. But, if you are looking at days, you need to look at weeks.

I'm not sure I understood exactly what you meant.

 
Me too.
 
Artem Likhachev:
There is not a trend or a flat at the moment, there is only the market condition taken from the relationship of tops and bottoms in a certain quantity and from the relationship to each other. Only history gives us the definition of a flat or trend.

I don't agree with you about this. Here's a suggestion: if someone can tweak this indicator a bit, here's the scenario:

There are only 2 basic positions in this indicator - up (green) and down (red) and rarely there is white. So it is necessary to adjust the indicator so that when the price is without motion, the colour white and it's starting 1 minute chart, and ending 4-hour, is the average motion - the colour yellow, is a strong movement of the colour green (up) and the colour red (down). From the daily chart to the monthly chart, the direction is simply the same. But we can use the following option for these timeframes: if the price is below the middle bar - colour red, above - green, even (50x50) - blue. Then it will be possible to judge what is the state of the market. The indicator is attached.

Files:
 
There is no trend at all and no flat at all. There is a trend on a horizon of 1 month or 1 day and a flat on approximately the same horizon. Note - the horizons, not to be confused with timeframes - they can be any, but smaller than the horizon. [Kotelnikov].
 
Алексей Тарабанов:
There is no trend at all and no flat at all. There's a trend on a horizon of 1 month, or 1 day, and a flat on the same horizon. Note - the horizons, not to be confused with timeframes - they can be any, but smaller than the horizon. [Kotelnikov].

You probably still don't understand what I wrote, read it carefully, I didn't write about any horizons, I wrote about real time.

 

However, what needs to be tweaked in the code to have the following:

There are only 2 main positions in this indicator - up (green) and down (red) and rarely there is white. So it is necessary to adjust the indicator so that when the price is without motion, the colour white and it's starting 1 minute chart, and ending 4-hour, is the average motion - the colour yellow, is a strong movement of the colour green (up) and the colour red (down). From the daily chart to the monthly chart, the direction is simply the same. But we can use the following option for these timeframes: if the price is below the middle bar - colour red, above - green, even (50x50) - blue. Then it will be possible to judge what is the state of the market, to make a specific analysis.

//+------------------------------------------------------------------+
//|                                           All against all.v4 mg4 |                   
//|                                                  vorese          |
//|                                              vorese@yandex.ru    |
//+------------------------------------------------------------------+
#property indicator_chart_window
extern string symbol="EUR";// любая валюта
extern string note="Period_(0,M1,M5,M15,M30,H1,H4,D1,W1,MN)";
extern string period_="0";//M1,M5,M15,M30,H1,H4,D1,W1,MN . Если 0- период текущего графика.
extern int X_DISTANCE=0; // располож. по горизонтали
extern int Y_DISTANCE=0; // располож. по вертикали
extern color border_color=Black; // цвет рамки 
extern color text_color=Black; // цвет верхней строки 
extern color CurrCol_up=Aqua; // цвет обозн.валюты и % растущего бара 
extern color CurrCol_down=Gold; // цвет обозн.валюты и % падающего бара
extern bool colorRB_RG=false;  //цвет гистограммы. true- красный синий.false- красный зеленый.
extern bool invertColGist=true;//инверт. цвета гистограммы
extern bool brightness_gradation=false;//градации яркости
//========используемые вал.пары =======================================
// можно удалять и добавлять любые валютные пары , в любой последовательности .
// В  currency_pair[] и в  count_curr должно быть указано 
// кол-во имеющихся в массиве валютных пар. 
string currency_pair[6]= {"EURUSD","GBPUSD","EURGBP","GBPCHF","EURCHF","USDCHF"};
int count_curr=6; // количество вал.пар 
//=====================================================================
string mas_pair[7]; 
int mas_flags [7]; 
string mas_currency[7]; 
int total; 
//---------------------------------------------------------------------   
int line_x[5]={3,13,23,67,80};// координаты горизонт.линий
int TF;
color color_currency,col_00;
//=====================================================================
int init()
  {
//--------------валютные пары------------------------------------------ 
    for(int i=0;i<count_curr;i++)
     { 
            if(StringSubstr(currency_pair[i],0,3)==symbol) 
                { mas_pair[total]=currency_pair[i];
                    mas_flags[total]=(-1);
                      mas_currency[total]=StringSubstr(currency_pair[i],3,0);
                        total+=1;    }
           if(StringSubstr(currency_pair[i],3,0)==symbol) 
                { mas_pair[total]=currency_pair[i];
                    mas_flags[total]=1;
                      mas_currency[total]=StringSubstr(currency_pair[i],0,3); 
                        total+=1;    }    
                                         }
 //--------------- период --------------------------------------------
      if(period_=="M1")TF=1;
   else {
      if(period_=="M5")TF=5;
   else {
     if(period_=="M15")TF=15;
   else {
     if(period_=="M30")TF=30;
   else {
     if(period_=="H1")TF=60;
   else {
     if(period_=="H4")TF=240;
   else {
     if(period_=="D1")TF=1440;
   else {
     if(period_=="W1")TF=10080;
   else {
     if(period_=="MN")TF=43200;
   else {
     if(period_=="0")TF=0;
   else {  Alert("Ошибка установки периода:  "+period_);
                     }}}}}}}}}}
 //-------------------------------------------------------------------  
   // создать горизонт. линии
  for(int x=0;x<5;x++)  {
  if(x!=3)col_00=border_color;
  else
       col_00=text_color;
   ObjectCreate(symbol+"line-x"+x+period_, OBJ_LABEL, 0, 0, 0);
   ObjectSet(symbol+"line-x"+x+period_, OBJPROP_CORNER, 3);
   ObjectSet(symbol+"line-x"+x+period_, OBJPROP_XDISTANCE,X_DISTANCE+7);
   ObjectSet(symbol+"line-x"+x+period_, OBJPROP_YDISTANCE, Y_DISTANCE+line_x[x]);
   ObjectSetText(symbol+"line-x"+x+period_,"_________________",7,"Verdana",col_00); 
                     }
 //---------------------------------------------------------------------
   // создать вертикал. линии
   int c,y,r;
      for(c=0;c<2;c++) {
        if(c==1)r=103;
      for( y=0;y<4;y++)  {
   ObjectCreate(y+symbol+"line-y"+c+period_, OBJ_LABEL, 0, 0, 0);
   ObjectSet(y+symbol+"line-y"+c+period_, OBJPROP_CORNER, 3);
   ObjectSet(y+symbol+"line-y"+c+period_, OBJPROP_XDISTANCE,X_DISTANCE+1+r);
   ObjectSet(y+symbol+"line-y"+c+period_, OBJPROP_YDISTANCE, Y_DISTANCE+3+y*19);
   ObjectSetText(y+symbol+"line-y"+c+period_,"|",16,"Verdana",border_color); }
                     } 
  //--------------------------------------------------------------------- 
  // текст                     
   ObjectCreate(symbol+"text"+period_, OBJ_LABEL, 0, 0, 0);
   ObjectSet(symbol+"text"+period_, OBJPROP_CORNER, 3);
   ObjectSet(symbol+"text"+period_, OBJPROP_XDISTANCE,X_DISTANCE+38);
   ObjectSet(symbol+"text"+period_, OBJPROP_YDISTANCE, Y_DISTANCE+68); 
   ObjectSetText(symbol+"text"+period_,symbol+"_"+period_,7,"Verdana",text_color);                                                          
   return(0);
  }                               
//=======================================================================
int deinit()
  { 
    int n,m;
      for( n=0;n<7;n++)  // удалить все об'екты 
     {  
       ObjectDelete(symbol+"perc"+n+period_);
       ObjectDelete(symbol+"curr"+n+period_);
       if(n<5) ObjectDelete(symbol+"line-x"+n+period_);  
  //------       
      for( m=0;m<=20;m++)
     {
       ObjectDelete(m+symbol+"gist"+n+period_);
       if(m<2 && n<4) ObjectDelete(n+symbol+"line-y"+m+period_);
                               } } 
       ObjectDelete(symbol+"text"+period_);                        
   return(0);
  }
//======================================================================
int start()
  {
  int i,w,z;
  double percent,bid,open,high,low; 
  int flag,count;  
  for( z=0;z<total;z++)  
    { 
      for( w=0;w<=20;w++) {
       ObjectDelete(w+symbol+"gist"+z+period_); //удалить гистограмму перед обновлением
                              }  
   percent=0; 
   flag=0;
   count=0;           
//---------------------------------------------------------------------
     // обновить данные
    RefreshRates();
    bid=MarketInfo(mas_pair[z], MODE_BID );
    open=iOpen(mas_pair[z],TF,0);
    high=iHigh(mas_pair[z],TF,0);
    low=iLow(mas_pair[z],TF,0);   
//---------------------------------------------------------------------  
    // расчет процентов
   if(bid>open && high!=open && bid>0)   
       { percent=(bid-open)/(high-open)*100; // проц.растущего бара
         flag=1;
         count=NormalizeDouble(percent/5,0); }
       else {
         if(bid<open && low!=open && bid>0)
       { percent=(open-bid)/(open-low)*100; // проц.падающего бара
         flag=(-1);  
         count=NormalizeDouble(percent/5,0); } }
//-------------------------------------------------------------------- 
         // при переключении ТФ//
    if(percent>100)percent=100; 
    if(count>20)count=20; 
 //-------------------------------------------------------------------     
         // инверт.цвета гистограммы
   if(invertColGist) flag=flag*mas_flags[z]*(-1);  
      else
         flag=flag*mas_flags[z];   
//-------------------------------------------------------------------- 
     //-- цвет валюты и процентов
  if(flag==1)color_currency=CurrCol_up;
    else {
    if(flag==(-1))color_currency=CurrCol_down;
    else {
          color_currency=text_color;  }}
//--------------------------------------------------------------------
 if(bid>0)  {           //если вал. пара есть в терминале
  // проценты     
   ObjectCreate(symbol+"perc"+z+period_, OBJ_LABEL, 0, 0, 0);
   ObjectSet(symbol+"perc"+z+period_, OBJPROP_CORNER, 3);
   ObjectSet(symbol+"perc"+z+period_, OBJPROP_XDISTANCE,X_DISTANCE+94-z*14);
   ObjectSet(symbol+"perc"+z+period_, OBJPROP_YDISTANCE, Y_DISTANCE+15);
   ObjectSetText(symbol+"perc"+z+period_,DoubleToStr(percent,0),5,"Verdana",color_currency); 
                   }
//-------------------------------------------------------------------- 
  // валюта   
   ObjectCreate(symbol+"curr"+z+period_, OBJ_LABEL, 0, 0, 0);
   ObjectSet(symbol+"curr"+z+period_, OBJPROP_CORNER, 3);
   ObjectSet(symbol+"curr"+z+period_, OBJPROP_XDISTANCE,X_DISTANCE+94-z*14);
   ObjectSet(symbol+"curr"+z+period_, OBJPROP_YDISTANCE, Y_DISTANCE+5);
   ObjectSetText(symbol+"curr"+z+period_,mas_currency[z],4,"Verdana",color_currency);        
//--------------------------------------------------------------------- 
  // гистограмма 
     for( i=0;i<=count;i++) {  
   ObjectCreate(i+symbol+"gist"+z+period_, OBJ_LABEL, 0, 0, 0);
   ObjectSet(i+symbol+"gist"+z+period_, OBJPROP_CORNER, 3);
   ObjectSet(i+symbol+"gist"+z+period_, OBJPROP_XDISTANCE,X_DISTANCE+91-z*14);
   ObjectSet(i+symbol+"gist"+z+period_, OBJPROP_YDISTANCE, Y_DISTANCE+3+i*2);
   ObjectSetText(i+symbol+"gist"+z+period_,"-",30,"Verdana",f_Color(i,flag));  
                       } }  
//---------------------------------------------------------------------                     
   return(0);
  }
//=====================================================================

//============ цвет синий красный зеленый==============================      
color f_Color (int num,int flag) 
{   color col_R,col_B,col,col_G;
if(!brightness_gradation ) {
 if(flag==1 && colorRB_RG)col=Blue;
     else {
      if(flag==1 && !colorRB_RG)col=Lime;
       else {
        if(flag==(-1)) col=Red; 
         else {
           col=text_color;  }}}  }
     else {      
  switch(num) 
  { case 0: col_B=C'0,0,255';col_R=C'255,0,0';col_G=C'0,90,0';break; 
    case 1: col_B=C'0,10,255';col_R=C'255,10,0';col_G=C'0,100,0';break; 
    case 2: col_B=C'0,20,255';col_R=C'255,20,0';col_G=C'0,110,0';break; 
    case 3: col_B=C'0,30,255';col_R=C'255,30,0';col_G=C'0,120,0';break; 
    case 4: col_B=C'0,40,255';col_R=C'255,40,0';col_G=C'0,130,0';break; 
    case 5: col_B=C'0,50,255';col_R=C'255,50,0';col_G=C'0,140,0';break; 
    case 6: col_B=C'0,60,255';col_R=C'255,60,0';col_G=C'0,150,0';break; 
    case 7: col_B=C'0,70,255';col_R=C'255,70,0';col_G=C'0,155,0';break; 
    case 8: col_B=C'0,80,255';col_R=C'255,80,0';col_G=C'0,160,0';break; 
    case 9: col_B=C'0,90,255';col_R=C'255,90,0';col_G=C'0,165,0';break; 
    case 10: col_B=C'0,100,255';col_R=C'255,100,0';col_G=C'0,170,0';break; 
    case 11: col_B=C'0,110,255';col_R=C'255,110,0';col_G=C'0,175,0';break; 
    case 12: col_B=C'0,120,255';col_R=C'255,120,0';col_G=C'0,180,0';break; 
    case 13: col_B=C'0,130,255';col_R=C'255,130,0';col_G=C'0,185,0';break; 
    case 14: col_B=C'0,140,255';col_R=C'255,140,0';col_G=C'0,190,0';break; 
    case 15: col_B=C'0,150,255';col_R=C'255,150,0';col_G=C'0,195,0';break; 
    case 16: col_B=C'0,160,255';col_R=C'255,160,0';col_G=C'0,200,0';break; 
    case 17: col_B=C'0,170,255';col_R=C'255,170,0';col_G=C'0,205,0';break; 
    case 18: col_B=C'0,180,255';col_R=C'255,180,0';col_G=C'0,210,0';break; 
    case 19: col_B=C'0,190,255';col_R=C'255,190,0';col_G=C'0,215,0';break; 
    case 20: col_B=C'0,200,255';col_R=C'255,200,0';col_G=C'0,220,0';break; 
   
    } 
    if(flag==1 && colorRB_RG)col=col_B;
     else {
      if(flag==1 && !colorRB_RG)col=col_G;
       else {
        if(flag==(-1)) col=col_R; 
         else {
           col=text_color;  }}}  }
  return(col); }  
 //------------------------------------------------------------------------ 
 

I haven't understood what amount of time is taken by a flat and a trend to mean that price is moving?
a wave is also a micro-trend back and forth.

It all seems to be individual. some traders will have a flat and a trend, while others will have trends )

 
Eugene Bufetchikov:

I haven't understood what amount of time is taken by a flat and a trend to mean that price is moving?
a wave is also a micro-trend back and forth.

It all seems to be individual. some people will have a flat and a trend, while others will have trends )

At the moment I'm not proving anything to anyone, just asking to tweak the indicator as I described above. And then after that I will post my opinion and a detailed analysis with pictures.

 
Алексей Тарабанов:
There is no trend at all and there is no flat. There is a trend on a horizon of 1 month or 1 day and a flat on the same horizon. Note - exactly on the horizon, not to confuse with timeframes - they can be any, but smaller than the horizon. [Kotelnikov]

Interesting theory, correct to some extent, but everyone is looking for the definition of movement...

bar Vladimir:

At the moment I'm not proving anything to anyone, just asking to tweak the indicator as I described above. And then after that I will post my opinion and detailed analysis with pictures.

I don't really understand the code, but in my opinion, I should just tweak colour change levels, give a wider corridor for the average value, change the percentage calculation

 
ElenaVVT:

Interesting theory, to some extent correct, but everyone is looking for the definition of movement...

I don't really understand the code, but I think you just need to tweak the levels of colour change, give a larger corridor for the average value, change the percentage calculation

Haven't I already explained it all clearly? Everything will look fine! You cannot look into the future in this market! Only real time! The news only goes on the stops, weathering your money!

Reason: