Matrix Multiplication and Matrix Inversion in MQL4

 

I am trying to find out how to efficiently deal with matrix multiplication and matrix inversion in MQL4 but I have no idea where to begin. I have minor programming background, mostly SAS, R, MATLAB, C++ and python. If anybody could point me in the right direction or if any scripts exist to deal with this it would be much appreciated. I searched the forums for a solution to this problem but everything I found was either not what I was looking for or was more advanced than my programming experience.
Thanks.

 
What is matrix multiplication can you give an example so that I can understand what you are searching
 
deVries:
What is matrix multiplication can you give an example so that I can understand what you are searching
Matrices . . . https://en.wikipedia.org/wiki/Matrix_(mathematics)
 

Maybe this topic is a help https://www.mql5.com/en/forum/141157

made a little change to that see my next post this topic

 

Hey guys thanks for the responses. I have found something that allows integration of R into MQL4. If anybody else is interested here is the link: http://www.forexfactory.com/showthread.php?t=260422

Oh and I just posted a new blog that has info about an AutoRegressive / Mean Reversion indicator that I just finished programming. If you want a copy of the indicator or want to check it out: http://poisontreefx.blogspot.com

(note to moderators: I hope that posing links like these is not against forum rules, if it is please let me know and I will remove them)

 
//+------------------------------------------------------------------+
//|                                                  CandleStick.mq4 |
//|                               Copyright © 2012,  Tjipke de Vries |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012,  Tjipke de Vries"
#property link      ""


extern int rows=15;

datetime last_CandleStick_routine = 0;
double candle[1000][6]; // rows   coloms

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   int i;
   for (i = rows; i >= 1; i--)
     {
      candle[i][0] = Time[i];
      candle[i][1] = Open[i];
      candle[i][2] = High[i];
      candle[i][3] = Low[i];
      candle[i][4] = Close[i];
      candle[i][5] = Volume[i];
      Print(i,"  ",TimeToStr(candle[i][0],TIME_DATE),"  ",TimeToStr(candle[i][0],TIME_MINUTES)
        ," Open  ",DoubleToStr(candle[i][1],Digits)," High  ",DoubleToStr(candle[i][2],Digits)
        ," Low  ",DoubleToStr(candle[i][3],Digits)," Close  ",DoubleToStr(candle[i][4],Digits)
        ," Volume  ",candle[i][5]);   
     } 
   last_CandleStick_routine=iTime(NULL, 0, 1);

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
      candle[0][0] = Time[1];
      candle[0][1] = Open[1];
      candle[0][2] = High[1];
      candle[0][3] = Low[1];
      candle[0][4] = Close[1];
      candle[0][5] = Volume[1];

   if (iTime(NULL, 0, 1) != last_CandleStick_routine)
     {
      CandleStickRoutine();
      last_CandleStick_routine=iTime(NULL, 0, 1);
     } 
//----
   return(0);
  }
//+------------------------------------------------------------------+
void CandleStickRoutine()
  {
   int i, j;    
   for (i = rows; i >= 1; i--)
     {
      j = 0;
      for (j = 5; j >= 0; j--)
        {
         candle[i][j] = candle[i-1][j];
        }
      Print(i,"  ",TimeToStr(candle[i][0],TIME_DATE),"  ",TimeToStr(candle[i][0],TIME_MINUTES)
        ," Open  ",DoubleToStr(candle[i][1],Digits)," High  ",DoubleToStr(candle[i][2],Digits)
        ," Low  ",DoubleToStr(candle[i][3],Digits)," Close  ",DoubleToStr(candle[i][4],Digits)
        ," Volume  ",candle[i][5]);   
     }   
   return;
  }

Gives as result the values of the bar

2012.09.14 00:49:55 CandleStick EURUSD,M5: 1 2012.09.14 01:45 Open 1.29856 High 1.29860 Low 1.29844 Close 1.29847 Volume 78
2012.09.14 00:49:55 CandleStick EURUSD,M5: 2 2012.09.14 01:40 Open 1.29868 High 1.29868 Low 1.29846 Close 1.29855 Volume 74
2012.09.14 00:49:55 CandleStick EURUSD,M5: 3 2012.09.14 01:35 Open 1.29835 High 1.29873 Low 1.29826 Close 1.29867 Volume 85
2012.09.14 00:49:55 CandleStick EURUSD,M5: 4 2012.09.14 01:30 Open 1.29861 High 1.29862 Low 1.29824 Close 1.29837 Volume 118
2012.09.14 00:49:55 CandleStick EURUSD,M5: 5 2012.09.14 01:25 Open 1.29823 High 1.29867 Low 1.29823 Close 1.29859 Volume 147
2012.09.14 00:49:55 CandleStick EURUSD,M5: 6 2012.09.14 01:20 Open 1.29813 High 1.29823 Low 1.29793 Close 1.29822 Volume 131
2012.09.14 00:49:55 CandleStick EURUSD,M5: 7 2012.09.14 01:15 Open 1.29817 High 1.29821 Low 1.29809 Close 1.29814 Volume 108
2012.09.14 00:49:55 CandleStick EURUSD,M5: 8 2012.09.14 01:10 Open 1.29813 High 1.29821 Low 1.29813 Close 1.29816 Volume 62
2012.09.14 00:49:55 CandleStick EURUSD,M5: 9 2012.09.14 01:05 Open 1.29844 High 1.29847 Low 1.29811 Close 1.29814 Volume 108
2012.09.14 00:49:55 CandleStick EURUSD,M5: 10 2012.09.14 01:00 Open 1.29858 High 1.29858 Low 1.29836 Close 1.29845 Volume 98
2012.09.14 00:49:55 CandleStick EURUSD,M5: 11 2012.09.14 00:55 Open 1.29857 High 1.29859 Low 1.29854 Close 1.29856 Volume 42
2012.09.14 00:49:55 CandleStick EURUSD,M5: 12 2012.09.14 00:50 Open 1.29845 High 1.29859 Low 1.29840 Close 1.29859 Volume 45
2012.09.14 00:49:55 CandleStick EURUSD,M5: 13 2012.09.14 00:45 Open 1.29839 High 1.29848 Low 1.29822 Close 1.29846 Volume 91
2012.09.14 00:49:55 CandleStick EURUSD,M5: 14 2012.09.14 00:40 Open 1.29849 High 1.29854 Low 1.29832 Close 1.29836 Volume 63
2012.09.14 00:49:55 CandleStick EURUSD,M5: 15 2012.09.14 00:35 Open 1.29826 High 1.29851 Low 1.29819 Close 1.29848 Volume 109
2012.09.14 00:45:08 CandleStick EURUSD,M5: 1 2012.09.14 01:40 Open 1.29868 High 1.29868 Low 1.29846 Close 1.29855 Volume 74
2012.09.14 00:45:08 CandleStick EURUSD,M5: 2 2012.09.14 01:35 Open 1.29835 High 1.29873 Low 1.29826 Close 1.29867 Volume 85

So what it is do now for every new bar of chart it can this way also calculate every new bar values of indicators at bar 1 (close)

and move the calculated values one bar every new period