Errors, bugs, questions - page 3078

 
fxsaber #:

The visualiser is far from always synchronised with the trading environment. That is, it may show old information. The up-to-date one is always in the EA.

This is a very common issue, when the EA says one thing, but the Visualizer shows something else.

I have a good idea. I got it, thank you. Basically, the EA has continued working logically and the order has indeed been executed, but visually it is visible only later.

 
Igor Petrov #:

Okay. Understood thanks . Basically the EA works further logically, and the order is really executed only visually it can be seen later.

To see the synchronised situation at the right moment, you have to wait for the next tick after stopping the tester.

For example, you can fast-forward five seconds BEFORE the interesting moment, then press pause and by F12 roll through each next tick. All these ticks will be rendered correctly.


It is possible to identify the lag in the comment of the current tick time (with the accuracy to milliseconds) and by comparing it with what is shown in the Market Watch window of the visualizer. If there is a discrepancy, it is a desynchronisation.


If there is a discrepancy, it is a dyssynchronization of the visualizer when the debugger stops (or when you press pause), of course, should have been done a long time ago.

 
Igor Makanu #:

BarsCalculated()https://www.mql5.com/ru/docs/series/barscalculated

what does it return? - is it just a number that the indicator returned to return(rates_total) after the calculation in OnCalculate()?

check it out - yes BarsCalculated() is return(rates_total)

ind A:

int OnCalculate...
{
   static int cnt = 0;
   cnt++;
   Print("cnt = ", cnt);
   return(cnt);
}

ind B:

int OnInit()
{
   handle = iCustom(NULL, PERIOD_M1, "tst_code\\A");
   return(INIT_SUCCEEDED);
}
int OnCalculate...
{
   double tmp[];
   int bc = BarsCalculated(handle);
   if(bc == -1) return(rates_total);
   int copy = CopyBuffer(handle, 0, 0, 1, tmp);
   Print("BarsCalculated = ", bc);
   return(rates_total);
}

ran on H1 indicator B, log:

2021.09.02 16:11:44.872 A (EURUSD,M1) cnt = 1

2021.09.02 16:11:44.873 A (EURUSD,M1) cnt = 2

2021.09.02 16:11:44.998 A (EURUSD,M1) cnt = 3

2021.09.02 16:11:44.998 B (EURUSD,H1) BarsCalculated = 3

2021.09.02 16:11:46.617 A (EURUSD,M1) cnt = 4

2021.09.02 16:11:46.617 B (EURUSD,H1) BarsCalculated = 4

2021.09.02 16:11:46.663 A (EURUSD,M1) cnt = 5

2021.09.02 16:11:46.663 B (EURUSD,H1) BarsCalculated = 5

2021.09.02 16:11:46.671 A (EURUSD,M1) cnt = 6

2021.09.02 16:11:46.671 B (EURUSD,H1) BarsCalculated = 6

2021.09.02 16:11:46.684 A (EURUSD,M1) cnt = 7

2021.09.02 16:11:46.685 B (EURUSD,H1) BarsCalculated = 7

2021.09.02 16:11:46.697 A (EURUSD,M1) cnt = 8

2021.09.02 16:11:46.697 B (EURUSD,H1) BarsCalculated = 8

2021.09.02 16:11:47.008 A (EURUSD,M1) cnt = 9

2021.09.02 16:11:47.008 B (EURUSD,H1) BarsCalculated = 9

2021.09.02 16:11:47.029 A (EURUSD,M1) cnt = 10

2021.09.02 16:11:47.029 B (EURUSD,H1) BarsCalculated = 10

2021.09.02 16:11:47.502 A (EURUSD,M1) cnt = 11

2021.09.02 16:11:47.502 B (EURUSD,H1) BarsCalculated = 11

2021.09.02 16:11:47.614 A (EURUSD,M1) cnt = 12

2021.09.02 16:11:47.614 B (EURUSD,H1) BarsCalculated = 12

2021.09.02 16:11:47.620 A (EURUSD,M1) cnt = 13

2021.09.02 16:11:47.620 B (EURUSD,H1) BarsCalculated = 13

2021.09.02 16:11:47.667 A (EURUSD,M1) cnt = 14

2021.09.02 16:11:47.667 B (EURUSD,H1) BarsCalculated = 14

2021.09.02 16:11:47.713 A (EURUSD,M1) cnt = 15

2021.09.02 16:11:47.713 B (EURUSD,H1) BarsCalculated = 15

2021.09.02 16:11:47.726 A (EURUSD,M1) cnt = 16

2021.09.02 16:11:47.726 B (EURUSD,H1) BarsCalculated = 16

 

Good afternoon, I can't seem to solve the problem.

I need to process all bars on first run, after processing only the last bar.

At first it prints 0, then on each new bar only the last one, it does not print intermediate bars.

What is the problem?

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {

      for(int i = prev_calculated; i <= prev_calculated && i < rates_total && !IsStopped(); i++)
        {
         Print(i);
        };
   return(rates_total);
  }
 
SEM #:

Good afternoon, I can't seem to solve the problem.

I need to process all bars on first run, after processing only the last bar.

At first it prints 0, then on each new bar only the last one, it does not print intermediate bars.

What is the error?

Either i-- or i equals zero in Cycle 1 expression) all prints correctly)
This is for the first run. And then the classic new bar catching.
 
SEM #:

Good afternoon, I can't seem to solve the problem.

I need to process all bars on first run, after processing only the last bar.

First it prints 0, then on each new bar only the last one, it does not print intermediate bars.

What is the error?


For starters I would try to correct it like this:

      for(int i = prev_calculated; i >= prev_calculated && i < rates_total && !IsStopped(); i++)
        {
         Print(i);
        };
 

Good day to you all. Anybody out there who has encountered this problem? Everything was fine in mt5 today until 10msk. I opened orders and set stop and profit.

When opening an order, placing a stop or profit after 10msk, my order is waiting in line and after 10 minutes or more it is placed. And this is still the case.

 
Михаил Савченко #:

Good day to you all. Anybody out there who has encountered this problem? Everything was fine in mt5 until 10msk today. I opened orders and set stop and profit.

After 10 pm, when I opened an order and placed a stop or profit, my order was waiting in line and after 10 minutes or more it was opened. And this is still the case.

Manual trading? Which broker?
 
mktr8591 #:
Manual trade? What broker?
Yes, I enter from the market, manually. Finam.
 
mktr8591 #:

To start with, I would try to correct it like this:

Thank you! It helped.
Reason: