Errors, bugs, questions - page 3026

 
Сергей Таболин:

And on which higher TF does the candle not appear with the candle on the lower one?

The indicator on M1 uses another indicator from M5.

In general, it would not be a problem if not for increased unjustified consumption of computational resources, critical during optimization (in my case every new M5 causes full re-run of the indicator on the entire history, and the project is not fully completed yet, I plan to use 16 indicators from different TFs).

 
Andrey Dik:

indicator on M1 uses another indicator from M5.

In general, it would not be a problem, if it were not for increased unreasonable consumption of computational resources, critical during optimization (in my case every new M5 causes full re-run of the indicator on the entire history, while the project is not completely finished yet, I plan to use 16 indicators from different TFs).

Andrey, but the M5 candle opens at the same time as the M1 candle. Or do you mean the load of the redrawing (recalculating) indicators? So, if we prohibit them to re-draw, what the hell do they need then? Then you will not get new data from them...

 

Compilation error:

#define  MACRO( X )      X##X
void OnStart()
{
    Print( 11 );        //(1) нормально
    Print( MACRO( 1 )); //(2) Error: '11' - undeclared identifier
}
and what is the difference between (1) and (2) ?
 
Сергей Таболин:

Andrey, but the M5 candle opens at the same moment as the M1 candle. Or do you mean the load of redrawing (recalculating) indicators? So, if we prohibit them to re-draw, what the hell do they need then? Then you won't get new data from them...

as soon as new timeframe bar appears from which the data is obtained, the counter prev_calculated will be reset. It means that the indicator will be recalculated as if it was launched the first time.

is such a construction familiar to you?

if (rates_total == prev_calculated) return rates_total;
  
int startInd = rates_total - prev_calculated;

for (int i = startInd; i >= 0; i--)
{
  //тут считаем индикатор, который обращается к другому индикатору на старшем ТФ
}

it is not about the EA logic (redrawing, not redrawing, underdrawing or whatever), but the fact that prev_calculated is reset when no one asked it to do so!

 
Andrey Dik:

as soon as there is a new timeframe bar from which the data is obtained, the prev_calculated counter is reset. it means that the whole indicator is recalculated as if it was run the first time.

is such a construction familiar to you?

it's not about EA logic (redrawing, not redrawing, underdrawing or whatever), it's that prev_calculated is reset when no one asked it to!

Indicators are my weakest point ))))

But!

Either I don't understand anything at all, or you're a little wrong.

As far as I know, prev_calculated is a counter of uncalculated data. And once the incoming data is counted, that counter is reset... Like, that's it, guy, no more new data to calculate.... )))

And for what reason the indicator should completely recalculate in such a case - I don't know!

---------------

Lied a little ))))

It's not the indicators that are re-calculated, it's the "indices" that are re-drawn just to look "nice" on the history ;)

 
Сергей Таболин:


I lied a little ))))

Indicators are not redrawn, the "indices" are redrawn only to make them look nice on history ;)

That's why they sell like hotcakes. Because they always look BEAUTIFUL and BEAUTIFUL.

 
Vladislav Andruschenko:

That's why they sell like hotcakes. Because they always look BEAUTIFUL and BEAUTIFUL.

100500 ))))))

 
Сергей Таболин:


As far as I know, prev_calculated is a counter of uncalculated data.

Alas, your knowledge is inconsistent with the documentation.

OnCalculate()

Документация по MQL5: Основы языка / Функции / Функции обработки событий
Документация по MQL5: Основы языка / Функции / Функции обработки событий
  • www.mql5.com
Функции обработки событий - Функции - Основы языка - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 

How do I know internally that EX5 is compiled in Debug mode? Not run in Debug mode, but compiled once through Debug and run in normal way.

Found it.

void OnStart()
{      
  #ifdef _DEBUG
    Alert("EX5 - debug.");
  #endif

  if (MQLInfoInteger(MQL_DEBUG))
    Alert("Debugging...");
}


And how do I know that EX5 is protected?