what is connection between plot and buffer number?

 

Hi i have problem with the plot and buffer number connection. when I use some drawing style like line in my indicator the buffer and the plot number is the same and i can understand easily. But when I want use the drawing style like filling the buffer and the plot number not the same and make the problem.

in my test code i try create ichimoku with 2 cloud. So I use the code like image 1, create 11 buffer, but when i shift them the plot and the buffer not the same. for example for the first cloud I should use the plot 1, for second cloud i should use the  plot 1 for tenkan use the plot2 (but the tenkan buffer is 4). so if i want shift the chiku with the buffer 6 i should use the plot 4 and so on. when i coding like image 1 everything correct just like image 2.

but when i want the Draw_None for the clouds (or every drawing style with 2 buffer) all of the line is draw incorrectly. for example if i want use draw None for the first cloud the result like image 3. As you can see when I want draw none on the Filling (or all of the drawing style with 2 buffer). every buffer and the plot after that, draw incorrectly. how can manage and fix this?

Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Indicators Lines
Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Indicators Lines
  • www.mql5.com
Indicators Lines - Indicator Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Files:
1.png  56 kb
2.png  74 kb
3.png  75 kb
 
Post code and not picture of code if you want help.
 
Alain Verleyen:
Post code and not picture of code if you want help.

this is my entire test code.

Files:
 
Why are your buffers called color buffer if they are declared as data buffers?

Whenever you have a buffer and want a color associated with it, the flowing buffer must be the color buffer. And it must be declared as such.

 
Dominik Egert:
Why are your buffers called color buffer if they are declared as data buffers?

Whenever you have a buffer and want a color associated with it, the flowing buffer must be the color buffer. And it must be declared as such.


we can use anything as the buffers name. this is the type of variable and you can name it anything , can not? also i use the draw filling for fill the Cloud, so i name it color and there is not the keyword and the program has not the error, so i believe the array and the buffer name not the problem here.

I change my code and the set the second Buffer of Draw Filling to "INDICATOR_COLOR_INDEX" (image 4) , but nothing changed and the problem still remain.  also according to reference the Draw_Filling has not the color buffer.

If you have time, please modify the code for me and upload it here so that I can better understand.

thank you for help me.

Files:
4.png  17 kb
 

according to this refrence: "https://www.mql5.com/en/docs/customind/indicators_examples"

when we want for example 5 indicator line (like line). we have 5 buffer and 5 plot. and when we want use something like draw_candle, we have 5 buffer and 2 plot. So Similarly for my code when i have 2 Draw_Filling and 9 line, I have 11 buffer and 9 plot Which are in the following order: (and Draw_Filling has not the Color buffer according to this reference)

plot 0 - buffer 0,1

Plot 1 -buffer 2,3,

Plot 2 -buffer 4

Plot 3 -buffer 5

Plot 4 -buffer 6

Plot 5 -buffer 7

Plot 6 -buffer 8

Plot 7 -buffer  9

Plot 8 -buffer  10

so when we want shift chiku (buffer 6), we should use plot 4 just like this:

   PlotIndexSetInteger(4, PLOT_SHIFT, -26);

and exactly like this for senku A, senku A2, senku B, senku B2. I understand this.

But I want my user show and hide cloud according to their needs. So when I want change the Draw_Filling to Draw_none, all of the plot and buffer after that draw incorrectly (you can see in image 3 above)

I think maybe this happen because the Draw_None plot need 1 buffer and the Draw_Filling Plot need 2 Buffer. so when i change Draw_Filling to Draw_None order of plot and buffer become like this:

plot 0 - buffer 0

Plot 1 -buffer 1

Plot 2 -buffer 2

Plot 3 -buffer 3

Plot 4 -buffer 4

Plot 5 -buffer 5

Plot 6 -buffer 6

Plot 7 -buffer  7

Plot 8 -buffer  8

so the indicator draw Incorrectly.

(i can not understand this). I want fix this.

please help





Documentation on MQL5: Custom Indicators / Indicator Styles in Examples
Documentation on MQL5: Custom Indicators / Indicator Styles in Examples
  • www.mql5.com
Indicator Styles in Examples - Custom Indicators - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
So you are saying, the terminal is shifting the buffer numbers as the type of a plot gets changed. This seems reasonable and could probably be the source of your issue.

What about using another method to hide these plots? Like shift them to the very far left. Or set their values to null or your defined empty value.

In case you would need to recover the values later, you could use a calculations buffer to store them.

Another method could be to make your code shift the usage of the buffers and have it take care of the content of the buffers according to their plot usage.

EDIT: It probably makes sense to have the cloud buffers be the last 4 buffers in the list.

 
Dominik Egert:
So you are saying, the terminal is shifting the buffer numbers as the type of a plot gets changed. This seems reasonable and could probably be the source of your issue.

What about using another method to hide these plots? Like shift them to the very far left. Or set their values to null or your defined empty value.

In case you would need to recover the values later, you could use a calculations buffer to store them.

Another method could be to make your code shift the usage of the buffers and have it take care of the content of the buffers according to their plot usage.

EDIT: It probably makes sense to have the cloud buffers be the last 4 buffers in the list.

thank you

the shift too far is the easiest way and the problem solved. but i do not know how to solved this with 2 next solution. can you send me some reference.

and for the last part. yes we can define the Plot and Draw_style with more then one buffer in the last of the list. but if we do this, the cloud show on the every other part of the indicator and have negative result of the visibility.

 
If I understood your issue correctly, it is solved. Right?

Maybe it would be possible, if necessary, to state a more precise problem to the "last part".

I do not understand what you are exactly talking about.
 
Dominik Egert:
If I understood your issue correctly, it is solved. Right?

Maybe it would be possible, if necessary, to state a more precise problem to the "last part".

I do not understand what you are exactly talking about.

yes my problem solved with this solution you said above: " shift them to the very far left. "

Of course, this creates another problem and indicator line not draw correctly again. so i Shift them to far right and everything worked now. (exactly 1 million shift to right.)


and i only want learn about the other solution your mention too. like calculations buffer. But, yes, my problem solved already and thank you again.

 
Please try to figure out yourself, since I know how to do it and I do not have the need, I won't code it for now.

I am glad I could assist you with your problem.