Errors, bugs, questions - page 2797

 
Roman:

Bild 2530

On the third attachment of the structure, no IntelliSense appears.

IntelliSense intelligence continues to deliver ))


i.e. one hint is all you can count on

 
Nikolai Karetnikov:

IntelliSense intelligence continues to deliver ))

i.e. one hint is all you can count on

My post was about nested structures, no IntelliSense selection appears on the third nesting.
Which is very annoying, because the nested structures were planned to be used just for the selection in the intellisense.
And since it doesn't appear, I have to go back to the structure, and look what fields are there. Not good.
I wish they would fix it.

Regarding your example, for standard MQL functions the hints are clear.
If you don't understand the tooltip, put the cursor on the function and press F1.

 
Mihail Matkovskij:

Substituted the ObjectDeleteAll function first in your example:

Then into the indicator.

It turned out to be easy to useObjectDeleteAll in my project. To delete all objects, I only needed to change the prefix 3 times and call ObjectDeleteAll 3 times. The chart is clear as a result. The MQL5 language has a lot of subtleties. But at the same time it is a very well thought-out language.

Thanks to everyone who helped me in solving this problem!

Here you go again:

    trend = new CChartObjectTrend();
    if(trend.Create(0, "trend"+(string)i, 0, time[shift], low[shift], time[shift], high[shift]))
      listOfTrendLines.Add(trend);
    else
      delete trend;

A potential hole to leak into. Look at what the Add() method returns

(I know it's a test, I know it's fine to check, but if you're checking the creation result, why not check the addition result? Disciplined for the future)
 
Artyom Trishkin:

Once again you have here:

A potential hole to leak into. Look at what the Add() method returns

(I understand that it's a test, I understand that it's good enough for checking, but if I check the result of creation, why not check the result of addition? Discipline for the future)

Well do this:

    trend = new CChartObjectTrend();
    if(trend.Create(0, "trend"+(string)i, 0, time[shift], low[shift], time[shift], high[shift])) {
      if(!listOfTrendLines.Add(trend))
        delete trend;
    }
    else
      delete trend;

That's it. Now there's no hole?

This is actually a test program and it did its job. I don't need anything else from it. If it were working, it would have a different approach and concept. The error messages go from each critical point with indication of line (__LINE__) and function name (__FUNCTION__) ... So, sometimes I don't need to use debugging either. I just look, module name, line number, function name...

 

Hello all! The problem is as follows...

After updating, the MT5 terminal shortcut is gone, both on the desktop and in the root folder. Reinstalled it. After restarting my PC, the history repeated. What is the problem? Has anyone had problems with this?

 
Artyom Trishkin:

Here you have it again:

A potential hole to leak into. Look at what the Add() method returns

(I know it's a test, I understand it's good enough for checking, but if you check the result of creation, why not check the result of addition? Discipline for the future)

And in what cases might listOfTrendLines.Add fail? I just don't know them. Though I adhere to that principle, where "there are no unnecessary checks" (c). But hypothetically we may suppose that it may come to paranoia. Ok, the Create method of a graphical object class may fail. But it always works correctly if the code is written correctly and the program gives normal names to objects. But let's say there can be faults in its usage... But how can the Add method return a fake object under normal conditions. Or ArrayResize function (which, by the way, is used in this method), how can it return result different from new_size. Unless there is not enough memory... :) But where have you seen modern devices with such big memory deficit? :)

 
Mihail Matkovskij:

In what cases might listOfTrendLines.Add fail? I'm just not aware of them. Although I adhere to the principle where "there are no unnecessary checks" (c). But hypothetically we may suppose that it may come to paranoia. Ok, the Create method of a graphical object class may fail. But it always works correctly if the code is written correctly and the program gives normal names to objects. But let's say there can be faults in its usage... But how can the Add method return a fake object under normal conditions. Or ArrayResize function (which, by the way, is used in this method), how can it return result different from new_size. Unless there is not enough memory... :) But where have you seen a modern system with deficit of memory? :)

Vps usually.
P.s. I think you're unfair to Alexei because he was the one who gave the first and correct advice and anyway he helped you
 
Mihail Matkovskij:

Substituted the ObjectDeleteAll function first in your example:

Then into the indicator.

It turned out to be easy to useObjectDeleteAll in my project. To delete all objects, I only needed to change the prefix 3 times and call ObjectDeleteAll 3 times. The chart is clear as a result. The MQL5 language has a lot of subtleties. But at the same time it is a very well thought-out language.

Thanks to everyone who assisted me in solving this problem!

I wonder if you have reviewed the documentation or just took the function description from my post.

I so suspect that you only have graphical objects that are trending. If so, why do you need a prefix? There is also a deletion by object type

int  ObjectsDeleteAll(
   long  chart_id,            // идентификатор графика
   int   sub_window=-1,       // индекс окна
   int   type=-1              // тип объекта для удаления
   );

Therefore, you don't have to change anything in the project, but just write

ObjectsDeleteAll(0, 0, OBJ_TREND);
)))))))))))))
 
Aleksei Beliakov:
Vps usually.
P.s. It seems to me that you have treated Alexei unfairly after all he was the one who gave the first and correct advice and anyway he helped you

Where is the unfairness in that, I'm embarrassed to ask...? I think I'm fine with Alexei. Are you related to him?

 
Alexey Viktorov:

I wonder if you looked at the documentation or just took the function description from my post.

I suspect that you only have graphical objects that are trending. If so, why do you need a prefix? There is also a deletion by object type

so you don't have to change anything in the project.

)))))))))))))

This is just a special case. The prefix is general and universal. Moreover, deletion of all trend lines will also affect objects that do not belong to the program.

Reason: