Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1484

 
Alexey Viktorov:

The default is 1. And if announcing the number of constructions doesn't help, then proceed to option B.

Thanks, I'll keep that in mind.

The problem was, as you said, in the initialisation.

 
Good day to all! As far as I understood, int start() orvoid start() function is obsolete, but works for now. Now you should use void OnStart() instead of it. But here is an observation. In an indicator that does not require working with arrays I replace int OnCalculate() with start() - the indicator works, but its replacement with OnStart() breaks it. It turns out thatstart() and OnStart() are not equivalent? And is it worth using start() or it will stop working at all after the next MT4 update?
 
Oleksandr Nozemtsev:
Good day to all! As far as I understood, int start() orvoid start() function is obsolete, but works for now. Now you should use void OnStart() instead of it. But here is an observation. In an indicator that does not require working with arrays I replace int OnCalculate() with start() - the indicator works, but its replacement with OnStart() breaks it. It turns out thatstart() and OnStart() are not equivalent? Is it worth using start() or it will stop working at all after the next MT4 update?
OnStart for scripts and services
 
Vladislav Andruschenko:
OnStart for scripts and services

So is start() for scripts, but it works in the indicator. I want to understand, is it even usable?

 
Oleksandr Nozemtsev:

So is start() for scripts, but it works in the indicator. I want to understand, can it be used at all?

OnStart cannot be used in indicators

start was previously used for everything: Expert Advisors indicators scripts stratstop

 
Vladislav Andruschenko:

OnStart cannot be used in indicators

start was previously used for everything: Expert Advisors indicators scripts stratstop

Got it. Thank you!

 
Vladislav Andruschenko:

OnStart cannot be used in indicators

start was previously used for everything: Expert Advisors indicators scripts stratstop

POSSIBLE...

at that the indicator behaves like a script, if OnStart is present - it is executed and upon its completion the __indicator__is unloaded

Because of the fact that indicators are executed in the chart flow, until OnStart is finished, the chart will be "suspended".

 
Do you know if it is possible to change the colour of stop levels for pending orders in one chart, while the colour of stop levels of existing positions will remain the same, because it is uncomfortable when the chart has several stop levels of the same colour and is not clear which of them belongs to the position, and which to a pending order. Maybe, we may add a comment to stop levels or have some other version of their differentiation on a chart? I need it for a script, it is clear that for an EA this aspect can be bypassed.
 
Maxim Kuznetsov:

POSSIBLE...

at the same time the indicator behaves as a script, if OnStart is present - it is executed and after it is finished the __indicator__ is unloaded

Because of the fact that indicators are executed in the chart flow, until OnStart is finished, the chart will be "suspended".

Is this a non-standard feature?
 
Maxim Kuznetsov:

POSSIBLE...

at the same time the indicator behaves as a script, if OnStart is present - it is executed and after it is finished the __indicator__ is unloaded

This is due to the fact that indicators are executed in the chart flow, until OnStart is complete, the chart will be "suspended".


checked.

In MT4 - OnStart is running in the indicator!

sfesf


the indicator is not unloaded


In MT5 - OnStart is not executed in the indicator!



So it's more of an omission that it's not banned in mt4.

Files: