![]() ![]() However, this way of program designing is incorrect. In this example the constant values 3 and 5 could be used. In order to calculate the runtime environment (the number of iterations) of two embedded cycle operators, you should know the values of the elements of each array. ![]() The rewriting of the values itself is performed in the following entry: Mas_2 = Mas_1 // Matrix transposition The Mas_1 array has 3 rows containing 5 elements each and the MAS_2 array has 5 rows containing 3 elements each. Two arrays are opened in the start() function of the expert. Int R1 = ArrayRange ( Mas_1, 1 ) // Number of elements in second dim. Int R0 = ArrayRange ( Mas_1, 0 ) // Number of elements in first dim. The code should be used for educational purpose only. The solution of matrix transposition problem is represented in the matrix.mq4 expert: //. In this case, the problem resolves itself to rewriting the values of the first matrix to the second one according to the rules of matrix transposition, namely rewrite the elements values of the first matrix columns to the rows of the desired matrix. Let's work out some values of the elements and represent the initial and the desired matrices that the Mas_1 and Mas_2 arrays contain respectively:įig. Get the values of the Mas_2 array that contains the elements whose values are equal to the values of the transposable matrix. ![]() The Mas_1 array contains the values of the 3x5 matrix. The use of ArrayRange() function can be demonstrated with the solution of the following problem: The function returns the number of elements in the specified dimension of the array. Int ArrayRange ( object array, int range_index ) The numbers of dimensions are used in the ArrayRange() function, for example. The first dimension has the 0 number, and the second one - the 1 number. The first dimension specifies the number of rows (3 in this example), and the second one specifies the number of elements in the row (or the number of columns, 8 in this example). It means that the array has two dimensions. For example, if an array is declared the following way: int Erray_OHL // Array declaration The same thing can be said about the numeration of the dimensions in the array. we can say about the amount of elements in the first dimension: the maximum index number is 2, because the number of the elements in the array is 3. In this case, the array is one-dimensional, i.e. In such a way, the maximum index value is less than the number of the elements in array by one. the first of three elements has the 0 index (Erray_OHL), the second one - the 1 index (Erray_OHL), and the third one - the 2 index (Erray_OHL). Indexing of the elements start with zero, i.e. Then it means that a one-dimensional array named Erray_OHL contains three elements. For example, if the array is declared: int Erray_OHL // Array declaration It was mentioned before that you shouldn't confuse the value of the array element index with the number of elements in the array (see Arrays). T he custom indicator must be compiled (*.EX4 file) and be in the terminal_directory\MQL4\Indicators\ directory.It is very important to keep in mind that the sequence of any single-type elements is always numbered starting from zero in MQL4. Numerical value of the specified custom indicator. Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). Can be from 0 to 7 and must correspond with the index, specified in call of the SetIndexBuffer() function. If the values of input parameters is not specified, the default values will be used. The passed parameters and their order must correspond with the declaration order and the type of extern variables of the custom indicator. Custom indicator input-parameters, separated by commas. If the indicator is located in subdirectory, for example, in MQL4/Indicators/ Examples, its name must be specified as " Examples\\ indicator_name" (double backslash "\\"must be specified as separator instead of a single one). Custom indicator compiled program name, relative to the root indicators directory (MQL4/Indicators/). It can be any of ENUM_TIMEFRAMES enumeration values. Symbol name on the data of which the indicator will be calculated. custom indicator input parameters (if necessary) String name, // path/name of the custom indicator compiled program ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |