![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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?
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.
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.
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
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.
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...
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:
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
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.
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