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

 

Question cleared, the error was in adding more control parameters to the class when unloading in the EA!

Good day, please advise - what didn't I catch?

I downloaded data in .bat, and then I load it, but only the first entry is correct, then the data do not coincide.


The meaning of the code is as follows

indicator

- Fill in the new data if they are in the file.

the advisor

- Dump data to a class.


In indicator it is uploaded as -

//+------------------------------------------------------------------+
//| Выгружаю данные с файла если он есть                             |
//+------------------------------------------------------------------+
void TextCsv0(int size)
  {
   ArrayFree(cand_buff);
   ArrayResize(cand_buff,0);
   long count=FileLoad("test.bin",cand_buff);
   if(count!=-1)
     {
      for(int i=0; i<count; i++)
         PrintFormat("%s\t%G\t%G\t%G\t%G\t%G\t%G\t%G\t%G\t%G\t%I64u",
                     TimeToString(cand_buff[i].time,TIME_DATE|TIME_SECONDS),
                     cand_buff[i].bar,cand_buff[i].period,cand_buff[i].praceMA);
     }
   TextCsv1(size,(int)count);
  }
//+------------------------------------------------------------------+
//| Загружаю новые данные                                            |
//+------------------------------------------------------------------+
void TextCsv1(int size,int count)
  {
   int _count=0;
   if(count==-1) count=0;
   for(int i=0; i<size; i++)
      if(TextCsv2(count,i)==true)
        {
         ArrayResize(cand_buff,count+(int)_count+1);
         cand_buff[count+_count].period=Alt[i].period;
         cand_buff[count+_count].bar=Alt[i].bar;
         cand_buff[count+_count].praceMA=Alt[i].praceMA;
         cand_buff[count+_count].time=Alt[i].time;
         cand_buff[count+_count].High=Alt[i].High;
         cand_buff[count+_count].Low=Alt[i].Low;
         cand_buff[count+_count].type=Alt[i].type;
         _count++;
        }
   TextCsv(size,_count,count);
  }
//+------------------------------------------------------------------+
//| Проверка на новые данные                                         |
//+------------------------------------------------------------------+
bool  TextCsv2(long count,int i)
  {
   bool fl=true;
   for(int j=(int)count-1; j>=0; j--)
      if(cand_buff[j].period==Alt[i].period)
         if(cand_buff[j].time==Alt[i].time)
            return(false);
   return(true);
  }
//+------------------------------------------------------------------+
//| Загрузка                                                         |
//+------------------------------------------------------------------+
void TextCsv(int size,int _count, int count)
  {
//--- откроем файл для записи массива структуры в файл (если его нет, то создастся автоматически)
   ResetLastError();
   int file_handle=FileOpen("test.bin",FILE_READ|FILE_WRITE|FILE_BIN);//FileOpen("test "+"//"+_symbol(),FILE_READ|FILE_WRITE|FILE_BIN|FILE_COMMON);
   if(file_handle!=INVALID_HANDLE)
     {
      FileSeek(file_handle,0,SEEK_END);
      //--- подготовим счетчик количества байт
      uint counter=0;
      //--- в цикле запишем значения массива
      for(int i=0; i<_count; i++)
         counter+=FileWriteStruct(file_handle,cand_buff[count+i]);
      //  PrintFormat("В файл %s записано %d байт информации",_symbol(),counter);
      PrintFormat("Всего байтов: %d * %d * %d = %d, %s",size,4,7,size*4*7,size*4*7==counter ? "Верно" : "Ошибка");
      //--- закрываем файл
      FileClose(file_handle);
      // PrintFormat("Данные записаны, файл %s закрыт",_symbol());
     }
   else
      PrintFormat("Не удалось открыть файл %s, Код ошибки = %d",_symbol(),GetLastError());
  }

In the Expert Advisor, download it as follows -

//+------------------------------------------------------------------+
//| Выгрузка                                                         |
//+------------------------------------------------------------------+
void LoadFail(datetime InpTimeDrawTo)
  {
   ArrayFree(buf0);
   long count=FileLoad("test.bin",buf0);
   if(count!=-1)
     {
      for(int i=0; i<count; i++)
        {
         PrintFormat("%s\t%G\t%G\t%G\t%G\t%G\t%G\t%G\t%G\t%I64u\t%d\t%I64u",
                     TimeToString(buf0[i].time,TIME_DATE|TIME_SECONDS),
                     buf0[i].bar,buf0[i].period,buf0[i].praceMA,buf0[i].High,buf0[i].Low,buf0[i].type);
        }
     }
  }
 
At least you should have some code so that you could run it on your own, twist it, poke around...
 

Hello, continuing to master a way to recognise MA harnesses

Took an array of 400 MAs of one bar with period values: - sm.d[per-1].m[bar]

Plotted it on the XY chart to see how to identify the bundles. the range is from the 4th to 400th MA of one bar

X axis - period 4-400



Differentiated, got this chart

I understand that the curves formed are the rods.


The differentiation is done with the help of a special program, but I cannot use mql. May be, who knows how to do it in mql5?

Although it's not easy to determine the range of this rounding either!!! Does anyone have any suggestions?

How to determine this range?

Or this one?


 
Mikhail Toptunov:

Hello, continuing to master a way to recognise MA harnesses

Took an array of 400 MAs of one bar with period values: - sm.d[per-1].m[bar]

Plotted it on the XY chart to see how to identify the bundles. the range is from the 4th to 400th MA of one bar

X axis - period 4-400



Differentiated, got this chart

I understand that the curves formed are the rods.


The differentiation is done with the help of a special program, but I cannot use mql. May be, who knows how to do it in mql5?

Although it's not easy to determine the range of this rounding either!!! Does anyone have any suggestions?

How to determine this range?

Or this one?


"Prodifferentiated" - can you elaborate on how that's done?
 

I think - ordinary differential equation (differentiation and integration)

Derivative:1(X),2(Y)

 
Mikhail Toptunov:

I think - ordinary differential equation (differentiation and integration)

Derivative:1(X),2(Y)

e.g. there is a quotation

how to differentiate?

without packages, by code?

 
Renat Akhtyamov:

for example there is a quote

how to differentiate?

without packets, by code?

Sorry, are you asking me?

- I am not aware of it. I kind of asked myself, HOW?

 
Mikhail Toptunov:

I'm sorry, are you asking me?

- I'm not aware of it. I kind of asked myself, HOW?

Yeah. Interesting.

here, googled.

Time series differentiation - going from a series X(t) to a series of differences X(t) - X(t-1)

 
Renat Akhtyamov:

Yeah. Interesting.

here, I googled

Differentiating a time series - going from a series X(t) to a series of differences X(t) - X(t-1)

I don't get it!

 

Dear professionals, how do you choose this range?

Reason: