Errors, bugs, questions - page 1683

 
Breakpoints when debugging inside OnBookEvent do not work -BookEvent event does not occur (subscription exists).
 

The following is written in the indicator code:

I.e. Period() returns int (in this case 0), while it must return ENUM_TIMEFRAMES! At the same time _Period works normally and contains the current timeframe (in this case PERIOD_H1). This is anyway an error since the help for the Period() function clearly indicates it:

Возвращаемое значение

The contents of the _Period variable, which stores the value of the current chart's timeframe. The value can be one of the values of ENUM_TIMEFRAMESenumeration.

 

What advantage is seen in the separate windows that will be through the MT5 build?

 
Vasiliy Sokolov:

The following is written in the code of the indicator:

I.e. Period() returns int (in this case 0), while it must return ENUM_TIMEFRAMES! At the same time _Period works normally and contains the current timeframe (in this case PERIOD_H1). This is in any case an error, because the help for the Period() function clearly indicates it:

maybe without the mql5 file it compiles as for MT4 ?
 
Vasiliy Sokolov:

The following is written in the indicator code:

I.e. Period() returns int (in this case 0), while it must return ENUM_TIMEFRAMES! At the same time _Period works normally and contains the current timeframe (in this case PERIOD_H1). In any case it is an error, because the help for the Period() function clearly indicates it:

You have tf as an enum type. But you write int into it. Take care to write an enum value into it too.
 
Artyom Trishkin:
Period() has the return type ENUM_TIMEFRAMES
 
Комбинатор:
Period() has the return type ENUM_TIMEFRAMES

In five, Period() returns an enum and _Period returns an int.

In Quartet, both the predefined _Period and Period() are of int type.

Since a person gets the implicit enum conversion warning, we conclude that it is a four.

 

How can I find out the time of the accepted glass in OnBookEvent?

You cannot do this with SymbolInfoTick+time_msc, because OnBookEvent is called much more often than OnTick.

You could, of course, store time_msc andGetMicrosecondCount value in OnTick. And then in OnBookEvent we will add the elapsed time to time_msc. But somehow it gets messy, because OnBookEvent will conflict with OnTick - while one is running, the other might be waiting.

 

Please add to the Source column of the Experts log not only the name of the programme (which issued the entry) and the symbol on which it is running. But also the type of program - indicator/advisor/script. And the handle of the chart on which it is running (can be a popup message).

For the same reason (handles), please add a popup of the handle number when hovering over the tabs of the chart.

Please add logging for events such as opening a new chart (along with a handle) and deleting a chart.

 
A succinct example of why const can be useful and how, sometimes, you just can't do without it
void Func( const string &Str ) { } // const - обязателен!

void OnStart() { Func(_Symbol); }