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

 

These are the local highs. Build a zig-zag around them, say from top to bottom. Think of a criterion you will use to build them. For example, the size of the difference between the bar values horizontally, or the excess distance vertically (number of points), or a combination of both.

 
Mikhail Toptunov:

Look, there is a method to calculate the blue line in statistics, isn't there?


How do you just...?

Forum on trading, automated trading systems and strategy testing

How can I algorithmize the detection of the MA feed?

Aleksei Stepanenko, 2021.04.07 15:10

In a sorted array find, for example, 90th percentile. Anything higher than that is particularly high.

 
Mikhail Toptunov:

Hello, can anyone tell me which statistical models can be used to determine values that are particularly high?

RMS
 

Can anyone suggest an SQL query. Why can't I get 0 in fifth column

   filename=_symbol()+(string)_Period+"_stats.sqlite";
   int database=DatabaseOpen(filename, DATABASE_OPEN_READWRITE | DATABASE_OPEN_CREATE | DATABASE_OPEN_COMMON);
   if(database==INVALID_HANDLE)
     {
      Print("SS: ", filename, " open failed with code ", GetLastError());
      return;
     }
   if(DatabaseTableExists(database, "DEALS"))
     {
      //--- создадим запрос и получим хендл на него
      int request=DatabasePrepare(database, "SELECT * FROM DEALS WHERE ID="+IntegerToString(i));
      if(!DatabaseBind(request,4,0))
        {
         PrintFormat("DatabaseBind() failed with code=%d", GetLastError());
         return;
        }
     }
   DatabaseClose(database);
DatabaseBind() failed with code=5625
 
Renat Akhtyamov:
RMS

+

 

All done. You need to get the query right and you don't need unnecessary functions


  int database=DatabaseOpen(filename, DATABASE_OPEN_READWRITE | DATABASE_OPEN_CREATE | DATABASE_OPEN_COMMON);
   if(database==INVALID_HANDLE)
     {
      Print("SS: ", filename, " open failed with code ", GetLastError());
      return;
     }
//--- заблокируем базу данных перед выполнением транзакций
//--- пройдем по всем сделкам и внесем их в базу данных
   bool failed=false;
   DatabaseTransactionBegin(database);
//--- внесем в таблицу каждую сделку через запрос
   string request_text="UPDATE DEALS SET Activity=1, timeClose="+(string)tc+" WHERE ID="+(string)i+"OR ID="+(string)(i+1);
   if(!DatabaseExecute(database,request_text))
     {
      PrintFormat("%s: failed to insert deal #%d with code %d", __FUNCTION__, i, GetLastError());
      failed=true;
     }
   if(failed)
     {
      //--- откатим все транзакции и разблокируем базу данных
      DatabaseTransactionRollback(database);
      PrintFormat("%s: DatabaseExecute() failed with code ", __FUNCTION__, GetLastError());
      DatabaseClose(database);
      return;
     }
   PrintFormat("Закрытие сделки ID: %d ", DealOpen[i].ID);
//--- все транзакции прошли успешно - зафиксируем изменения и разблокируем базу данных
   DatabaseTransactionCommit(database);
   DatabaseClose(database);
 

Hello, could you please tell me how to get the ask,bid tick values?

I have a crypto exchange integrated in my system.

The problem is that in the market overview and on the chart itself the quotes are displayed correctly, but when requested through the :

   MqlTick last_tick;
   SymbolInfoTick(Symbol(),last_tick);
   ask=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
   bid=SymbolInfoDouble(Symbol(),SYMBOL_BID);
   Comment(": Bid = ",bid," Ask = ",ask," tick Time ",TimeToString(last_tick.time,TIME_SECONDS),
           "\n"," Ls_bid ",last_tick.bid," Ls_ask ",last_tick.ask);

Quotes stop reflecting correctly. general bummer!!!!!!!!!!


What other ways can I get values?

I'm asking analysts, please don't pass by! A third of my life developing a robot, the finish line is looming on the horizon, and there's so much trouble!

Looks like the error is popping up at the weekend. How come...

 
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)

The first derivative of MA:(X(0)-X(n))/(n+1). We need the middle of the two arrays, or can we do it by simple analytics?

 
Алексей Тарабанов:

First derivative of MA:(X(0)-X(n))/(n+1). Need the middle of two arrays, or can we do with simple analytics?

Thanks, but I've already moved on from that.

Just started looking for fractals of the nth number of MAs on the bar of interest.

Reason: