help with indicator handler array - page 2

 
SpikesHardy # :
 Please not just the current fractal but based on my analysis, i may need the 4th lower fractal or the 10th upper fractal or any fractal with a range between the current and the 20th fractals. i want to be able to change the fractal index in the alert function to any number between 0 and 20 e.g  at anytime within the code.  ALL I NEED IS A CODE THAT WOULD COUNT THE LOWER AND UPPER FRACTALS BACKWARDS TO THE 20TH AND ASSIGN THEM TO AN ARRAY. i hope you'd understand my illustration .THANK YOU

Yes, now I get it. You need:

  • enter two variables of the 'datetime' type - in these variables you will store the time of the N-th fractal (for example, the time of the UP fractal number 5 and the time of the DOWN fractal number 5).
  • use third form CopyBuffer

int  CopyBuffer( 
   int       indicator_handle,     // indicator handle 
   int       buffer_num,           // indicator buffer number 
   datetime  start_time,           // start date and time 
   datetime  stop_time,            // end date and time 
   double    buffer[]              // target array to copy 
   );
 
Vladimir Karputov #:

Yes, now I get it. You need:

  • enter two variables of the 'datetime' type - in these variables you will store the time of the N-th fractal (for example, the time of the UP fractal number 5 and the time of the DOWN fractal number 5).
  • use third form CopyBuffer

ok thank you. i will correct that and give you feedback. Much grateful

 
Hi!

I am trying too get into my array the fractals values, without zeros (like last lower fractal is the 0 in the array, 2. last is in 1 in the array....)

How is that? I don't get it.
 
atesz5870 #: I am trying too get into my array the fractals values, without zeros (like last lower fractal is the 0 in the array, 2. last is in 1 in the array....)

How is that? I don't get it.

Read the indicator buffer, remove the zeros.

   int len = copyBuffer(…, buffer);
   len = remove(buffer, 0, len, 0);
///////////////////////
#define INDEX uint
template<typename T>
INDEX      remove(T& arr[], INDEX iBeg, INDEX iEnd, const T& value){
      INDEX    oBeg  = iBeg;
      for(; iBeg != iEnd; ++iBeg){
         if(!(arr[iBeg] == value) ) arr[oBeg++] = arr[iBeg];
      }
      return oBeg;
   }
Reason: