Good ++
Thanks.
Please explain.
In "Obtaining indicator handle using IndicatorCreate()"
Create an array
MqlParam params[]; // Array for storing indicator parameters
Without specifying the type, then change the array type as needed.
How does it work? Can it be used for any structures or only for this one? Is it possible to just change the type of an existing array?
But in the article, in the text.
*** // Set the period of the slow MA params[0].type =TYPE_INT; params[0].integer_value=21; ***
and following it.
*** ArrayResize(params,2); // Step params[0].type =TYPE_DOUBLE; params[0].double_value = 0.02; ***nothing is deleted, the type is changed.....
So, different dinners can only be on the waiter's tray. Okay, I'll experiment.
Are there any plans for arrays of mixed types, like [int][double]?
So, different dinners can only be on the waiter's tray. Okay, I'll experiment.
Are there no plans for arrays of mixed types, like [int][double]?
Use structures, see the example in the help - https://www.mql5.com/ru/docs/basis/types/casting#casting_structure:
Another example shows how you can organize your own function to get RGB (Red,Green,Blue) colour representation from colour type. To do this, we create two structures that have the same size but different internal composition. For convenience, let's add to the structure a function that returns colour in RGB representation as a string.
#property script_show_inputs input color testColor=clrBlue;// set the colour for testing //--- structure for RGB colour representation struct RGB { uchar blue; // blue colour component uchar green; // green colour component uchar red; // red colour component uchar empty; // this byte is not used string toString(); // function to receive as a string }; //--- function to output the colour as a string string RGB::toString(void) { string out="("+(string)red+":"+(string)green+":"+(string)blue+")"; return out; } //--- structure for storing the built-in type colour struct builtColor { color c; }; //+------------------------------------------------------------------+ //| Script programme start function| //+------------------------------------------------------------------+ void OnStart() { //--- variable to store in RGB RGB colorRGB; //--- variable for storing colour type builtColor test; test.c=testColor; //--- converting two structures by copying their contents colorRGB=test; Print("color ",test.c," = ",colorRGB.toString()); //--- }

- www.mql5.com
Use structures, see the example in the help - https://www.mql5.com/ru/docs/basis/types/casting#casting_structure:
I understand more or less with structures, I'm interested in arrays.
Thanks.
I'm more or less clear with structures, I'm interested in arrays.
Thank you.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article How to call indicators in MQL5 is published:
With new version of MQL programming language available not only the approach of dealing with indicators have changed, but there are also new ways of how to create indicators. Furthermore, you have additional flexibility working with indicator's buffers - now you can specify the desired direction of indexing and get exactly as many indicator's values as you want. This article explains the basic methods of calling indicators and retrieving data from the indicator's buffers.
In MQL5 there are several ways to call indicators, and they are mostly carried out using IndicatorCreate() and iCustom() functions. Moreover, these functions only return indicator handle, and further work on indicators is done through it. So what is a handle? How to deal with IndicatorCreate() and iCustom() functions? And how your expert will get indicator data? All these questions are covered in this article.
Author: KlimMalgin