Errors, bugs, questions - page 1680

 

In the logbook.

2016.09.12 22:20:37.728 Books   invalid book item[RTS-9.16,buy,99040.00000,-4]
BCS-MetaTrader5, real, 1415. Happened when switching from a demo account to a real account. No Expert Advisors or indicators were run. The window of the Dummy was open.
 
fxsaber:

In the magazine.

BCS-MetaTrader5, real, 1415. It happened when I switched from demo to real account. No Expert Advisors or indicators were running. The window of the Cauldron was open.

I wrote about this bug

https://www.mql5.com/ru/forum/95131

invalid book transaction
invalid book transaction
  • reviews: 2
  • www.mql5.com
Раньше не было, появилось сегодня (реал). Что это...
 
prostotrader:
What are those asterisks under the subject title? And the number of reviews too.
 
fxsaber:
What are those asterisks under the subject title? And the number of reviews.
By the way, I've been wondering for a long time where these stars for themes should be set.
 

In debug mode, how do I know where the function I'm currently in was called from?

Roughly speaking, I would like to have access to a nested function/method call tree. Is this possible?

 
fxsaber:
In debug mode, how do I find out where the function I'm currently in was called from?

In "Step-by-step" mode, view the "Debugging" tab one at a time:

steps

 
Karputov Vladimir:

In "Step-by-step" mode, view the "Debugging" tab one at a time:

Thank you. I can't figure out why the indicator calls OnCalculate twice in the beginning. I'd like to find out what event it reacts to. Unfortunately, I can't see any events on the debugging tab.
 
fxsaber:
Thanks. I can't understand why in the beginning the indicator calls OnCalculate twice. I'd like to find out what event this response is for. No events are visible on the debugging, unfortunately.

Sometimes it happens twice, sometimes once, maybe even three times: you put this code in Oncalculate() -

//+------------------------------------------------------------------+
//|  Accelerator/Decelerator Oscillator                              |
//+------------------------------------------------------------------+
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[])
  {
   Print(__FUNCTION__,", rates_total ",rates_total,", prev_calculated ",prev_calculated);

it will be clear when history is swapped (when history is swapped prev_calculated==0).

 
Karputov Vladimir:

Sometimes it happens twice, sometimes once, maybe even three times: you put this code in Oncalculate() -

it will be clear when history swap happens (when history swap prev_calculated==0).

Nah, I'm running it on RTS now, when kotirs are standing. Figured out that it's called once, and the debugger lies, showing as if it's two. Code to play (run on a character where no ticks are going on)

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1

int Func(){ return(0); }

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[] )
{
//  return(0); // если расскоментировать и здесь поставить точку останова, то отладчик отработает, как надо
  return(Func()); // здесь поставить точку останова (F9)
}

After pressing F5 it will hit a breakpoint. And after a second press on F5 - similarly. This shouldn't be the case though - as a confirmation, you can shorten the line that's in the code and try with it.

 
fxsaber:

Nah, I'm running it on RTS now, when the kotirs are standing. Figured out that it's called once, and the debugger is lying, showing it as if it's two. Code to play (run on a character where no ticks are going on)

After pressing F5 it will hit a breakpoint. And after a second press on F5 - similarly. This shouldn't be the case though - as a confirmation, you can scrap the line that's in the code and try with it.

It does not make any difference whether the quotes go or stand. You must control the condition prev_calculate==0 in the indicator - this is history swap and the second point - sparing mode of recalculation of changed bars, i.e. in fact, rates_total -prev_calculate+1.