Errors, bugs, questions - page 1954

 
Andrey Barinov:
Bring back the signposts.
Thanks for the idea. I'd forgotten all about them.
 
Alexey Kozitsyn:
Thanks for the idea. I had completely forgotten about them.

That's odd. I geta compilation error from your code.

object of 'B' cannot be returned, copy constructor 'B::B(const B &)' not found

On the GetBMember function description (which in plain English says to create a copy). Is it the latest version of the compiler?

When this problem is fixed by adding a copy constructor B, you can then return const B from the GetBMember method.

Then the compiler will swear at the attempt to make a Reset of the returned variable:

'Reset' - call non-const method for constant object

 
Stanislav Korotky:

That's odd. I'm getting a compilation error from your code.

object of 'B' cannot be returned, copy constructor 'B::B(const B &)' not found

On the GetBMember function description. Is it the latest version of the compiler?

When this problem is fixed by adding a copy constructor B, you can then return const B from the GetBMember method.

Then the compiler will swear when you try to make a Reset of the returned variable:

'Reset' - call non-const method for constant object

This code is just an example written in the browser. I was just wondering why the compiler doesn't report anything. But I've already figured it out.

And, there are no constructors in my example at all:)

 

Hello! 2017.08.03_18:45 GMT+3. I have written an OOP file SignalIchimoku.mqh . But when I need to do simple calculations to LongCondition() and ShortCondition() in a separate function, function is written, compiler gives 0 errors, 0 warnings. But this function doesn't work, no calculations are performed. The program doesn't open the transactions. I checked: I inserted the Print() variable value into the function. This function is similar to StateStoch(int ind), ExtStateStoch(int ind) and CompareMaps() functions in SignalStoch.mqh , a standard file of the standard library. Everything works in the standard file, but it doesn't work for me. Why? Is it "simple rules" again? Who knows -- tell me. If you need details or have any questions, -- write. 18:59 GMT+3.

Files:
 

CCanvas. There's a little bug in the implementation of the FillCircle function. It is one pixel narrower, as can be seen in this GIF animation:

Also, the algorithm is very unreasonably constructed, as about 30% of the points are drawn twice. This is easily solved by moving two lines of code, with a speed increase of 30% on average.
Here is the original version of FillCircle:

void CCanvas::FillCircle(int x,int y,int r,const uint clr)
  {
   int f   =1-r;
   int dd_x=1;
   int dd_y=-2*r;
   int dx  =0;
   int dy  =r;
//--- draw
   while(dy>=dx)
     {
      LineHorizontal(x-dx,x+dx,y-dy,clr);
      LineHorizontal(x-dx,x+dx,y+dy,clr);
      LineHorizontal(x-dy,x+dy,y-dx,clr);
      LineHorizontal(x-dy,x+dy,y+dx,clr);
      //---
      if(f>=0)
        {
         dy--;
         dd_y+=2;
         f+=dd_y;
        }
      dx++;
      dd_x+=2;
      f+=dd_x;
     }
  }

And here's the fixed version:

void CCanvas::FillCircle(int x,int y,int r,const uint clr)
  {
   int f   =1-r;
   int dd_x=1;
   int dd_y=-2*r;
   int dx  =0;
   int dy  =r;
//--- draw
   while(dy>=dx)
     {
      LineHorizontal(x-dy-1,x+dy,y-dx,clr);
      LineHorizontal(x-dy-1,x+dy,y+dx,clr);
      //---
      if(f>=0)
        {
         LineHorizontal(x-dx-1,x+dx,y-dy,clr);
         LineHorizontal(x-dx-1,x+dx,y+dy,clr);
         dy--;
         dd_y+=2;
         f+=dd_y;
        }
      dx++;
      dd_x+=2;
      f+=dd_x;
     }
  }
 

About pending order is deleted (not enough money)

A valid work of the Expert Advisor, is when no errors occur during its operation.

The pending order is deleted (not enough money) is an error.

The matter is that it is theoretically impossible to track the necessary margin for opening an order, if it is opened with a slippage.

For example, we have established and calculated that there is enough money to open a pending sell stop order at 1.500. (At 1.499 there isn't any more.)

The current price is 1.501.

The next tick and we have a price of 1.499.

An attempt to open an order and an error.

Therefore, we have initially considered the situation when this error cannot be avoided 100%.

Or have I missed something?

 

I can't figure out how to pull mqh files from a subdirectory of the folderExperts.

how to pull mqh files from the One folder to the Two folder ?

 
Vladimir Pastushak:

I can't figure out how to pull mqh files from a subdirectory of the folderExperts.

how to pull mqh files from the One folder to the Two folder ?


solution found. If the file, to which you want to connect the injector, is located in Test\One, and the injector in Test\Two, then...

It goes like this:

#include "..\Two\name.mqh""
It turns out: ..\ - from One go to Test and Two\name.mqh - from Test go to Two and select the file name.mqh
 
the profile does not show "my messages"

and in other people's profiles
 
Vladimir Pastushak:

solution found. If a file to which you want to connect an inluder is in Test\One, and an inluder in Test\Two, then...

Like this:

It turns out: ..\ - from One go to Test and Two\name.mqh - from Test go to Two and select file name.mqh

There are such constructs:

#include "..\..\Two\name.mqh"
Reason: