Errors, bugs, questions - page 3188

 
i can't mane any  new request for my right now project and i can't connect with service desk also so what should i do next i make project about 150$ and my developer is not provide me what i need it so please help me support of MQL5 website
Contact Us
Contact Us
  • www.mql5.com
Send your messages and see the history of your requests to the mql5.com support team even if you are not registered on the website.
 
Guys I need help I wanna set up my security but I've been waiting for my phone number verification for a while now the code hasn't arrived yet and it's been weeks
 
Jeemiya #:
Guys I need help I wanna set up my security but I've been waiting for my phone number verification for a while now the code hasn't arrived yet and it's been weeks
sms is not receiving so what to do: summary thread: 
What to do if I am not receiving the verification SMS from MQL5.com to my phone?
how to change security phone no. verification to telegram verification.
how to change security phone no. verification to telegram verification.
  • 2023.04.02
  • www.mql5.com
Hello friends, i have a problem, how to change security phone no. verification to telegram verification. My telegram button is not enabled...
 

Hi!

Two possible bugs - or actually bad coding in the base libs. 

I'm trying to create a code that, upon pressing a key, charts are going to appear showing my trade results (similary to the terminal's report system). For that, I'm using the CPieChart class that comes with the Terminal installation. While using it, two bugs started to appear:

1) The class makes use of an "CArrayDouble" instance, "m_values", which seems that it is never being deleted specially not in the Destroy() function, leading to warning messages of "memory leaked" in the Terminal's logs.


Unfortunately I'm not being able to to replicate the exact conditions which 100% of the time produced this, but it has to do with using a global instance of CPieChart and calling CreateBitmapLabel more then once over that same instance even after calling "Destroy".

2) The other problem can also be seen in the print above: a zero divide error that unfortunately doesn't tell exactly where in the code the problem is; and it's in the class', not in mine. It can be reproduced with the following code, run a key is pressed in the Terminal:

if (!glTestVisible)
{
        glTestVisible = true;
        
        glTestPieChart.CreateBitmapLabel("Teste",50,100,300,250);
        glTestPieChart.ShowPercent();
        glTestPieChart.LegendAlignment(ALIGNMENT_TOP);
        
        glTestPieChart.ValueAdd(7,"Test1");
        glTestPieChart.ValueAdd(4,"Test2");
}
else
{
        glTestVisible = false;
        
        glTestPieChart.Destroy();
}

In the first click, the Pie chart opens fine; in the second, it disappears fine. But when the next key is pressed, instead of showing the same pie chart again, a black square appears together with the message of divide by zero. Unfortunately it's difficult to find where the division happens since the coder doesn't use spaces inbetween logic and math operations in the code, so any search for "/" shows a thousand "//" everywhere :T And it might even be in one of the more basic classes CPieChart uses.

 
Martin Bittencourt #:

2) The other problem can also be seen in the print above: a zero divide error

Well after some time, I managed to find out where the divide by zero is: when a legend is added, functions such as CChartCanvas::DrawLegendHorizontal are called and, at their end, there is a division by "cols" which might be zero. Not knowing the messy code, I couldn't find quickly why this variable may end with a 0 value.

Ah and about the leaked memory, there is an identical problem with CLineChart, this time related to the variable m_values of type CArrayObj. For now it seems that creating a new Destroy function inside these 2 classes that includes a deletion of the respective arrays does the trick.

 

Complements: Further work with CPieChart and CLineChart show new problems with these classes.

3) If I call "Resize", the graphs become buggy unleast the Redraw function is called again. I noticed this when I decided to include a feature where, whenever the chart would have its dimensions changed, the line graph would have its horizontal size updated. Since the Redraw function is from a parent class and is protected, this mean creating a new function inside the two classes that call for "CChartCanvas::Redraw()".

4) In one case, I neded to plot the values 15 and 9 in the pie charts and what happens is that it just bugs; any other value such as 14 + 9 ou 16 + 9 or 15 + 8 or 15 + 10 don't produce the bug:


I'm yet incapable of understanding why such specific pair of values would lead to a bug when all the others seems fine.

 

Another bug, this time in CLineChart:

5) If the Y axis is changed by the addition of a VScaleMin value, that value ends up in the line chart. So if Y Min is set to 1000 and the current data is 5000, the value in the chart will be 6000. To solve this bug, I edited the y2 values in CLineChart::DrawData to reduce the value of the Y Min, m_v_scale_min, from the desired value:

int y2=(int)(m_y_0-(data[0] - m_v_scale_min)*m_scale_y);

//...

y2=(int)(m_y_0-(value - m_v_scale_min)*m_scale_y);

I just don't know how this may impact in the "FillTriangle" uses of this function, but at least the LineAA use seems fixed.

 
Martin Bittencourt #:
- m_v_scale_min

A correction of my previous post: the actual correction of "void CLineChart::DrawData(const uint index)" seems rather to be:

const double compFact = m_v_scale_min > 0.0 ? m_v_scale_min : 0.0;

int y2=(int)(m_y_0-(data[0]- compFact)*m_scale_y);

//....

y2=(int)(m_y_0-(value- compFact)*m_scale_y);

Otherwise it may still bug under certain conditions.

 
I wrote an expert and probably saved it in Unicode by mistake. Now I changed my Windows and I want to open this file again in the new MetaTrader 5. It opens like this. What should I do to get the source text of my expert?
Files:
1.gif  26 kb
 
touhid Qolizadeh #:
I wrote an expert and probably saved it in Unicode by mistake. Now I changed my Windows and I want to open this file again in the new MetaTrader 5. It opens like this. What should I do to get the source text of my expert?
That file is broken, you need to copy it again from your original source, or backup.