Can I turn line color on/off?

 
I have a buffer that draws line sections from one bar to another, much like the ZigZag indicator.  But what I really want to do is draw a line section, then turn it off for some distance, and then draw another section.  I know that a line can be only one color per buffer, but it would be nice to turn off that color until you need to turn it on again.  In the long run I want to plot profit lines versus loss lines where the profit lines are one color and the loss lines are another color.  I tried using SetIndexStyle(0, DRAW_SECTION, EMPTY, 3, clrBlue) and then later SetIndexStyle(0, DRAW_NONE, EMPTY, 3, clrBlue) but that failed.  Is there a way to draw sections of lines that are not continuous?
 

Where you set the buffer to EMPTY_VALUE, the line will not be drawn

 
Awesome!  Thanks.  I'll test that tonight.
 
Do you know of an example that I might study.  I tried setting the buffer value to EMPTY_VALUE between the end points of the section lines where I didn't want it to appear but it didn't work.  My guess is this works for DRAW_LINE but not DRAW_SECTION.  What I'd like to do is something like the ZigZag indicator but only draw every other line segment so there's a gap between each line segment.
 
  1. ZigZag does not use DRAW_SECTION (one buffer) it uses DRAW_ZIGZAG (two buffers.)
  2. EMPTY_VALUE will not work for Section or Zigzag because they draw between valid values.
  3. You can not change the styles in MT4. MT5 has separate color buffers.
  4. You must use DRAW_LINE, compute the slope and fill in the in between elements yourself.
 
It's too bad my brokerage doesn't offer MT5.  I can see that would solve that problem.  DRAW_LINE it is....  Thanks
Reason: