Errors, bugs, questions - page 117

 
Interesting:
It is more convenient to write a function that converts a number to a period.
Not every int is converted to enum, it will compile, maybe without errors, but at runtime it will crash. This all is of no use. The example was cited as a proof of a bug but there is no such a bug!
 
Valmars:
Not every int is converted to enum, it will compile, maybe without errors, but at runtime it will crash. All this is of no use. This example was cited to prove a bug but there is no such a bug!

It is clear that not every int, but nobody forbids handling this situation correctly in a function.

Well, it depends on who is going to write the functionality and how. Of course, it is important how it will be used afterwards.

To work with periods, you will need, say, 4 functions: SecondsToPeriod(), PeriodToSeconds(), IntToPeriod() and PeriodToInt().

I think these 4 functions are enough to convert int to period and vice versa...

There must not be errors when converting a period into something that has int value, since the periods are known beforehand, but if there is a problem when converting an int into a period, we will return PERIOD_CURRENT.

PS

> If the parameter is int, you have to cast it to the required type.

That's exactly what I meant here....

int handle=iCustom(NULL,(ENUM_TIMEFRAMES) ТМ,....);
 

When you start to write a reserved word and it appears in the context menu, when you select it (press inter), it is added to what has already been written. For example str - choice, get strstring. If you wrote strin - choice, then respectively strinstring

 
Dmitriy2:

When you start to write a reserved word and it appears in the context menu, when you select it (press inter), it is added to what has already been written. For example str - choice, get strstring. If you wrote strin - choice, then respectively strinstring

But why do I have to press Enter? I just hit the space bar and everything is OK.
 
Yedelkin:
Why do I have to press Enter? I press the space bar and it's OK.
If I press the space bar, only the letters I've written with a space bar remain...
 
Dmitriy2:

When you start to write a reserved word and it appears in the context menu, when you select it (press inter), it is added to what has already been written. For example str - choice, get strstring. If you wrote strin - a choice, then respectively strinstring

That's weird. I'm fine.

before pressing [enter] and after

 

Do I understand correctly that the deinit(); procedure in the indicators is not yet initiated when the timeframe is changed and the chart is closed?

but the help says that

Событие Deinit также генерируется при завершении работы клиентского терминала, при закрытии графика, непосредственно перед сменой финансового инструмента и/или периода графика,

Strange...
 
Urain:

It's weird and I'm fine

before you hit [enter] and after

that's when you start a line...

Try doing it in the middle of the code.

 
Dmitriy2:

that's if you do the lines first...

Try doing this in the middle of the code (line)

Yeah, I see, there is such a thing if you add to the finished word a new beginning, then slips such a glitch.

But if you add at the end, it's normal. Probably a bug, knock on the service desk.

 

Good time all.

Who knows how to correctly calculate GMT time based on local and server time (must include daylight saving time/winter time and time zone)?

I saw an example of calculation of daylight saving time somewhere in MQL4 forum, but cannot find... :(