Errors, bugs, questions - page 2798

 
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 wouldn't have to change anything in the project, just write

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

Of course, I was looking at the documentation. And yes, everything is possible! But I did this... And what, it doesn't work or somehow gets in the way...?

And in the project, it's more complicated than that. As I said above...
 
Artyom Trishkin:

This is only a special case. The prefix is general and universal. While the removal of all trendlines will also affect objects not belonging to the program.

Agreed. chart_id: 0 (current chart). It means that it will only affect this chart. And if there will be other programs, you can add ID to each object name and callObjectsDeleteAllwith an appropriate prefix and the function will not confuse anything. That's why I said in the posts above that object naming is complicated and I needed to think before using this function. But Alexey took offence at me, also his friend... In vain!

 
Mihail Matkovskij:

Why is that? chart_id: 0 (current chart). So it's only on this chart. And if there will be other programs there is also such a notion as ID. If it is added to each object name, the ObjectsDeleteAll function will not confuse anything. That's why I said in my posts above that object naming is complicated and I had to think it over before using this function. But Alexey took offence at me, also his friend... In vain!

Use your brain before you answer :)

The ID written in the name of the object is a kind of prefix, which identifies and removes objects from the program.

Now look at the code, which I wrote my response to Alexei, and how his code will delete only the objects you need, which will NOT have ID written in it, and will leave on the chart "alien" objects that do not belong to the program?

My answer to this code was Alexey with such a message from Alexey:

accordingly you should not change anything in the project, but just write

ObjectsDeleteAll(0, 0, OBJ_TREND);
)))))))))))))
 
Artyom Trishkin:

Use your brain before you answer :)

ID, written in the name of the object - it is a kind of prefix, by the identification of which the objects of the program are removed.

Now look at the code, which I wrote my response to Alexei, and how his code will delete only the objects you need, which will NOT have ID written in it, and which will leave on the chart "alien" objects that do not belong to the program?

My reply to Alexey was to this code with such a message from Alexey:

Edited. You replied correctly. It was me who messed up a bit. I wanted to say something else.

 
Mihail Matkovskij:

But Alexei took offense at me...

You don't get it... I'm all for justice. You shouldn't expose your faults, and everyone has them, and me too, for the bugs of the terminal.

There is one recent example: Some time ago I was happy to use such a gimmick, right click on a variable, "Go to definition" and to return to the same variable I pressed the "Back" button on the rat. But today I noticed that it's not working anymore. What's the reason? Yesterday I updated to 2530... I even used some foul language, but suddenly I remembered that I also had to change the cap. I opened ME 2474 and oops..................... and it doesn't work. What if I'd got a text message in my head to write all what I thought about the developers? How would that look?

I mean, don't rush before writing about bugs, look for flaws in your code.

 
Alexey Viktorov:

You won't... I'm all for justice. Don't expose your faults, and everyone has them and so do I, for the bugs of the terminal .

Who's exposing it?https://www.mql5.com/ru/forum/1111/page2795#comment_17290368 . I hope you read it carefully thistime...? How many times do I have to tell you before you finallyget it through yourhead and stop writing nonsense here?

 
Mihail Matkovskij:

Who's putting it up?https://www.mql5.com/ru/forum/1111/page2795#comment_17290368 . I hope you've read it carefully thistime...? How many more times do I have to tell you so that you finallyget it and don't write nonsense here?!

I'm all for fairness.

Forum on trading, automated trading systems and trading strategies testing

Bugs, bugs, questions

Mihail Matkovskij, 2020.07.11 14:47

I have made a source code where this bug occurs:
//+------------------------------------------------------------------+
//|                                           DeleteChartObjects.mq5 |
//|                                      Copyright 2020, © Cyberdev. |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, © Cyberdev."
#property version   "1.00"
#property indicator_chart_window

#property indicator_plots 0

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

#include <ChartObjects\ChartObjectsLines.mqh>
#include <Arrays\ArrayObj.mqh>

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//--- input parameters
input int      nBars = 100000;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int customN_Bars = 0;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
CArrayObj listOfTrendLines;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit() {
//--- indicator buffers mapping
  int totalBars = iBars(NULL, PERIOD_CURRENT);
  customN_Bars = (nBars < totalBars) ? nBars : totalBars;
//---
  return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[]
) {
  CChartObjectTrend * trend;
  int delta = rates_total - customN_Bars;
  int shift;
  int i;
  for(i = 0; i < customN_Bars; i++) {
    shift = delta + customN_Bars - i - 1;
    trend = new CChartObjectTrend();
    if(trend.Create(0, "trend"+(string)i, 0, time[shift], low[shift], time[shift], high[shift]))
      listOfTrendLines.Add(trend);
  }
  return(rates_total);
}

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason) {
  
  CChartObjectTrend * trend;
  
  int i = listOfTrendLines.Total() - 1;
  for(; i >= 0; i--) {
    trend = dynamic_cast <CChartObjectTrend *> (listOfTrendLines.At(i));
    
    if(CheckPointer(trend) == POINTER_INVALID)
      continue;
    
    delete trend;
  }
}
//+------------------------------------------------------------------+

Actions to demonstrate the bug.

Throw the indicator on the chart.

2. Remove the indicator from the chart.

3. press Ctrl+B, then press "List all" in the window and see the objects that have not been removed.

Objects

I have as many as 294 out of 100000.

If you reduce the value of input parameter nBars, the bug does not appear.


 
Alexey Viktorov:

I'm all for fairness.



So that post didn't say which bug it was, my program or the terminal bug. I thought it was a terminal bug. But Rashid Umarov explained everything to me and I understood him. Everything was very clear to me. There was no terminal bug, I was wrong in my assumptions. You are following me with some kind of manic enthusiasm. I asked you what the reason was, you told me:

You would have shut up a long time ago and I wouldn't have continued.

That's the reason...

Will you stop this nonsense! An adult (I hope)...

 
Mihail Matkovskij:

So that message didn't say which bug it was, my program or the terminal's bug. I thought it was a terminal bug. But Rashid Umarov explained everything to me and I understood him. Everything was very clear to me. There was no terminal bug, I was wrong in my assumptions. You are following me with some kind of manic enthusiasm. I asked you what the reason was, you told me:

That's the reason...

Will you stop this nonsense! An adult, I hope...

All right. In a tumbleweed, I've changed my shoes. Reported it as a terminal bug and ............ you live your life as you know it.

 
Connecting the storage facility

https://storage.mql5.io it is not possible to log in.

Reason: