Author: Copyright � 2008, MetaQuotes Software Corp.
Matrix1

This script is designed to manage and display a structured collection of numerical data—specifically organized as a mathematical grid known as a matrix. Rather than performing complex calculations or automated trading actions, its primary purpose is to organize a set of values into rows and columns for clear visualization on your trading platform.

How the Logic Works

Data Organization The script begins by creating a structured storage area (a 2x3 matrix). Think of this as a table with two rows and three columns. The script manually assigns a specific decimal value to each individual "cell" within that table:

  • The first row contains three specific values.
  • The second row contains three different values.

Information Processing Once the data is organized into the grid, the script initiates a processing routine. It systematically scans through every cell in the table, starting from the top-left and moving across each row to the right. As it identifies each value, it prepares it for display by grouping the numbers together and adding line breaks to ensure they maintain their correct row-and-column formatting.

Visual Output Finally, the script takes this organized block of text and pushes it onto your trading chart screen. It converts the internal grid into a readable string of text, allowing you to view all the values simultaneously in a clear, structured layout rather than seeing them as individual, disconnected numbers.

2 Views
0 Downloads
0 Favorites
Matrix1
//+------------------------------------------------------------------+
//|                                                      Matrix1.mq4 |
//|                      Copyright © 2008, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

double M[2][3];   
                  
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
  M[0][0]=0.1;   
  M[0][1]=0.2;   
  M[0][2]=0.3;      

  M[1][0]=0.4;      
  M[1][1]=0.5;      
  M[1][2]=0.6;      

  PrintMatrix(M);  
//----
   return(0);
  }
//+------------------------------------------------------------------+

void PrintMatrix(double Matrix[][])
{
	int Line = ArrayRange(Matrix,0);
	int Col = ArrayRange(Matrix,1);
	string m1="";
	for (int i=0;i<Line;i++)
	{
	  for (int j=0;j<Col;j++)
	   m1=m1+Matrix[i][j]+",";
	  
	  m1=m1+"\n"; 
	}   
   Comment(m1);	
}	

Comments