Errors, bugs, questions - page 1741

 
typename generates a string at compile time, which is why you need to "pull the tails".


Do you want to get the actual type of object by pointer?

Something like a function:

string GetPointerTypename(void *ptr);
 
Ilyas:
The typename generates a string at compile time, which is why you need to "pull the tails".


Do you want to get the actual object type by pointer?

Something like a function:

string GetPointerTypename(void *ptr);

Yes. Here.

Stanislav Korotky:
I would like to make it more subtle. But how? In MQL,typename(this) in virtual base method returns the base class. In C++typeid(*this).name() in base virtual method returns the actual object class.

 
fxsaber:
Is this only a feature in Profile Publications?
It was fixed this afternoon. Now it's happening again.
 

I can't seem to get it together.

int a=1;//a1
int b=2;//b1
int aa(int a, int b)
{
return(a+a+b+b);
}

one of the a and b in return should be external //a1 and //b1. It doesn't go through this.

 
Yuriy Asaulenko:

a + ::a + b + ::b

But in general, you should get a slap on the wrist for such a practice.

 
Комбинатор:

a + ::a + b + ::b

But in general, you should be punished for such a practice.

Thanks) I don't have a C++ book handy. But visually I remember it seemed to have this in it. I must have forgotten about it. I've never used it for this purpose before. Well, now I have to change the variable everywhere - now.

Well, actually this is what it was designed for. So you're wrong. You shouldn't abuse it.

 

When dragging(CHARTEVENT_OBJECT_DRAG) a graphical object OBJ_CHART with mouse, the current display interval in OBJ_CHART is reset.

Please remove this reset in the next build.

 

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

Ilyas, 2016.10.18 09:24

Why don't you include the initialization list in the body? Figuratively speaking, a class object (including its this) is initialised on the ':' sign
Why then?
class A
{
  const int a;
  
  A() : this.a(0) {} // 'this' - struct member undefined && '.' - member(s) initialization expected
//  A() : a(this.a) {} // no problem
};
 

Identifier

Description

Property type

CHART_COMMENT

Text of the comment on the chart

string

CHART_EXPERT_NAME

Name of the Expert Advisor launched on the chart with the specified chart_id

string

CHART_SCRIPT_NAME

Name of the script that runs on the chart with the specified chart_id

string

Add in bold read-only in Help.
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы графиков / Свойства графиков
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы графиков / Свойства графиков
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы графиков / Свойства графиков - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 

A lot of time spent on localisation. EA

class CHARTOBJECT
{
public:
  const string Name;
  const long Chart;

  int GetSubWindow( void ) const
  {
    const ulong StartTime = GetMicrosecondCount();
    
    const int Res = ObjectFind(this.Chart, this.Name);
    
    Print((string)(GetMicrosecondCount() - StartTime) + " mcs.");

    return(Res);
  }

  CHARTOBJECT( const ENUM_OBJECT object_type, const long chart_id = 0  ) :
               Name((string)MathRand()), Chart(chart_id)
  {
    ObjectCreate(this.Chart, this.Name, object_type, 0, 0, 0);
  }

  ~CHARTOBJECT( void )
  {
    if (this.GetSubWindow() != -1)
      ObjectDelete(this.Chart, this.Name);
  }
  
  long GetProperty( const ENUM_OBJECT_PROPERTY_INTEGER Property, const int Modifier = 0 ) const
  {
    return(ObjectGetInteger(this.Chart, this.Name, Property, Modifier));
  }
};

CHARTOBJECT Chart(OBJ_CHART);
CHARTOBJECT* Bitmap;

void OnInit()
{
  Bitmap = new CHARTOBJECT(OBJ_BITMAP_LABEL, Chart.GetProperty(OBJPROP_CHART_ID));
}

void OnDeinit( const int Reason )
{
  Bitmap.GetSubWindow();
  
  delete Bitmap;
}

After you remove it from the chart, there will be a log output

2016.10.22 19:35:51.362 Test9 (AUDCAD,M1)       Abnormal termination
2016.10.22 19:35:48.351 Test9 (AUDCAD,M1)       3005619 mcs.

Three seconds it was removed and out. Reproduced only in release version. During debug all is normal.

Please confirm with yourself. In script mode, play it did not work. Only the EA.