[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 264

 

Please tell me how to assign the time to the indicator line val1[]. Or tell me how to do it and what to use because I can't figure it out. Laguerre indicator.

i=CountBars-1;
   while(i>=0)
   {
      L0A = L0;
      L1A = L1;
      L2A = L2;
      L3A = L3;
      L0 = (1 - gamma)*Close[i] + gamma*L0A;
      L1 = - gamma *L0 + L0A + gamma *L1A;
      L2 = - gamma *L1 + L1A + gamma *L2A;
      L3 = - gamma *L2 + L2A + gamma *L3A;

      CU = 0;
      CD = 0;
      
      if (L0 >= L1) CU = L0 - L1; else CD = L1 - L0;
      if (L1 >= L2) CU = CU + L1 - L2; else CD = CD + L2 - L1;
      if (L2 >= L3) CU = CU + L2 - L3; else CD = CD + L3 - L2;

      if (CU + CD != 0) LRSI = CU / (CU + CD);
      val1[i] = LRSI;
          i--;
        }
         

   if(counted_bars>0)
      counted_bars--;
   
   limit=Bars-counted_bars;
   
   if(limit>CountBars)
      limit=CountBars;
  
   for(int c=1;c<limit;c++)
        
{if(val1[c]>0.45)
  // присваиваем время;}

For example, when line val1[c] crosses 0.45 upwards time value is set in variable TimeBegin and when it crosses downwards time value is set in variable TimeEnd. And so on through the entire chart.

The idea is that when the line crosses 0.45 up and after it crosses 0.45 down, for this period, count points in the chart (How many points has the indicator maximal given for this signal). I hope I was able to explain.

Files:
 
VeyRON123:
Is there any way to disconnect MT4 itself from the internet without turning off the internet on your computer?
hrenfx 20.03.2011 16:18

Disconnect from your broker via the "proxy" checkbox in the terminal settings. One move and you're either offline or online.

 
Hello, could you please tell me why the standard OrderSend function doesn't work ? Just taking the source code from the tutorial on this site, but nothing happens. When I added error output, it showed 4109 - uninitialized string in an array...
 
Thanks for the tips, I'll look into it...
 
Golden-dark:
Hello, could you please tell me why the standard OrderSend function doesn't work ? Just taking the source code from the tutorial on this site, but nothing happens. When I added error output, it showed 4109 - uninitialized string in an array...
show me the full code
 

Greetings comrades!

Can you please tell me what could be the error in the following code:

//+------------------------------------------------------------------+
//|                                                         BB_k.mq4 |
//|                                                     |
//|                                                          no link |
//+------------------------------------------------------------------+
#property copyright "123"
#property link      "no link"

#property indicator_separate_window
#property indicator_buffers 1

#property indicator_color1 MediumSpringGreen

#property indicator_width1 1

double   buf_0[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

   SetIndexBuffer (0, buf_0);
   SetIndexStyle (0, DRAW_LINE);
   SetIndexLabel (0, "Koefficient");
   SetIndexShift (0, 0);

   return;
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i;
   int    counted_bars=IndicatorCounted();
//----
   i = Bars - counted_bars - 1;
   
   while (i>=0)
   {
      double x1 = iBands(NULL, 0, 20, 2, 0, PRICE_LOW, 1, i); //Верхняя полоса
      double x2 = iBands(NULL, 0, 20, 2, 0, PRICE_LOW, 2, i); //Нижняя полоса
   
      buf_0[i] = x1 / x2;
      i--;
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

And the gist is this: I want an indicator that displays a line of values dividing the upper Bollinger Band by the lower Bollinger Band.

But there is no result.

The indicator window is empty:

Thanks in advance if anyone can help!

 
ramirez17:

Greetings comrades!

Can you please tell me what could be the error in the following code:

And the gist is this: I want an indicator that displays a line of values dividing the upper Bollinger Band by the lower Bollinger Band.

But there is no result.

The indicator window is empty:

Thanks in advance if anyone can help!

buf_0[i] = x1 / x2;

you have x2=0 on the leftmost bars. And dividing by zero is not a good thing...

 
ilunga:

you have x2=0 on the leftmost bars. And dividing by zero is not a good thing...


What, for example, can you do to prevent this?
 
ramirez17:

What, for example, can you do to prevent this?
if (x2 == 0) buf_0[i] = 0;
else buf_0[i] = x1 / x2;
It is better to prevent this from happening at all.
 
Can you give me a hint? There are two conditions, for buy and for sell. After catching a false signal to sell, for example to buy, expert advisor starts to open the next position again by this false signal and again catches a fake one. How should I make my EA wait for the signal to the opposite direction after the loss and not open by the false signal again? Thank you!
Reason: