Questions from Beginners MQL5 MT5 MetaTrader 5 - page 595

 
Slava_kornev55:
Ahhhh, I know. I couldn't find an owl like that.
Here, practice.
 
Alexander Antoshkin:
Apparently a parenthesis or an inverted comma needs to be drawn somewhere, I don't understand ............. I looked at similar examples, it seems to be the same ,,,,,,,,,,,

specify the function and its constant DeleteOrder(ticket) if you need it and it should work

How to correctly write a constant in a call to another function

For example, here is a function:

then I write another

What does the compiler say exactly?
 
Can you please tell me if the deinitialisation function in the EAs and indicators is executed when the terminal is closed?
 
-Aleks-:
Can you please advise whether the function of deinitialization is executed in advisors and indicators when closing the terminal?

Execution of programmes.

Loading and unloading indicators

Indicators are loaded in the following cases:

-attachingan indicator to a chart;

-startof the terminal (if an indicator was attached to a chart before the previous closing of the terminal)

-loadingof a template (if the template contains an indicator attached to the chart)

-changeprofile (if an indicator is attached to one of the profile charts);

-changethe symbol and/or period of the chart, to which the indicator is attached;

- after thesuccessful recompilation of an indicator, if this indicator has been attached to a chart

-change ofindicatorinput parameters.

Indicators are unloaded in the following cases:

- whendetaching an indicator from a chart;

-closingof the terminal (if an indicator is attached to a chart);

-loadingof a template, if an indicator is attached to a chart

Closethe chart to which an indicator has been attached; - Close the terminal (if an indicator has been attached to the chart)

-Changinga profile, if an indicator is attached to one of the charts of the profile to be changed;

-Changingthe symbol and/or period of the chart, to which the indicator is attached;

-Changing theinput parameters of the indicator.

Loading and Unloading of Experts

Loading of an Expert Advisor is performed in the following cases

-attachingthe Expert Advisor to the chart;

-startof the terminal (if the Expert Advisor was attached to the chart before the previous close of the terminal);

-loadingof a template (if an Expert Advisor has been attached to a chart)

-Aftersuccessful recompilation of the Expert Advisor (if the Expert Advisor has been attached to the chart)

-Profilechange(if the Expert Advisor is attached to one of the profile charts);

-connectionto the account, even if the account number has not been changed (if the Expert Advisor has been attached to the chart before the terminal authorization on the server).

Unloading of the Expert Advisor attached to the chart is performed in the following cases

- whenthe EA is detached from the chart;

-whenattached to a chart - if another Expert Advisor has already been on the same chart, the Expert Advisor will be unloaded;

-closingthe terminal (if an Expert Advisor has been attached to a chart);

-loada template, if an Expert Advisor has been attached to the chart;

-Closethe chart, to which the Expert Advisor has been attached;

-Changinga profile, if an Expert Advisor is attached to one of the charts of the profile to be changed;

-Changingthe account to which the terminal is attached (if the Expert Advisor has been attached to the chart before the terminal authorization on the server);

-callof theExpertRemove() function.

When the symbol or timeframe of the chart to which the Expert Advisor has been attached is changed, the Expert Advisor will not be unloaded or loaded. In this case, handlersOnDeinit() on the old symbol/timeline andOnInit() on the new symbol/timeline (if available) are consistently called, values of global variables andstatic variables are not reset. All events received for EA before completion of initialization (OnInit()) are skipped.

OnDeinit

The Deinit event is generated for Expert Advisors and indicators in the following cases

-beforere-initialization due to change of a symbol or period of a chart, to which an mql5-program is attached;

-Before reinitialization dueto a change ofinput parameters;

-Beforeunloading of an mql5-program.

 
Sergey Gritsay:
What does the compiler say exactly?
 
Alexander Antoshkin:
without full code it's hard to understand, but I suspect you have the sameticket variable name declared globally and locally in theDeleteOrder function, change the variable name
 
Karputov Vladimir:

Programme execution.

OnDeinit

Thanks, but there is a suspicion that OnDeinit.... does not always work when the terminal is closed.

 
-Aleks-:

Thanks, but I suspect that OnDeinit.... does not always work when the terminal is closed.

Do an unsetting in OnDeinit(). Then we can talk more substantially.
 
Sergey Gritsay:
Without full code it's hard to understand, but I suspect you have the sameticket variable name declared globally and locally in theDeleteOrder function, change the variable name

Yeah, I got it.

Thanks for figuring it out!

 

Am I stupid or is this the way it should be?

There were 5 buy positions open, the trawl triggered and moved the Stop Losses, the price rolled back and 4 positions closed and one remained open with the stop level above the price. There is nothing in the log but records of closing 4 positions.

Reason: