Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1061

 
fxsaber:

Thank you, although I don't understand everything here.

In particular, where is the actual reading from file ?

And why functions described in documentation as working with csv-files don't actually work with them?

 
MakarFX:

In this case the alert window doesn't open.(

That's not true. I just recently asked a question to the drummer... and he used his official position to ban me for a week for asking that question. Do you want me to ask you the same question?

Because I wrote in black in Russian "ps: I checked everything." And who forbids you to check before making such statements?

 
Yurixx:

Thank you, although I don't understand everything here.

In particular, where is the actual reading from file ?

And why functions described in documentation as working with csv-files don't actually work with them?

As far as I know they work, but there are problems with moving the pointer around in the file.

 

Alexey Viktorov:

Because I wrote in black in Russian, "ps: I've checked everything." And who forbids you to check before making such statements?

You are God! The decision was so easy and you didn't say anything.

Thank you.

 
Alexey Viktorov:

As far as I know it works, but there are problems when moving the pointer in the file.

It turns out that MQL5 is much more strict than MQL4.

The delimiter parameter in FileOpen() must be of the short type, and onlysingle quotes should be used to specify its value.

Besides, the function flags must contain reference to FILE_ANSI or FILE_UNICODE file type.

Otherwise, like in my case, the function will store the whole csv-file in one scalar variable.

 

Who has more to say on this subjecthttps://www.mql5.com/ru/forum/160683/page1054#comment_14760155 . From what I understand you cannot pass local structures into a function they are always visible throughout the functionhttps://www.mql5.com/ru/forum/160683/page1060#comment_14768305 . I want to do what

int OnInit()
  {
     {
      struct MyPoint// локально объявил структуру внутри функции
        {
         int         x[5];
         int         y;
        };
      MyPoint qw1;
      EqualPointsP(qw1);// передал структуру в функцию EqualPointsP

     }
   return(INIT_SUCCEEDED);
  }

void OnDeinit(const int reason) {}

bool EqualPointsP(MyPoint & qw)
  {
   Print("EqualPointsP ");
   bool f = true;
   return f;
  }

Is it possible to do this?

 
Seric29:

Who has more to say on this subjecthttps://www.mql5.com/ru/forum/160683/page1054#comment_14760155 . From what I understand you cannot pass local structures into a function they are always visible throughout the functionhttps://www.mql5.com/ru/forum/160683/page1060#comment_14768305 . I want to do what

Is it possible to do this?

Use code styler (Ctrl + <) - it's impossible to tell where and how your brackets are placed - everything is crooked. For this reason, personally, I didn't look. I tried it, but my eyes said drop it, so I dropped it...

 
MakarFX:

You are God! The decision was so easy and you kept quiet.

Thank you.

I didn't keep quiet, I expressed what I remembered for ten years... but some time later there was a change and my knowledge became obsolete. To teach you something I had to write code and check with different variants. And all this could and should have been checked by you.

It's for the future. Good luck.

 
Artyom Trishkin:

Use code styler (Ctrl + <) - it is impossible to determine from the fly where and how your brackets are placed - everything is crooked. For this reason, personally, I haven't looked. I tried it, but my eyes said drop it, and I dropped it...

Well, there's basically nothing to stylise, you can copy and paste into MT4, that's basically how I write it, just in a more concise way. Well, I have corrected it. Can such structures be passed or not?

 
Seric29:

Well, there's basically nothing to stylise, you can copy and paste into MT4, that's basically how I write it, just in a more concise way. Well, I have corrected it. Can such structures be transferred or not?

But may I check it myself? Is it difficult? And why do I have to write unnecessary things?

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   struct MyPoint// локально объявил структуру внутри функции
     {
      int         x[5];
      int         y;
     } qw1;

   EqualPointsP(qw1);// передал структуру в функцию EqualPointsP
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason) {}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool EqualPointsP(MyPoint &qw)
  {
   Print("EqualPointsP ");
   return true;
  }

I haven't checked. What's stopping you?

Reason: