Hi,
Please can anyone inform me if this has changed? I read that we were previously unable to copybuffer on buffers set to INDICATOR_CALCULATIONS. However, I am able to do it just fine testing on various custom indicators.
My goal is to be able to finish writing my indicator that dynamically loads the handles of all indicators that are already on the chart.
This is an issue because: (if anyone could shed any light on these points I would be very grateful)
1. There appears to be no way of knowing how many buffers a handle has. Therefore you have to loop through all possible 256 buffers to know which ones are used, and that's providing you select the correct bar to read from if shift is enabled.
2. Once you count the buffers in a loop in the code, you realize that INDICATOR_CALCULATIONS have also been counted.
3. Once you count a buffer you cannot check what type has been set to it, i.e is it DATA or CALCULATIONS
4. Once you count a buffer you cannot check the name assigned to each buffer. Example, on Bollinger bands indicator you have 3 buffers a upper, middle and lower buffer plus 1 calculation buffer. However there is no way to know which buffer is called what.
Why would one need to know the name of a buffer when it could be accessed by index? Good question, the purpose isn't to be accessed via the name, the purpose is to be able to use the name to let the end user know what each value i'm displaying to them is for.
Please help
If you want to provide your indicator to other people, you are better to provide documentation about his usage. If you want to use existing one, check the documentation. There is no point from a code point of view to have a name for a buffer.
![Documentation on MQL5: Technical Indicators Documentation on MQL5: Technical Indicators](https://c.mql5.com/36/45/documentation-on-mql5-technical__1.png)
- www.mql5.com
Alain Verleyen:
As far as I know it has always be possible.
Thank you for the quick response!
Let me rephrase something please: The indicator I am creating is a utility, not your traditional indicator. Once I've finished it you would find it in the "Utility" section of the market. My utility will dynamically grab the names and buffers of already loaded indicators so I can display the information directly into the panel i'm creating. My project is to essentially recreate the data window into a panel on the chart.
To reply to the above quote:
I don't understand the point in labeling an indicator as CALCULATION (is its only purpose to be hidden from the data window then? If so, is it not true that is what the below code is meant for?
PlotIndexSetInteger(0,PLOT_SHOW_DATA,false);
Why do built-in indicators not show the INDICATOR_CALCULATIONS but custom indicators do if that's the case? For example, I can compare Bollinger bands indicator made by MetaQuotes https://www.mql5.com/en/code/14 which is standard in every MT5 as "\Indicators\Examples\bb.ex5" to the built-in version "iBands".
The reason is to determine what values should be taken and which ones shouldn't, for example I will only find Upper lower and middle buffers using iBands but I will find the extra Calculations on the custom which should be ignored. If I could see a buffer without a label that could be an indication if just for Calc purposes.
An quick reference to this issue: https://www.mql5.com/en/forum/1990
Ok, I agree with you now, it is no big deal to loop through them. Opps I meant 512 not 256 thanks for the correction :)
I will definitely will be making documentation. I can already detect all the windows/sub windows, the indicators they contain, the number of buffers in each indicator (even though I get the extra CALC buffers from custom indicators that are hidden in the data window), but without the names of the buffers to go with each buffer array then the values are meaningless to the end-user. Example. they can see upper,middle,lower values from the BB but don't know what each number is for.
Please see attached picture. The red text is what I'm missing. Of course, I can hard-code the handful of build-in indicators and their labels into my code (which probably seems the best way at this point) but then how can I grab the names of buffers for the custom indicators? If I allowed the user to set input parameters on my panel for the custom indicators they want added, how could I know how many inputs to provide the user so they can fill in labels for each buffer, I can't add 512 inputs times the number of custom indicators I'm willing to support? This whole thing feels like it goes very deep!
If you have no definitive answer on how to help my issues, do you have any advice for me that could help my situation?
Thanks so much for taking your time to respond, it is very much appreciated
![CopyBuffer only copy INDICATOR_DATA buffer not copy INDICATOR_CALCULATIONS buffer ??? CopyBuffer only copy INDICATOR_DATA buffer not copy INDICATOR_CALCULATIONS buffer ???](https://c.mql5.com/36/45/copybuffer-only-copy-indicator.jpg)
- 2010.09.09
- www.mql5.com
Thank you for the quick response!
Let me rephrase something please: The indicator I am creating is a utility, not your traditional indicator. Once I've finished it you would find it in the "Utility" section of the market. My utility will dynamically grab the names and buffers of already loaded indicators so I can display the information directly into the panel i'm creating. My project is to essentially recreate the data window into a panel on the chart.
To reply to the above quote:
I don't understand the point in labeling an indicator as CALCULATION (is its only purpose to be hidden from the data window then? If so, is it not true that is what the below code is meant for?
Why do built-in indicators not show the INDICATOR_CALCULATIONS but custom indicators do if that's the case? For example, I can compare Bollinger bands indicator made by MetaQuotes https://www.mql5.com/en/code/14 which is standard in every MT5 as "\Indicators\Examples\bb.ex5" to the built-in version "iBands".
The reason is to determine what values should be taken and which ones shouldn't, for example I will only find Upper lower and middle buffers using iBands but I will find the extra Calculations on the custom which should be ignored. If I could see a buffer without a label that could be an indication if just for Calc purposes.
An quick reference to this issue: https://www.mql5.com/en/forum/1990
Ok, I agree with you now, it is no big deal to loop through them. Opps I meant 512 not 256 thanks for the correction :)
I will definitely will be making documentation. I can already detect all the windows/sub windows, the indicators they contain, the number of buffers in each indicator (even though I get the extra CALC buffers from custom indicators that are hidden in the data window), but without the names of the buffers to go with each buffer array then the values are meaningless to the end-user. Example. they can see upper,middle,lower values from the BB but don't know what each number is for.
Please see attached picture. The red text is what I'm missing. Of course, I can hard-code the handful of build-in indicators and their labels into my code (which probably seems the best way at this point) but then how can I grab the names of buffers for the custom indicators? If I allowed the user to set input parameters on my panel for the custom indicators they want added, how could I know how many inputs to provide the user so they can fill in labels for each buffer, I can't add 512 inputs times the number of custom indicators I'm willing to support? This whole thing feels like it goes very deep!
If you have no definitive answer on how to help my issues, do you have any advice for me that could help my situation?
Thanks so much for taking your time to respond, it is very much appreciated
There is no direct mql API to do what you want.
You can do it though by saving and parsing a template.
There is no direct mql API to do what you want.
You can do it though by saving and parsing a template.
Interesting idea I never considered. Thank you, I will take a look into that one :)
There is no direct mql API to do what you want.
You can do it though by saving and parsing a template.
Hi Alain,
This idea is working but I only have one small issue left which no doubt is a bug and I can prove it. Please entertain me for a moment:
CopyBuffer should NOT work with indicator buffers which are INDICATOR_CALCULATIONS.
https://www.mql5.com/en/docs/customind/indicators_examples
I quote the following for the MQL source:
The difference between an indicator buffer and an array
In each indicator, on its global level, you should declare one or more arrays of the double type, which then must be used as an indicator buffer using the SetIndexBuffer() function. To draw indicator plots, only the values of the indicator buffers are used, any other arrays cannot be used for this purpose. In addition, buffer values are displayed in the Data Window.
An indicator buffer should be dynamic and does not require specification of the size – the size of the array used as the indicator buffer is set by the terminal execution subsystem automatically.
After the array is bound to the indicator buffer, the indexing direction is set by default like in ordinary arrays, but you can use the ArraySetAsSeries() function to change the way of access to the array elements. By default, the indicator buffer is used to store data used for plotting (INDICATOR_DATA).
If the calculation of indicator values requires holding intermediate calculations and storing the additional values for each bar, then such an array can be declared as a calculation buffer during binding (INDICATOR_CALCULATIONS). For the intermediate values, you can also use a regular array, but in this case, the programmer has to manage the size of the array.
Some plots allow setting a color for each bar. To store the information about color, color buffers are used (INDICATOR_COLOR_INDEX). The color is an integer type color, but all indicator buffers must be of type double. Values of color and auxiliary (INDICATOR_CALCULATIONS) buffers cannot be obtained by using CopyBuffer().
Being able to copy the INDICATOR_CALCULATIONS buffers causes me big problems as when parsing the template you won't know which custom indicator labels belong to which buffer. Example: if you have 3 labels from the template and you find 4 buffers with no way to tell which one is the INDICATOR_CALCULATIONS buffer as we can use CopyBuffer on it.
According to the documentation this shouldn't be possible. Is there anyway we can get this resolved now I have found the documentation specifically mentioning the issue I shouldn't be having?
Once again, thanks for your time
![Documentation on MQL5: Custom Indicators / Indicator Styles in Examples Documentation on MQL5: Custom Indicators / Indicator Styles in Examples](https://c.mql5.com/36/45/documentation-on-mql5-custom-indicators.png)
- www.mql5.com
Hi Alain,
This idea is working but I only have one small issue left which no doubt is a bug and I can prove it. Please entertain me for a moment:
CopyBuffer should NOT work with indicator buffers which are INDICATOR_CALCULATIONS.
https://www.mql5.com/en/docs/customind/indicators_examples
I quote the following for the MQL source:
Being able to copy the INDICATOR_CALCULATIONS buffers causes me big problems as when parsing the template you won't know which custom indicator labels belong to which buffer. Example: if you have 3 labels from the template and you find 4 buffers with no way to tell which one is the INDICATOR_CALCULATIONS buffer as we can use CopyBuffer on it.
According to the documentation this shouldn't be possible. Is there anyway we can get this resolved now I have found the documentation specifically mentioning the issue I shouldn't be having?
Once again, thanks for your time
Yes there is a bug...in the documentation.
Don't expect them to modify a behaviour which could potentially broke a lot of running code.
Looks like this problem didn't exist 6 months ago though:
https://www.mql5.com/en/forum/342155
Notice how @Vladimir Karputov fixes this persons issues by changing calculations to data and by informing the person with the issue that you assign buffers with the index on the bar.
Where do or who do I forward this problem to so I can get a reply from a MT5 developer or something?
![The values of the target array of CopyBuffer() are always 0 The values of the target array of CopyBuffer() are always 0](https://c.mql5.com/36/45/the-values-of-the-target-array.jpg)
- 2020.05.28
- www.mql5.com
Looks like this problem didn't exist 6 months ago though:
https://www.mql5.com/en/forum/342155
Notice how @Vladimir Karputov fixes this persons issues by changing calculations to data and by informing the person with the issue that you assign buffers with the index on the bar.
Where do or who do I forward this problem to so I can get a reply from a MT5 developer or something?
It has always being like that, the topic you mention is not related to your issue.
Hi Alain,
I beg to differ, is hasn't always been like that, prove me wrong please. The documentation says so. I proved at least in 3 ways with proof and logically why it shouldn't work. Unfortunately, your word doesn't include any links/proof or sources, your answer appears to be based on your memory.
1. The documentation says it shouldn't work. Check the page on way-back machine internet archive, it's been like that for a very very long time. https://www.mql5.com/en/docs/customind/indicators_examples
2. Other people in the past could not copybuffer on INDICATOR_CALCULATIONS buffers https://www.mql5.com/en/forum/1990
3. There is no logical reason to include ever use this code:
PlotIndexSetInteger(0,PLOT_SHOW_DATA,false);
If the below code does exactly the same (which it shouldn't).
SetIndexBuffer(0,Buffer_Name,INDICATOR_CALCULATIONS);
The former should hide the plot in the data window only. The latter should hide from copybuffer() and data window.
4. A metaquotes built-in indicator doesn't allow copybuffer() on INDICATOR_CALCULATIONS but on a custom indicator you can
Please can someone point me in the direction where I can persude this further? This is most definitely a bug
![CopyBuffer only copy INDICATOR_DATA buffer not copy INDICATOR_CALCULATIONS buffer ??? CopyBuffer only copy INDICATOR_DATA buffer not copy INDICATOR_CALCULATIONS buffer ???](https://c.mql5.com/36/45/copybuffer-only-copy-indicator__1.jpg)
- 2010.09.09
- www.mql5.com
Hi Alain,
I beg to differ, is hasn't always been like that, prove me wrong please. The documentation says so. I proved at least in 3 ways with proof and logically why it shouldn't work. Unfortunately, your word doesn't include any links/proof or sources, your answer appears to be based on your memory.
1. The documentation says it shouldn't work. Check the page on way-back machine internet archive, it's been like that for a very very long time. https://www.mql5.com/en/docs/customind/indicators_examples
2. Other people in the past could not copybuffer on INDICATOR_CALCULATIONS buffers https://www.mql5.com/en/forum/1990
3. There is no logical reason to include ever use this code:
If the below code does exactly the same (which it shouldn't).
The former should hide the plot in the data window only. The latter should hide from copybuffer() and data window.
4. A metaquotes built-in indicator doesn't allow copybuffer() on INDICATOR_CALCULATIONS but on a custom indicator you can
I have nothing to prove. I am coding with mql5 since early 2013 and it has always been like that (at least since a very long time). Yes there are a lot of things in my memory, take it or not, I was trying to avoid you to waste your time. Good luck.
![Jamie_Miller Jamie_Miller](https://c.mql5.com/36/45/jamie-miller.png)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
Please can anyone inform me if this has changed? I read that we were previously unable to copybuffer on buffers set to INDICATOR_CALCULATIONS. However, I am able to do it just fine testing on various custom indicators.
My goal is to be able to finish writing my indicator that dynamically loads the handles of all indicators that are already on the chart.
This is an issue because: (if anyone could shed any light on these points I would be very grateful)
1. There appears to be no way of knowing how many buffers a handle has. Therefore you have to loop through all possible 256 buffers to know which ones are used, and that's providing you select the correct bar to read from if shift is enabled.
2. Once you count the buffers in a loop in the code, you realize that INDICATOR_CALCULATIONS have also been counted.
3. Once you count a buffer you cannot check what type has been set to it, i.e is it DATA or CALCULATIONS
4. Once you count a buffer you cannot check the name assigned to each buffer. Example, on Bollinger bands indicator you have 3 buffers a upper, middle and lower buffer plus 1 calculation buffer. However there is no way to know which buffer is called what.
Why would one need to know the name of a buffer when it could be accessed by index? Good question, the purpose isn't to be accessed via the name, the purpose is to be able to use the name to let the end user know what each value i'm displaying to them is for.
Please help