How do you algorithmise the detection of MA feed clusters? - page 7

 
Aleksey Nikolayev:
Why can'tMathQuantile() be used?
Probably. If you need to look for medians on each bar, you have to see which is faster: maintaining an ordered array or using this function.
 
Aleksey Nikolayev:
Why can'tMathQuantile() be used?

What is the "probability array" in this function - how do you fill it in?

 
I wish someone would tell me how to sort the array with index binding. Efficient!)
 
Mikhail Toptunov:
I wish somebody would tell me how to sort an array with index linking. Efficient!)

Shove the index into the array. This will only increase the dimensionality of the array.

 

Michael, a long time ago I wrote a function for myself to insert a new value into an array to keep it sorted.

That is, all additions to the array have to be done through this function:

//находим место для значения в отсортированном массиве и записываем его туда
void SetValueInSortArray(double &eArray[], double eValue)
   {
   //находим индекс, куда будем вставлять элемент
   int eFinish=ArrayRange(eArray,0)-1;
   int eIndex;
   if(eFinish==-1)
      {
      eIndex=0;
      }
   else if(NormalizeDouble(eArray[eFinish]-eValue,8)<0)
      {
      eIndex=eFinish+1;
      }
   else
      {
      int eLower=0;
      int eUpper=eFinish;
      eIndex=0;
      while(eLower<=eUpper)
         {
         eIndex=(eLower+eUpper)/2;
         if(NormalizeDouble(eArray[eIndex]-eValue,8)>=0)
            {
            if(eIndex>0 && NormalizeDouble(eArray[eIndex-1]-eValue,8)<0)
               {
               break;
               }
            else
               {
               eUpper=eIndex-1;
               }
            }
         if(NormalizeDouble(eArray[eIndex]-eValue,8)<0)
            {
            eLower=eIndex+1;
            }
         }
      }
   //вставка элемента в начало массива
   if(eIndex==0)
      {
      if(ArrayRange(eArray,0)==0)
         {
         ArrayResize(eArray,1);
         }
      else
         {
         ArrayCopy(eArray,eArray,1,0);
         }
      }
   //вставка элемента в конец массива
   else if(eIndex>=ArrayRange(eArray,0))
      {
      ArrayResize(eArray,eIndex+1);
      }
   //вставка элемента в середину массива
   else
      {
      ArrayCopy(eArray,eArray,eIndex,eIndex-1);
      }
   eArray[eIndex]=eValue;
   }  
Binary search is used, it should be fast.
 
Mikhail Toptunov:
I wish someone would tell me how to sort an array with index mapping. Efficient!)

Two-dimensional array, ArraySort() function.

 
Nah, finding space for one element and sorting the whole array is a very different time.
 
Aleksey Vyazmikin:

What is the "probability array" in this function - how do you fill it in?

What are the quantiles to be counted, for example:

{0.5} - median

{0.25, 0.5, 0.75} - quartiles

{0.01, 0.02, ..., 0.99} - persentiles

 
Mikhail Toptunov:
I wish somebody would tell me how to sort an array with binding to an index. Efficient!)

TryMathQuickSort()

 
Mikhail Toptunov:

Example:

Array of 30 MA price values, look for the middle of the ordered array.

We get 15(L0) value in the middle of the array, then we get two arrays from L0 downwards and L0 upwards and find the middle of these arrays and so on until we get thefokus number(seven values for example)

and it will be a ticky in the end

the answer is simple - mathematical processing is misleading