Questions from a "dummy" - page 268

 
DC2008:

I'm not sure, but it's probably because of this:

I have no ArrayResize, for INDICATOR_DATA and INDICATOR_CALCULATIONS the size is set by the terminal, and draws from bar 0


Then it turns out that all ArrayInitialize(array,EMPTY_VALUE); does not work even for zero bar?



 
Silent:

I do not have ArrayResize, the terminal sets the size for INDICATOR_DATA and INDICATOR_CALCULATIONS and draws it from the 0-th bar

Maybe you don't, but arrays are dynamic and each timeframe has a different number of bars! Switching from one to another changes the size of arrays (this is done without your participation) and you see the rubbish.

Документация по MQL5: Доступ к таймсериям и индикаторам / Bars
Документация по MQL5: Доступ к таймсериям и индикаторам / Bars
  • www.mql5.com
Доступ к таймсериям и индикаторам / Bars - Документация по MQL5
 
Silent:

Then it turns out that all ArrayInitialize(array,EMPTY_VALUE); does not work even for zero bar?

In your case, it is the last element of the array (even though it is at bar 0), because the default indexing is from left to right.

 
DC2008:

You may not, but the arrays are dynamic and each timeframe has a different number of bars! Switching from one to the other changes the array sizes (this is done without your participation) and you see rubbish.

It seems to be logical. Then the initialization of indicator buffers in the inite makes no sense at all, everything should be done in OnCalculate

DC2008:

In your case, it's the last element of the array (even though it's on 0 bar), because the default setting indexes from left to right.

Right, I haven't flipped it yet.

 
Thank you all!
 

Fixed an error, flipped arrays, messed around with ArrayInitialize (left it for now)...

It seems to be impossible to get rid of rubbish in Inite. Even PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,countBars); will not stop it; it may appear at the beginning of the chart or at the end.

I will leave it in a trailer, maybe developers will look at it.

PS but the appearance of rubbish in the same place on the chart after removal of the indicator and/or recompilation - it's a tin.

such a beauty...


Files:
 
Silent:

Fixed an error, flipped arrays, messed around with ArrayInitialize (left it for now)...

It seems to be impossible to get rid of rubbish in Inite. Even PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,countBars); will not stop it; it may appear at the beginning of the chart or at the end.

I will leave it in a trailer, maybe developers will look at it.

PS but the appearance of rubbish in the same place on the chart after removal of the indicator and/or recompilation - it's a tin.

Such a beauty...

There you go, it seems to work as you need it to:

void OnDeinit(const int reason)
  {
   ArrayResize(USDBuffer,1);
   ArrayResize(EURBuffer,1);
   ArrayResize(GBPBuffer,1);
   return;
  }
 
DC2008:

There you go, it seems to be working the way you want it to:

Nah, it's littering too, you can tell by the numbers in the top left corner.

It works only after loading these cells into OnCalculate

   ArrayInitialize(USDBuffer,EMPTY_VALUE);
   PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,countBars);
   ArrayInitialize(EURBuffer,EMPTY_VALUE);
   PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,countBars);
   ArrayInitialize(GBPBuffer,EMPTY_VALUE);
   PlotIndexSetInteger(2,PLOT_DRAW_BEGIN,countBars);

Your version seems to be correct. The rubbish is due to auto-rendering of arrays. And it seems even clear why it repeats.

If the terminal changes the size, say, from 1 000 to 10 000, it allocates one and the same piece of uncleared memory, and it does not matter how many times you reload the indicator - from 1 001st to 9 999th cell remains with left-end values.

upd I still have one question: why by changing something in f_comment function (changed colour) and the subsequent compilation changes are not applied to restart indicator in the terminal.

Files:
 
Is it possible to build a candlestick chart of some instrument's parameters in a separate window? For example, broker "Otkritie" has instrument RTS-9.13 and for it to build a graph of buy orders, the values of which are displayed in the "market overview" window
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров
  • www.mql5.com
Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров - Документация по MQL5
 
vicleo:
Is it possible to build a candlestick chart of some instrument's parameters in a separate window? For example, the broker "Otkritie" has the instrument RTS-9.13 and for it to build a chart of buy orders, the values of which are displayed in the "market overview" window
Broker and ask).
Reason: