Discussion of article "Econometric approach to finding market patterns: Autocorrelation, Heat Maps and Scatter Plots" - page 2

 
Maxim Dmitrievsky:

Hi, MetaQuotes has change python API, so this functions not work now. Maybe later I'll fix this and attach a new notebook

Also, you can check new documentation on this site 

Thanks A lot Mr, for your fast reply and your cooperation is highly appreciated


waiting for your new file.

 

Nice article! Thanks for sharing your work!

Hope you find some time to fix the issue with Python API.


/Rasoul

 

Fixed notebook

 

Corrected version of the notebook, due to a changed python api

 
Maxim Dmitrievsky:

Corrected version of the notebook, due to a changed python api

Attached to the article

 

Close[-1] = (Close[0]-Close[lag]) - ((Close[lag]-Close[lag*2]) - (Close[lag-1]-Close[lag*2-1])))

If the same formula was applied here, then the situation is similar to MA prediction, the longer the period, the more accurate the MA prediction is one step ahead.

What I did was to take the MA of a large period, predict a bar ahead, then calculate the price prediction from that. I calculated the prediction error (real price-forecast). I calculated the price increments. As a result, the error was worse than the increments. So you can say, "today will be like yesterday" is the best prediction.

 
Rorschach:

Close[-1] = (Close[0]-Close[lag]) - ((Close[lag]-Close[lag*2]) - (Close[lag-1]-Close[lag*2-1])))

If the same formula was applied here, then the situation is similar to MA prediction, the longer the period, the more accurate the MA prediction is one step ahead.

What I did was to take the MA of a large period, predict a bar ahead, then calculate the price prediction from that. I calculated the prediction error (real price-forecast). I calculated the price increments. As a result, the error was worse than the increments. So you can say, "today will be like yesterday" is the best prediction.
.

Autoregression on a filtered series (specific, conditionally, hours) is used there. The increments of neighbouring clocks are taken as regressors. Yes, this is a one step ahead prediction. I have not done more detailed experiments. If you create a custom symbol in mt5 for random wolf, you can test with the bot from the article. Unfortunately I'm not friends with them. Maybe someone will make one.
 
#property script_show_inputs
#include <Math\Stat\Math.mqh>
#include <rndxor128.mqh>//https://www.mql5.com/en/articles/273
//--- input parameters
input string   symbol_origin="EURUSD";// symbol name, based on which the custom symbol will be created 
input string   symbol_name="MySymbol";// user character name 
input datetime From=D'2019.01.01';
input datetime To=D'2020.01.01';

void OnStart()
  {
   CustomSymbolCreate(symbol_name,"",symbol_origin);
   SymbolSelect(symbol_name,true);
   int count=100;//StdDev m1=sqrt(count)
   RNDXor128 xor;
   //xor.SRand(6);//(GetTickCount());
   MqlRates A[];
   double B[]; ArrayResize(B,count);
   int total=CopyRates(symbol_origin,PERIOD_M1,From,To,A);
   for(int i=0;i<total;i++)
     {for(int j=0;j<count;j++) {B[j]=(xor.Rand()<2147483648)?_Point:-_Point;}
      MathCumulativeSum(B);
      A[i].open=(i>0) ? A[i-1].close : 1.1;
      A[i].high=MathMax(B)+A[i].open;
      A[i].low=MathMin(B)+A[i].open;
      A[i].close=B[count-1]+A[i].open;
      A[i].tick_volume=count;
     }
   Print(CustomRatesReplace(symbol_name,From,To,A));
  }
In the chart settings (Ctrl+O) you need to select the required number of bars.
 
Rorschach:
In the chart settings (Ctrl+O) you need to select the required number of bars.

later I will do the same method with autoregression, upload the series to python, build the model.

 

Thanks for your articles, I've really enjoyed reading them!

I noticed in this example you set the .diff(lag) after selecting the single hour throughout the article.  Meaning that a lag of 25 actually corresponds to a lag of 25 days. 

The exception is in the 3D plot where you apply the lag before selecting the hour. Was this intentional?