Problem with draw multi color lines - page 2

Fernando Carreiro  
Le Minh Duc #: You're right, but this doesn't answer my question. The problem here is that it doesn't display properly, not that it makes the program inflexible. In fact, after loading the indicator into the chart, the user can still change the display properties.

One thing to note from a quick glance at your code ... you are mixing the buffer index and the plot index.

You have 16 buffers for 8 plots, but you are referencing your plots using the same index as the buffers. That is incorrect.

It should be as follows ...

  • plot #0 — buffers #0 (data) and #1 (colour) ... #property indicator_*1
  • plot #1 — buffers #2 (data) and #3 (colour) ... #property indicator_*2
  • plot #2 — buffers #4 (data) and #5 (colour) ... #property indicator_*3
  • plot #3 — buffers #6 (data) and #7 (colour) ... #property indicator_*4
  • etc.
Alain Verleyen  
Le Minh Duc #:

Not sure if you have actually compiled and tested my code. In the picture I sent, I can still run it normally but it cannot display properly.

2. It is not necessary to define indicator properties using #property. I have defined it all in BasicInit() and ColorBufferInit() functions

3. I defined it on line 18, and the file I attached can still compile normally.

That's wrong, it's MANDATORY to define plots with #property.

Even if you define them dynamically in the code.

Reason: