Colored arrows and line

I have an indicator that combines the drawing of colored arrows and colored lines. The logic for determining colors and the colors themselves are exactly the same for both arrows and lines.
Does each colored plot need to have its own color buffer? Or is it possible to use one color buffer for all of them?
Petr Nosek:
I have an indicator that combines the drawing of colored arrows and colored lines. The logic for determining colors and the colors themselves are exactly the same for both arrows and lines.
Does each colored plot need to have its own color buffer? Or is it possible to use one color buffer for all of them?

If you're talking about DRAW_COLOR_ARROW and DRAW_COLOR_LINE, respectively, the ordering of the buffers in each color changing indicator must follow the documentation. Therefore, multiple color changing buffers in one indicator is not supported.

Having said that, it is possible to declare separate regular indicator buffers, each having a separate static color for each segment of an indicator, and each buffer is conditionally drawn. In this way, you can combine many more color changing drawings in one indicator. Here is a histogram indicator coded in that way:

Code Base

Brooky Trend Strength for MT5

Ryan L Johnson, 2025.04.29 19:52

This indicator calls 3 other subwindow indicators. All files go in your Indicators folder.

Each DRAW_COLOR_* plot needs its own color index buffer right after its data buffer, they can't share one. But you can have several color plots in the same indicator, that works fine. Just write the same index into both color buffers:

int clr = (up ? 0 : 1);
ArrowColor[i] = clr;
LineColor[i]  = clr;

And set the same colors for both plots with PlotIndexSetInteger(..., PLOT_LINE_COLOR, ...).