Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1366

 

Does it really come down to this?

//+------------------------------------------------------------------+
//| Получим High для заданного номера бара                           |
//+------------------------------------------------------------------+
double CNewBar::iHighMax(int ot,int bands)
  {
   double result=-1;
   for(i=ot; i<bands; i++)
      if(m_ExtLowerBuffer[i]!=EMPTY_VALUE)
         if(m_ExtLowerBuffer[i]>result)
            result=lh;
   return(result);
  }

It's kind of custom, isn't it?

 
Mikhail Toptunov #:

Does it really come down to this?

It's kind of custom, isn't it?

EMPTY_VALUE

this is the maximum value of double, there is nothing higher

 
Alexey Viktorov #:

The way I understand it, you need to find the maximum indicator value that never equals zero.

I hate NULL and always apply 0.0 in numerical values which never fails.

I think it will load the system and EMPTY_VALUE and NULL will not weigh much. I don't know what I'm thinking!

 
Alexey Viktorov #:

The way I understand it, you need to find the maximum indicator value that never equals zero.

I can't stand NULL and always apply 0.0 in numerical values which will never fail.


I need to look for both maximum and minimum if I do zero, then I won't find the minimum value!!!

 
Aliaksandr Hryshyn #:

this is the maximum value of type double, there is nothing higher

i.e. how do i designate a variable in an array to be empty so that it weighs the least?

 
Aliaksandr Hryshyn #:

this is the maximum value of type double, there is nothing higher

If NULL, would it be easier?

 

Anyway done so, thanks for the tips , kudos to you mountain dwellers)))

//+------------------------------------------------------------------+
//| Получим Lowest для заданного промежутка                          |
//+------------------------------------------------------------------+
double CNewBar::iLowMin(int ot,int bands)
  {
   double result=EMPTY_VALUE;
    for(int i=ot; i<ot+bands; i++)
      if(m_ExtLowerBuffer[i]!=NULL)
         if(m_ExtLowerBuffer[i]<result)
            result=m_ExtLowerBuffer[i];
   return(result);
  }
//+------------------------------------------------------------------+
//| Получим High для заданного номера бара                           |
//+------------------------------------------------------------------+
double CNewBar::iHighMax(int ot,int bands)
  {
   double result=NULL;
   for(int i=ot; i<ot+bands; i++)
      if(m_ExtUpperBuffer[i]!=NULL)
         if(m_ExtUpperBuffer[i]>result)
            result=m_ExtUpperBuffer[i];
   return(result);
  }

If there is a simpler option, very interesting which one for the system

 

Help, can someone help!

How do I brute force an array to go through

1) on the diagonal

2) within the range of (0).


I've been trying these algorithms, but I can't get anywhere.

void OnStart()
{
   for( int k = 0; k < ARRAY_SIZE_X; k++ ){
      for( int x = k, y = 0; x >= 0 && y < ARRAY_SIZE_Y; x--, y++ ){
         Print( "y = ", y, ", x = ", x );
         if( array[y][x] > 0 )
         {
         }
      }
   }
   for( int k = 1; k < ARRAY_SIZE_Y; k++ ){
      for( int x = ARRAY_SIZE_X-1, y = k; x >= 0 && y < ARRAY_SIZE_Y; x--, y++ ){
         Print( "y = ", y, ", x = ", x );
         if( array[y][x] > 0 )
         {
         }
      }
   }
}
 
Mikhail Toptunov #:

Help, can someone help!

How to brute force an array to go through

1) on the diagonal

2) within the range of (0).


I'm trying these algorithms, but I can't find it.

If on the diagonal, one loop is enough. Or maybe I've got the question wrong.

Maybe you need it

/********************Script program start function*******************/
void OnStart()
 {
  int array[5][3];
  for(int k = 0; k < ArrayRange(array, 0); k++)
   {
    for(int x = 0; x < ArrayRange(array, 1); x++)
     {
      if(k+x >= ArrayRange(array, 0))
        break;
      Print("array[", k+x, "][", x, "]", array[k+x][x]);
     }
   }
 }/******************************************************************/
/*****************************End program****************************/
But it's a rough draft...
 
Alexey Viktorov #:

If diagonally, one cycle is enough. Or maybe I misunderstood the question.

Maybe this is what you need.

but it's a draft...

Hm, that's a cool solution. I got this one, I need to rearrange it. I'm still trying to figure out how to do it.


Reason: