Errors, bugs, questions - page 38

 

A problem has arisen, I don't know where to put it.

here's the code section I'm interested in:

      Print("itogo do=",itogo);
      if(itogo>1000)
        {
         Print("itogo>1000 =",itogo);
         itogo=500;
         Print("vsego_if=",itogo);
        }
      Print("itogo posle=",itogo);
      Print("+-----------------------------------------------------------+");

It says that first we need to unprint the itogo variable value with the text "itogo do",

then if itogo is more than 1000 then print itogo with the text "itogo>1000 "

itogo is assigned 500

Print itogo with the text "vsego_if=" then leave the protected zone

print itogo with the text "itogo posle="

draw a line.

Why am I going into details?

it should be clear that if there was no condition, there will be two lines between them; if there was a condition, there will be four lines.

We know that when the condition is triggered the value of the variable will change.

The first thing to do is to unprint the itogo do variable, here's the unprinting that shows two printers, so no conditions triggered but the value of the variable has changed.

How can this be ??????????


Here is a screenshot of the code to show that nothing between the lines, somewhere beyond the field boundaries, is hidden.

The code crashes at all, compiles without problems but refuses to work as intended.

The variable is declared globally int, the code itself is big but the prints are nowhere else in the code.

And the most interesting thing with the debugger works fine, but when you run in normal mode, here are such shuffles

and this is not the printers bot by the logic of the program I see that something is wrong.

 

I haven't been able to reproduce it on other examples yet, but this seems to be the solution

Previously there was DebugBreak(); and code was run through debugger, later DebugBreak() was removed and everything was recompiled

but apparently ME remembers that the debugger was used and refuses to work correctly without a debug after compilation.

If I run the debugger, then even at normal startup the script works fine.

 
Urain:

I haven't been able to reproduce it on other examples yet, but this seems to be the solution

Previously there was DebugBreak(); and code was run through debugger, later DebugBreak() was removed and everything was recompiled

but apparently ME remembers that debugger was used and refuses to work correctly without running through it after compilation.

If you run it through the debugger, the script works fine even during normal operation.


And they call it a release?

The potential participant of the 2010 Championship has written an Expert Advisor and debugged it, but the debugger's stuff remains in the code. However, the Expert Advisor works well. However, it works only with "tricks". However, the Participant does not know about that - how could he/she know about such an undocumented feature?

So that participant sent his EA's source code to MetaQuotes for participation in the Championship 2010 and they just compiled it and, of course, the code turned out clean without any "debugger stuff".

The Championship 2010 is on, but MetaQuotes Expert Advisor somehow does not trade the same way as on his or her computer. A participant is perplexed and has all sorts of thoughts...

 
Urain:

A problem has arisen, I don't know where to put it.

I made this code as an example (I put your values):

void Check(int itogo)
  {
   Print("itogo do=",itogo);
   if(itogo>1000)
     {
      Print("itogo>1000 =",itogo);
      itogo=500;
      Print("vsego_if=",itogo);
     }
   Print("itogo posle=",itogo);
   Print("+-----------------------------------------------------------+");  
  }
void OnStart()
  {
   Check(158);
   Check(179);
   Check(202);
   Check(222);
   Check(243);
   Check(261);
   Check(288);
   Check(301);
  }

It worked fine:

2010.07.08 07:00:22     size (EURUSD,D1)        +-----------------------------------------------------------+
2010.07.08 07:00:22     size (EURUSD,D1)        itogo posle=301
2010.07.08 07:00:22     size (EURUSD,D1)        itogo do=301
2010.07.08 07:00:22     size (EURUSD,D1)        +-----------------------------------------------------------+
2010.07.08 07:00:22     size (EURUSD,D1)        itogo posle=288
2010.07.08 07:00:22     size (EURUSD,D1)        itogo do=288
2010.07.08 07:00:22     size (EURUSD,D1)        +-----------------------------------------------------------+
2010.07.08 07:00:22     size (EURUSD,D1)        itogo posle=261
2010.07.08 07:00:22     size (EURUSD,D1)        itogo do=261
2010.07.08 07:00:22     size (EURUSD,D1)        +-----------------------------------------------------------+
2010.07.08 07:00:22     size (EURUSD,D1)        itogo posle=243
2010.07.08 07:00:22     size (EURUSD,D1)        itogo do=243
2010.07.08 07:00:22     size (EURUSD,D1)        +-----------------------------------------------------------+
2010.07.08 07:00:22     size (EURUSD,D1)        itogo posle=222
2010.07.08 07:00:22     size (EURUSD,D1)        itogo do=222
2010.07.08 07:00:22     size (EURUSD,D1)        +-----------------------------------------------------------+
2010.07.08 07:00:22     size (EURUSD,D1)        itogo posle=202
2010.07.08 07:00:22     size (EURUSD,D1)        itogo do=202
2010.07.08 07:00:22     size (EURUSD,D1)        +-----------------------------------------------------------+
2010.07.08 07:00:22     size (EURUSD,D1)        itogo posle=179
2010.07.08 07:00:22     size (EURUSD,D1)        itogo do=179
2010.07.08 07:00:22     size (EURUSD,D1)        +-----------------------------------------------------------+
2010.07.08 07:00:22     size (EURUSD,D1)        itogo posle=158
2010.07.08 07:00:22     size (EURUSD,D1)        itogo do=158

