Errors, bugs, questions - page 1520

 
Slawa:

There is no other way yet.

We have discussed introducing a new exit command that would immediately terminate the program, but there are unresolved issues here

That's too bad. Yes, an exit() like in C++ would be nice. Nowadays pulling the response of nested functions into the caller one is rather problematic. And there are no universal libraries.
 
Alexey Kozitsyn:
That's too bad. Yes, an exit() like in C++ would be nice. Nowadays, pulling the response of nested functions into the calling one is rather problematic. And there are no universal libraries.
Another way is to create a function that removes all the objects of a program separately and call it when the condition for removing the program from the terminal is met, followed byExpertRemove(), in this case everything should finish faster... although not for sure :)
 
coderex:
Alternatively, you can create a separate function to delete all the objects of the program and call it when the condition to delete the program from the terminal is met, followed byExpertRemove(), in this case it should terminate faster... though not for sure :)

As I've written before, and was suggested before in an article on this site, in case of an error in a deep nested function, you can call division by 0 or exit outside the array. But it is not nice.

Yes, and it's not only in OOP (as far as I understood, you mean it). Simply - if an error cannot be fixed, the program will be terminated.

 
Slawa:
Stops, but not immediately
I don't understand, is ExpertRemove() correct to work with in indicators or not?
 
Alexey Kozitsyn:
I do not understand, is it correct to work with ExpertRemove() in indicators or not?

I think there is a function for indicators, or it is not relevant anymore

ChartIndicatorDelete();
 
Alexey Kozitsyn:
I do not understand, is it correct to work with ExpertRemove() in indicators or not?

No. ExpertRemove() is overlapped in the indicators.

"Stops, but not immediately" is said about ExpertRemove in general. This function does not interrupt program operation.

 
Slawa:

No. ExpertRemove() is overlapped in the indicators.

"Stops, but not immediately" is said about ExpertRemove in general. This function does not interrupt the operation of the program.

In general, is there a plan to solve the issue with exit()? Or do users solve it via crutches?)
 
Slawa:
Please give an example. Give the source code of the indicator to illustrate the problem
Insert the text into the OnCalculate of the default indicator created in the redactor. Place it on any chart. You will see the operation of the indicator in the upper left corner of the chart window. After selecting "Delete" from the list of indicators, it will not stop working, you will see it in the upper left corner. It will continue even after the window is closed. After opening a new window, it will continue in the new window. Moreover, this window does not necessarily have the same symbol as the one you had at the beginning :)
The work of the indicator stops only when the terminal is closed. And I don't know whether it stops or not - I just had to manually remove the terminal via Task Manager to restart it...

At the same time, the IsStopped function's help says that the program operation is stopped after 3 seconds if there is a command to terminate an mql-program.

   int i=0;
   while(true){
      Comment(i++);
      Sleep(100);
   }

And if while(true) is replaced with while(!IsStopped()), the indicator completes successfully when removed from the chart.

 

A funny reason for the Internal Compiler Error ( function used in the indicator):

void SaveData ( uint handle_, int wrdata_, int interv_, string dpath_, int tmode_, int tmult_, long ctime_, long& ltime_ )
{
int ierr, wrtint;
// ----
if ( interv_ > 0 ) // work mode
{
if ( MQLInfoInteger ( MQL_TESTER ) == 0 ) { wrtint = interv_; } // has no meaning
else{ wrtint = interv_ * tmult_; } // doesn't matter
//
if ( ( ctime_ - ltime_ ) >= ( wrtint * 60 ) ) // if this line is commented out, the error will disappear
{
// some code to save the data ... has no meaning - tested
//
ltime_ = ctime_; // in general does not matter either
} // if ( ( ctime_ - ltime_ ) >= ( wrtint * 60 )
} // if ( interv_ > 0 )
// ----
return;

} // void SaveData

( Sorry, I didn't use SRC button intentionally, because I can't select the necessary parts of the text with it )

The cure is obvious, but you should agree - it's a rather funny glitch. :)))

 

One brokerage company has a commission of 16x2 dollars for a turnover of 1 million. They have apparently set a commission of 16 dollars in the server settings. And now when testing on their server commission 16x2 is deducted from each transaction regardless of its lot size, i.e. adequate test can be done only with 10 lots.

Is it their lack of skill in setting servers or a real limitation of MT5? What exactly can I advise them to do on the servers, so that the commission is processed correctly in the tester?