Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1202

 
Igor Makanu:

that's what I'm writing, it's easier to check, within 10 minutes.... checked, FileWriteArray() does not write the array size in the header or the first byte, so you have to write these values yourself

Igor, I didn't say it's impossible at all. Carefully read my words.

Alexey Viktorov:

...

How is it possible to read structure and three arrays from one file, unknown how it was written.

...

Moreover, in that example there is a file open, structure read, three arrays read and no file close. At this point you have to wonder if the file is closed after being written.

In your example it is reading arrays and structure elements, not FileReadStruct().

Thanks for the example. I will remember and use it if necessary.

 
Alexey Viktorov:

Igor, I didn't say it was impossible at all. Well, read my words a little more carefully.

Moreover, that example has file opening, structure reading, reading three arrays and no file closing. At this point you begin to wonder if the file is closed after being written.

Your example shows reading of arrays and structure elements, not FileReadStruct().

Thanks for the example. I will remember and use it if necessary.

I don't know how else to explain ))))

you believe in some kind of magic - that third-party programs can figure out the format of the data written to a binary file - no one can read data from a binary file without knowing the data structure!

A binary file is a big array of bytes which is accessed sequentially - so what did you read? - only you know and if you don't know you'll be reading a lot of binary data.

)))

SZZ: it's understandable that I want to write (read) an array with one command ArrayWrite and a structure the same way - yes it is possible, but if we use a fixed data size and write each structure/array in a separate file

 

Igor Makanu:

Well, you believe in some kind of magic - that third-party programs can find out the format of the data written to a binary file - no one can read data from a binary file without knowing the data structure!

You misunderstand me. I said exactly the same only in other words. It wasn't a how-to question, it was... not even a question mark...

 

Can you please tell me how to create a custom symbol in mt5 if I want to put a stock chart there with funds? Broker Otkritie, if anything)

I tried the following:

1. I download a quote history in csv from finam

2. Convert csv to json

{
    "root": {
        "row": [
            {
                "TICKER": "FXRU",
                "PER": "1",
                "DATE": "20190502",
                "TIME": "100100",
                "OPEN": "748.7000000",
                "HIGH": "749.7000000",
                "LOW": "747.7000000",
                "CLOSE": "749.7000000",
                "VOL": "115"
            },
               ]
           }
}

3. it doesn't work.

 
Igor Makanu:

that's what I'm writing, it's easier to check, within 10 minutes.... checked, FileWriteArray() does not write the size of the array in the header or the first byte, so we have to write these values ourselves

2020.03.25 10:18:36.058 tst (EURUSD,H1) 1. d_arr

2020.03.25 10:18:36.058 tst (EURUSD,H1) 3.14159 3.14159 3.14159 3.14159

2020.03.25 10:18:36.058 tst (EURUSD,H1) 2. i_arr

2020.03.25 10:18:36.058 tst (EURUSD,H1) 1234567890 1234567890

2020.03.25 10:18:36.058 tst (EURUSD,H1) 2. c_arr

2020.03.25 10:18:36.058 tst (EURUSD,H1) 127 127 127 127 127

2020.03.25 10:18:36.058 tst (EURUSD,H1) mstruct.a = 666 , mstruct.b = 123.123000

I.e. if array dimensions are dynamic, it means that we write the array dimensions when writing and read the array dimensions from the file and set the dimensions of the structure arrays when reading

in my example 2 structures - one was initialized and written, the second was read, initialization from file data

Thank you, very impressive.

And if you write 2 structures to the file, you can obviously read them in the same way.


PS A simple structure (in any quantity) is written and read by regular function without any problems.
 
Please, how do you set the size of the second dimension of a two-dimensional dynamic array on the fly?
 
Сергей Таболин:
Please be kind, how do you set the size of the second dimension of a two dimensional dynamic array on the fly?

or wrap a one-dimensional array in an array of structures

struct Sarr
{
   double            y[];
};
struct Sarr2x2
{
   Sarr              x[];
};

void OnStart()
{
   Sarr2x2 arr;
   ArrayResize(arr.x,10);
   for(int i=0; i<ArraySize(arr.x); i++)
   {
      ArrayResize(arr.x[i].y,10);
   }
   arr.x[0].y[0] = 5.0;
}
//+------------------------------------------------------------------+

or use a class that will do the job - I don't want to look for it, I've given you the links a hundred times already

https://www.mql5.com/ru/forum/6729/page3#comment_674794


yes, there is a matrix class in alglib

#include <Math\Alglib\matrix.mqh>

void OnStart()
  {
      CMatrixDouble d_arr;
      d_arr.Resize(10,10);
 

What does the time scale mean in the trading story?

X scale. What do the values on the scale mean?

 

how to use MQL to create a .bmp image and save it to a file without binding to a chart - i.e., without creating a Canvas or CGraphic object on a chart first

I searched cursorily on the articles did not see such information, I need an instruction on how to begin, I'll write the code myself

 
Igor Makanu:

how to use MQL to create a .bmp image and save it to a file without binding to a chart - i.e., without creating a Canvas or CGraphic object on a chart first

I searched cursorily on the articles did not see such information, I need an instruction on how to begin, I'll write the code myself

In resources