[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 174

 
tpg_k156:
Good day to all. Can you tell me how to copy trades in Metatrader 4. So that by opening a trade on one terminal you could get an open trade on another.

Look in CodeBase for a copier. Not the best of course, but they are freely available
 
Who knows, is it possible by making Hour(), Minute() and Seconds() global variables to control at midnight (0.00) the change of DailyPivotPoints indicator to new PP levels and other lines from EA? I used to do it directly in indicator with Hour(), Minute(), Seconds(), and it worked without need to compile every night. But recently it stopped changing itself, maybe from changing the bild? Thanks!
 
borilunad:
Who knows, is it possible by making Hour(), Minute() and Seconds() global variables to control at midnight (0.00) the change of DailyPivotPoints indicator to new PP levels and other lines from EA? I used to do it directly in indicator with Hour(), Minute(), Seconds(), and it worked without need to compile every night. But recently it stopped changing itself, maybe from changing the bild? Thanks!

Should work on the first tick of the new day.
 
borilunad:

Thank you, Victor! Did my short version work for you?


Yes, Boris, it's very good, by the way! Thank you very much. That's what I wanted. I twisted it... I twisted it... I didn't get it right. I haven't had much experience yet, and my brain isn't thinking like a pro. It's a bit of a dead end, isn't it? :(

I didn't want to ask at first, but I had to. Because I couldn't make it shorter myself.

 
Can you tell me how to build a channel that goes through fractals, but is limited to 0 bar and redraws further when a new bar appears. It is the limitation that is the problem.
 
beginner:
Can you tell me how to build a channel that goes through fractals, but is limited to 0 bar and redraws further when a new bar appears. It is the limitation that is the problem.

Explain the concept of "limited by 0 bar".
 

Here is the function:

bool IsUpFractal(int index)
{
   double centerHigh = High[index + g_center];     // За точку отсчета берется средний..
                                                   // ..бар на участке из i_fractalPeriod
                                                   // ..баров
// - 1 - == Поиск максимумов справа от центрального бара ================================
   int cnt = 0, i = index + g_center - 1;
   for (; i >= 0 && cnt < g_center; i--)           // Справа от центрального бара должно
   {                                               // ..быть g_center-1 баров с низшим..
      if (centerHigh <= High[i])                   // ..максимумом. Не позволяется..
         return (false);                           // ..наличие баров с большим или..
      cnt++;                                       // ..равным максимумом.
   }
   
   if (i < 0)                                      // g_center-1 низших максимумов не..
      return (false);                              // ..найдено. Фрактала нет
// - 1 - == Окончание блока =============================================================

// - 2 - == Поиск максимумов слева от центрального бара =================================
   cnt = 0;
   i = index + g_center + 1;
   int total = Bars - 1;
   for (; i < total && cnt < g_center; i++)        // Слева от центрального бара должно
   {                                               // ..быть g_center-1 баров с низшим..
      if (centerHigh == High[i])                   // ..максимумом. Не позволяется..
         continue;                                 // ..наличие баров с большим..
      if (centerHigh < High[i])                    // ..максимумом. Равный - позволяется
         return (false);
      cnt++;                                    
   }
   
   if (i >= total)                                 // g_center-1 низших максимумов не..
      return (false);                              // ..найдено. Фрактала нет
// - 2 - == Окончание блока =============================================================
                                                   
   return (true);                                  // Фрактал найден                 
}
//+-------------------------------------------------------------------------------------+
//| Определение наличия нижнего фрактала на указанном баре                              |
//+-------------------------------------------------------------------------------------+
bool IsDnFractal(int index)
{
   double centerLow = Low[index + g_center];       // За точку отсчета берется средний..
                                                   // ..бар на участке из i_fractalPeriod
                                                   // ..баров
// - 1 - == Поиск минимумов справа от центрального бара =================================
   int cnt = 0, i = index + g_center - 1;
   for (; i >= 0 && cnt < g_center; i--)           // Справа от центрального бара должно
   {                                               // ..быть g_center-1 баров с большим..
      if (centerLow >= Low[i])                     // ..минимумом. Не позволяется..
         return (false);                           // ..наличие баров с меньшим или..
      cnt++;                                       // .. равным минимумом
   }
   
   if (i < 0)                                      // g_center-1 больших минимумов не..
      return (false);                              // ..найдено. Фрактала нет
// - 1 - == Окончание блока =============================================================

// - 2 - == Поиск минимумов слева от центрального бара ==================================
   cnt = 0;
   i = index + g_center + 1;
   int total = Bars - 1;
   for (; i < total && cnt < g_center; i++)        // Слева от центрального бара должно
   {                                               // ..быть g_center-1 баров с большим..
      if (centerLow == Low[i])                     // ..минимумом. Не позволяется..
         continue;                                 // ..наличие баров с меньшим минимумом
      if (centerLow > Low[i])                      // ..Равный минимум - разрешается
         return (false);
      cnt++;   
   }
   
   if (i >= total)                                 // g_center-1 больших минимумов не..
      return (false);                              // ..найдено. Фрактала нет
// - 2 - == Окончание блока =============================================================
                                                   
   return (true);                                  // Фрактал найден                 
}

The function gets theindex value which has a bar value to calculate 0 or 1. This is where the loop is written in an interesting way..:

for (; i >= 0 && cnt < g_center; i--)

That is, there is no variable value from which to start the calculation. According to the logic of the machine, from which bar in this case the calculation will start? If there is a decrement of i-- then from the maximum?

Again there i = index + g_center - 1, but here is a point. Whatvalueof index will come herefirst? Maximum or minimum?

 
hoz:

I.e. there is no variable value from which to start the calculation. According to the logic of the machine, from which bar will the calculation start? If there is a decrement of i-- is it the maximum?


No, from the value that variable i had before the cycle. The entry

   int cnt = 0, i = index + g_center - 1;
   for (; i >= 0 && cnt < g_center; i--)

is identical to

   int cnt,i;
   for (cnt = 0, i = index + g_center - 1; i >= 0 && cnt < g_center; i--)
 
In other words, the first expression in the for loop can be written either in its place or before the loop, and the result is the same.
 
hoz:

Again, i = index + g_center - 1, but here is the point. What is thefirst value ofindex that comes here? Maximum or minimum?


The index will be the value passed to the function as a parameter.
Reason: