[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 373

 
sv.:

strange.
checked, it shows everything.
maybe the chart needs to be compressed vertically, if the channel is wide, it may not be visible when zoomed in.

Something came up after adjusting the parameters. Only a very narrow range fits the EA's conditions. A step to the left, a step to the right - nothing. And these conditions do not fit the definition of a flat. I am getting a flat at 100 points in 4 digits. And everything is shown accurately.

//+------------------------------------------------------------------+
//|                                           ind_FletChannel_07.mq4 |
//|                                            Copyright © 2013, sv. |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2013, sv."
#property link      "7009731@mail.ru"
//----
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 Red
#property indicator_width1 3
#property indicator_width2 3
#property indicator_width3 3
#property indicator_width4 3
//----
extern int    Distans     = 20;      // Количество баров для определения канала
extern int    Channel     = 1000;     // Размер в пипсах канала
extern int    ZoneUnSence = 80;      // Размер выхода за границы канала, в пипсах
extern int    PauseBar    = 1;       // А это по ходу дела - смещение баров,т.е. где нужно считать.
//----
double Up[];
double Down[];
double UpSupport[];
double DownResistance[];

double pnt;
double high,   low;
double high_1 = 0,
       low_1  = 0;
bool   up_chanel, dn_chanel, FirstChanel;
bool   DrawChannel = false;
int    limit,  History=0;        // 0- все бары
int    n=0, n_up=0, n_dn=0;
int    Bar;

//+------------------------------------------------------------------+
int init() 
  {
//----
 //  pnt=Point;
 //  if(Digits==5 || Digits==3) pnt*=10;
   
 //  IndicatorDigits(Digits);
 //  IndicatorBuffers(4);
//----      
   SetIndexBuffer(0,Up);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexEmptyValue(0,0.0);

   SetIndexBuffer(1,Down);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexEmptyValue(1,0.0);
   
   SetIndexBuffer(2,UpSupport);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexEmptyValue(2,0.0);

   SetIndexBuffer(3,DownResistance);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexEmptyValue(3,0.0);
//----      
   return(0);
  }
//+------------------------------------------------------------------+
int start() 
  { 
   limit = Bars-IndicatorCounted()-1; 
   if(limit > 1)                    limit = Bars-1;
   if(History!=0 && limit>History)  limit = History-1;                   // кол-во пересчетов по истории

   Bar = limit;
   
   // ------------------------------------------------------------------
   for(int i=limit; i>=0; i--) 
     {
      if(i < Bar-PauseBar)
       {
        // если не активна отрисовка канала, ищем канал.
        if(DrawChannel==false)
         {
          // отределяется минимум и максимум на заданном интервале Distans
          double low  = iLow (NULL,0,iLowest (NULL,0,MODE_LOW, Distans,i));
          double high = iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,Distans,i));
          
          // и если разность между максимумом и минимумом меньше заданной ширины канала Channel
          if( (high-low) < Channel*Point )  DrawChannel=true;
         }  
       }
      // ------------------------------------------------------------------
      if(DrawChannel)
       {  
        // определяются границы канала как максимум и минимум на интервале Distans
        
        // отрисовка первоначального отправного канала
        if(FirstChanel) { Up[i]   = high;   Down[i] = low;  }
        if(up_chanel)   { Up[i]   = high;   UpSupport[i]      = high - Channel*Point; }   // отрисовка канала тренда вверх
        if(dn_chanel)   { Down[i] = low;    DownResistance[i] = low  + Channel*Point; }   // отрисовка канала тренда вниз
        
        // определяются границы отправного первоначального канала
        // ------------------------------------------------------------------
        if( high_1==0 && low_1==0 )    
         {
          FirstChanel=true;  high_1=high;  low_1=low; 
         }
        else                     // если первоначальный отправной канал уже определён и отрисован
         { 
          if(high > high_1)      // если верхняя граница нового канала выше верхней границы предыдущего канала, то это восходящий тренд
           {
            up_chanel=true;      // активируем флаг отрисовки канала тренда вверх
            high_1 = high;       // и перезаписываем значение
            low_1  = low;
           }
        
          if(low < low_1)        // если нижняя граница нового канала ниже нижней границы предыдущего канала, то это нисходящий тренд
           {
            dn_chanel=true;      // активируем флаг отрисовки канала тренда вниз
            high_1=high;         // и перезаписываем значение
            low_1=low;
           }
         }  
        // ------------------------------------------------------------------
        
        if(Up[i]!=0 && UpSupport[i]!=0)        // пока условие выполняется, границы канала не изменяются
         {
          if ((Close[i] > Up[i]        + ZoneUnSence*Point) ||
              (Close[i] < UpSupport[i] - ZoneUnSence*Point))
           {
            // если условие не выполняется, флаг сбрасывается - Т.е. если не в границах канала
            up_chanel=false;
            dn_chanel=false;
            FirstChanel=false; 
            DrawChannel=false;
           }
         } 
        // ------------------------------------------------------------------
        if(Down[i]!=0 && DownResistance[i]!=0)
         {
          if ((Close[i] > DownResistance[i]+ZoneUnSence*Point) ||
              (Close[i] < Down[i]-ZoneUnSence*Point))
           {
            // если условие не выполняется, флаг сбрасывается - Т.е. если не в границах канала
            up_chanel=false;
            dn_chanel=false;
            FirstChanel=false;
            DrawChannel=false;
           }
         }
        if(Up[i]!=0 && Down[i]!=0)
         {
          if ((Close[i] > Up[i]   + ZoneUnSence*Point) ||
              (Close[i] < Down[i] - ZoneUnSence*Point))
           {
            // если условие не выполняется, флаг сбрасывается
            up_chanel=false;
            dn_chanel=false;
            FirstChanel=false; 
            DrawChannel=false;
           }
         }    
        Bar = i; 
       }    
     } 
   // Конец перебора
   // ------------------------------------------------------------------
   return(0);
  }