As you can see, there are no errors or inconsistencies in the variable values.

Perhaps you forgot to recompile the code after numerous re-edits and used an old version.

What you need to do:

  • Copy your code from scratch, restart the terminal (for assurance) and check
  • If the error remains, send us the full code via servicedesk (or even in forum) - we will surely check it
 
simpleton:

Stop being hysterical already.

If this error is confirmed, it will be corrected immediately. Software development cannot go on without errors.

 
Renat:

Stop being hysterical already.

If this error is confirmed, it will be corrected immediately. Software development cannot go on without errors.

Renat, I suggest to open the topic "Criticism of MQL5" or something similar. And all such messages from other topics (threads) should be deleted as off-top.

In this way, the critics will have the place to express themselves, and the threads will be arranged.

 

I would like to know the fate of request#18261 foran indicator call from an EA (the value does not match the indicator).

It would be nice if they responded in some way...

Способы вызова индикаторов в MQL5
Способы вызова индикаторов в MQL5
  • 2010.03.09
  • KlimMalgin
  • www.mql5.com
C появлением новой версии языка MQL, не только изменился подход к работе с индикаторами, но и появились новые способы создания индикаторов. Кроме того, появилась дополнительная гибкость при работе с индикаторными буферами - теперь вы можете самостоятельно указать нужное направление индексации и получать ровно столько значений индикатора, сколько вам требуется. В этой статье рассмотрены базовые методы вызова индикаторов и получения данных из индикаторных буферов.
 
ddd06:

I would like to know the fate of request #18261 for an indicator call from an EA (the value does not match the indicator).

It would be nice if they responded in some way...

Your request has been answered. It was advised.

Why it has not been updated in your profile - we will figure it out.

 
Renat:

I made this code as an example (put your values):

It worked fine:

As you can see, there are no errors or inconsistencies in variable values.

It is possible that after numerous re-edits you forgot to recompile the code and used an old version.

What to do:

  • Recopy your code from scratch, restart the terminal (to be sure) and check
  • If you still have the error, send us the full code via servicedesk (or even in the forum) - we will definitely check

And before I posted here did the same, and the result was as you have but here on the sheet where the error initially arose all and crashes.

I repeat the reason in the debugger, if on that particular worksheet did recompilation and did not run through debugging works incorrectly, after a run in the debug all is normal. I don't know why debugger hooked to this particular worksheet, code copies on other worksheets work fine, but this one doesn't.

That's why I wrote above that I can not reproduce the error so far (or rather, it reproduces but only within the localized project).

Perhaps there is a feature of debugger or ME to remember the history of edits, maybe there was a critical error before the incident which I did not pay attention to.

Документация по MQL5: Программы MQL5 / Ошибки выполнения
Документация по MQL5: Программы MQL5 / Ошибки выполнения
  • www.mql5.com
Программы MQL5 / Ошибки выполнения - Документация по MQL5
 
Urain:

And I did the same before I posted it here, and the result was like yours, but on that sheet, where the error originally occurred, everything crashes.

I repeat the reason in debugger, if I recompiled on specific sheet and did not run it through debug works incorrectly, after debugging everything is normal. I don't know why debugger hooked to this particular worksheet, code copies on other worksheets work fine, but this one doesn't.

That's why I wrote above that I can not reproduce the error so far (or rather, it reproduces but only within the localized project).

Perhaps there is a feature of debugger or ME to remember the history of edits, maybe there was a critical error before the incident, which I did not pay attention to.

Do you remember where DebugBreak() was set?

No luck in reproducing it so far.