Need help from MT4 developers and programmers - page 3

 
A fixated expert is a mauvais ton.
 
Integer:

2. Halfway through the new fiche. Previously, the properties window of the looped Expert Advisor didn't open. Now it does, and it would be good if now there was a reaction to parameter changes. Or, the properties window could be closed to avoid confusion for the user.

Exactly! That's what I'm trying to say, but no one hears it.

The "service Desk" refused, as far as I think they did not understand the situation at all. Here's an excerpt from the request message:

Why would you tell a programmer what he can and can't do? The broadcast went through without errors. Execution goes without errors. The user sees "A=5" in the input parameters tab, and the system gives "A=1" to the Expert Advisor. Whether to use the start() or while() loop is a matter of taste. The loop is not infinite, as you claim. If you have carefully watched the text of the Expert Advisor, it is not while(true), but while(!IsStopped()&&IsConnected()&&IsExpertEnabled()). In the previous MT4 builds the user could not change values of the input parameters during the Sleep() function execution. In the new build there is no such barrier anymore. So, either return the ban on changing input parameters in this situation, or DO MAKE SURE THEM CHANGE NOT ON THE"INPUTS" tab ONLY, BUT ON THE COUNTER. That's it.


Integer:

1. When I installed MetaTrader4 terminal, in the installation window there is an invitation to the forum, this forum and not another.

My apologies. But I noticed that the line between MT4 and MT5 is gradually disappearing. And it was from my profile on "www.mql5.com" that I applied to "servicedesk" (hopefully for the first and last time). I filled in a form that clearly shows you the possibility to choose the version of the terminal - I chose "MT4".

Here is another excerpt from an already closed order (I do not know if they read the order after they hastily close it themselves?) (of course, funny, but I can only think of a proverb about catching fleas).

In such a case, why does the user clearly see their new values? While the EA can function in full, these new values are a fiction, and they are not available to the EA. The RefreshRates() function allows the EA to get the current quotes in ANY cycle. Why not provide a similar function for getting updated values of input parameters or add this feature to the existing RefreshRates() function?

Pressing the "AutoTrading" button twice (to switch the EAs off and on) does break the cycle, after which the new values become available, but only after a tick (new quote) on the GRAPHICS SYMBOL. And we do not know when it will come, and the Expert Advisor is not forbidden to process other symbols as well, and the user does not need this time loss. So we get something like "back to the future". A new MT4 has been released. It is more modern, faster. They say that it slows down very well on the screen, waiting for quotes of ONE symbol, while the quotes of other symbols are in full swing. That is, now I tell my clients: change the parameters, press the "Expert Advisors" button twice to turn them off and on, and wait by the sea - someday it will "tick".

I've never asked for help before and hopefully won't in the future. Sooner or later I will find a way round the "hook" anyway. This has always been the case, as long as MT4 and of course its"strategy tester" exist, which I'd rather not talk about now. But of course any real-time inaccuracy is a very serious thing, especially for a user who is putting his money on the line, sometimes for quite large sums. As I've seen no other efficient way around this bug, I've turned to 'service-desk' and, to be honest, was a bit doubtful that they'd even refuse to fix it. Well...

It's bad enough that everything has to be done "despite" rather than "thanks to".

 
Integer:
Wex, use a timer, you can do without looping now.

You are right, of course, new EAs can be programmed very differently. But there are many already well-programmed EAs. And customers do not understand why the thing for which they have paid money suddenly stops working correctly.

That is, there is some very unpleasant trend of incompatibility in principle of already developed EAs (Expert Advisors or scripts, even indicators) with new builds of MT4.

And I didn't use anything non-standard in programming as a matter of principle. My EA is based solely on MQL4 BOMB features and functions. I was already flooded with lots of indicators and EAs (mostly complex ones or so called "multicurrency ones"), which either do not work at all on new builds of MT4, or seemingly work fine, but situations like in my example appear. (As for translation errors, I noticed, for example, variables with name "new" - I understand - because of expansion of the list of reserved words).

 

One is too lazy to read the documentation. The rest show they're very clever... Phew!

Catch the code :)

I still don't know what your problem is.

//+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2012, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
#property copyright     "Grizzly_v :)"
#property link          "http://www.mql5.com"
//+------------------------------------------------------------------+
extern int      A1=      1;
extern int      A2=      2;
int      C1,C2;
//+------------------------------------------------------------------+
int OnInit(){
   C1=A1;
   C2=A2;
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
void OnDeinit(const int reason){
   Comment("");
}
//+------------------------------------------------------------------+
void OnTick(){
   string   t;

   t=TimeToStr(TimeCurrent(),TIME_MINUTES|TIME_SECONDS);
   Comment(t+"\nA1="+A1+"   A2="+A2+"\nC1="+C1+"   C2="+C2);
}
//+------------------------------------------------------------------+
 
grizzly_v:

One is too lazy to read the documentation. The rest show they're very clever... Phew!

Catch the code :)

I still don't know what your problem is.

The problem is that the Expert Advisor is looped, so the OnTick event doesn't occur in it and it doesn't see changed parameters.
 

Well, that's it then. The same cycle only through the new functions.

  extern int      A1=      1;
  extern int      A2=      2;
         int      C1,C2;
//+------------------------------------------------------------------+
int OnInit(){
   C1=A1;
   C2=A2;
   EventSetMillisecondTimer(100);
   return(0);
}
//+------------------------------------------------------------------+
void OnDeinit(const int reason){
   EventKillTimer();
}
//+------------------------------------------------------------------+
void OnTimer(){
   string   t;
   RefreshRates();
   t=TimeToStr(TimeCurrent(),TIME_MINUTES|TIME_SECONDS);
   Comment(t+"\nA1="+A1+"   A2="+A2+"\nC1="+C1+"   C2="+C2);
}
//+------------------------------------------------------------------+
 
stringo:

1. Take a look at Wex's profile. This is a professional MQL4 developer. Playing dumb. Or trolling. I don't know why.

2. We need to think about this. You cannot forcefully interrupt the loop when new parameters come. Something like the IsNewParameter function which should be called by the programmer himself/herself in the endless loop

1. I also noticed the weirdness...

2. That would be very nice.

 
stringo:

1. Take a look at Wex's profile. This is a professional MQL4 developer. Playing dumb. Or trolling. It's not clear why.

2. this is where we need to think. We cannot forcefully interrupt the loop on arrival of new parameters. Something like the IsNewParameter function which should be called by the programmer himself/herself in the endless loop

Stringo.

The variable just doesn't seem to get into such an eternal loop. The init method does not work when values are changed. And external variables are passed only through init. The OnTick and OnTimer functions can be used in Expert Advisors now,

OnChartEvent. As far as I remember, the start function in Expert Advisor was triggered at a new tick.

Excerpt from the documentation:

The program receives events only from the chart on which it is launched. All events are processed one after another in the order they are received. If there is already an event NewTick in the queue or if this event is in the processing state, a new event NewTick is not placed in the queue of the mql4-program. Similarly, if the queue of the mql4-program already contains the ChartEvent event or such an event is being processed, a new event of this type will not be placed in the queue. Timer events are processed according to the same scheme - if there is or there is already an event Timer in the queue, then a new event of this type will not be placed in the queue.

So, since the start function loops around infinitely, when a new event occurs, the function will not start and the variables inside it will not be updated.

There is only one way out, use the new features of the language and do not bother with the old functions.

События клиентского терминала - Документация на MQL4
  • docs.mql4.com
События клиентского терминала - Документация на MQL4
 
artmedia70:

1. I've noticed the oddity too...

And in someone else's eye you can always see even a straw. And the more logs in one's eye, the smaller the straw can be discerned.

In any business, it is the result, not the process, that counts. The result is this: black is presented as white - literally - not figuratively - the executive system shows the user another value instead of one. WHERE this is done - inside some function, or outside of it - does not matter. A real-time multitasking system is capable of handling several processes simultaneously. In that process, the Sleep() function "runs" most of the time and does not consume any system resources at all. This is the classic thing that is essentially used to suspend the process. All other processes can run unhindered.

- Comrades, can we fulfill the plan at 102%?

- ... Yes, we can.