//+------------------------------------------------------------------+

I altered it a bit - I tried to understand it. But it works that way. I used H1. It is bad that I failed to show it on other TFs due to parameter selection. For example, on 5 and 15 minutes. - One could suggest that it would be possible to achieve a flat using those TFs. (If someone with a more experienced viewpoint gives some ideas or points out the errors).

I have not noticed any problems with the rendering.

In your indicator, as in the vast majority, what is drawn is what it used to be; that's normal for the indicator writing template. But what is going on now (as you said - on the current bar) do not get into conditions of this indicator. Therefore, there is no problem at the current bar.

 
Chiripaha:

Something came up after adjusting the parameters. Only a very narrow range fits the EA's conditions. A step to the left, a step to the right - nothing. And these conditions do not fit the definition of a flat. I am getting a flat at 100 points in 4 digits. Everything is drawn clearly.

I may have altered it a bit - I tried to understand it. But it works that way. I used H1. It is bad that I failed to show it on other TFs through parameter selection. For example, on 5 and 15 minutes. - One could suggest that it would be possible to achieve a flat using those TFs. (If someone with a more experienced viewpoint gives some ideas or points out the errors).

I did not notice any problems with drawing.

What you have in this indicator, as well as the vast majority, is rendering what was once; which for the indicator writing template is normal. But what is going on now (as you said - on the current bar) does not fit into this indicator's conditions. Therefore, there is no problem on the current bar.


ParameterPauseBar is the minimum distance separating one channel from another, in your edition this parameter should be greater than 5, then it is drawn at different other parameters.
But the problem with rendering with new bars remains.

 
sv.:


The parameterPauseBar is the minimum distance separating one channel from another, in your version this parameter should be greater than 5, then it is drawn with different other parameters.
But the problem with rendering with the arrival of new bars remained.

To be honest, I don't understand the logic of your indicator's work (though I do understand its essence). But...

Look - the problem lies exactly in this block:

        if(FirstChanel) { Up[i]   = high;   Down[i] = low;  }                             // отрисовка первоначального отправного канала
        if(up_chanel)   { Up[i]   = high;   UpSupport[i]      = high - Channel*Point; }   // отрисовка канала тренда вверх
        if(dn_chanel)   { Down[i] = low;    DownResistance[i] = low  + Channel*Point; }   // отрисовка канала тренда вниз

At some point values are not written to buffers and therefore they are assigned a value of "zero". Hence the sticks down - to zero. How to build logic and what to add - I can't understand. But the data is not written obviously because you have flags, including the parameter

DrawChannel=false;

Therefore, the values don't get to be assigned to the buffers. - You need to play around with this somehow.

 
Chiripaha:

I can't be more specific yet - To be honest, I don't understand the logic of your indicator (although I do understand it). But...

Look - the problem lies exactly in this block:

At some point values are not written to buffers and therefore they are assigned a value of "zero". Hence the sticks down - to zero. How to build logic and what to add - I can't understand. But the data is not written obviously because you have flags, including the parameter

Therefore, the values don't get to be assigned to the buffers. - You need to play around with this somehow.


I see, so it's a matter of logic. I'll think about it.
Thank you for your help.

P.S.
Check if everything is rendered well on your history with increasing PauseBar parameter with another set of other parameters, or is there a problem with it too?

 
how do I view and display the extended ascicode table symbol?
 
sv.:


I see, so it's a matter of logic. I'll keep thinking.
Thank you for your help.

P.S.
Do you at least check if everything is displayed correctly on your history when increasing the PauseBar parameter with a different set of other parameters, or is there a problem with it too?

I checked with increasing PauseBar and got these sticks at 1 and 5 min. But I can't figure out how to bypass them correctly. I understand that you need to write probably (but not obviously) if the value

DrawChannel=false;

в

if(dn_chanel)   { Down[i] = low;    DownResistance[i] = low  + Channel*Point; }   // отрисовка канала тренда вниз

the value of the previous bars - something like this:

if(dn_chanel)   { Down[i] = Down[i+1];    DownResistance[i] = DownResistance[i+1]; }   // отрисовка канала тренда вниз
But when I try to do it, my whole indicator "moves" - because I don't understand the logic and I don't understand where to put it and under what conditions.
 
zfs:
how do I view and display the extended ascicode table character?

This is called ANSI.

The script is attached.

Files:
ansi.mq4  2 kb
 
For the first time on the forum, I decided to ask a question that interests me - is it possible to make changes in the terminal to insert my comment (1 or more times) when a position is already open? not immediately when you open a comment. but when you have already opened it - so that the current comment appears?
 
Please advise how to solve the problem: The same EA is on several charts, a signal to open an order appears on two charts at the same time, for example. However, we need the second order not to open. The EA has a check for an open order but it does not help because the first EA has probably open an order and the second one also sends a request to open an order. Are there any possible solutions?
 
Twoberg:
For the first time on the forum, I decided to ask a question that interests me - is it possible to make such changes in the terminal to insert my comment (1 or more times) on an open position already? not immediately when you open a comment. but when you have already opened it - so that the current comment appears?

No

Reason: