Drawing a horizontal line in an indicator versus a draw_line

 

This situation is infuriating. I have EAs where I have been able to create a horizontal line with the creation of an object, and I can choose either a vline or an hline, but when I want to do this on an indicator in the same window, I get a single dot for the lines.

Here are some snippets of my code:

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Yellow
#property indicator_color3 Red
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2


//---- buffers
double P1HighBuffer[];
double P1MidBuffer[];
double P1LowBuffer[];


int init()
  {

//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,P1HighBuffer);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,P1LowBuffer);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,P1MidBuffer);

   SetIndexDrawBegin(0,15); // changed these values just to see if it made a difference
   SetIndexDrawBegin(1,25); // changed these values just to see if it made a difference
   SetIndexDrawBegin(2,50); // changed these values just to see if it made a difference
   SetIndexDrawBegin(3,100); // changed these values just to see if it made a difference
//----
   return(0);
  }

int start()
  {


    // some calculations

     P1HighBuffer[0] = P1High;  // calculation values assigne to buffers
     P1LowBuffer[0] = P1Low;     // calculation values assigne to buffers
     P1MidBuffer[0] = (P1Mid/2) + P1Low;    // calculation values assigne to buffers

Here is the code to get the indicator values, I only expect a single value in each buffer, the zero'th position value

      P1High = iCustom(NULL,0, "SerpentCandle1",0,0);
      P1Low = iCustom(NULL,0, "SerpentCandle1",1,0);
      P1Mid = iCustom(NULL,0, "SerpentCandle1",2,0);

So there are two problems, I notice that as the new can dles form, the lines do grow, but I want them to be across the chart from left to right. Second, although I have them all in the right order and assigned to the correct buffer, they still draw the yellow line (P1Mid) as the bottom line and the P1Low (red line) in the middle.

Here is a snapshot of the chart:


Horizontal lines

The expert prints in the window below show the correct data values.Still the lines are not as I would like for them to be. It may be because I am tired and I have been working long hard hours on this, but I cannot find the problem. I have a feeling that the line line across the chart issue is based on the SetIndexDrawBegin function, but I tried Bars - 1 and that made vertical lines.

 
I figured out the color issue. I assigned the color to the wrong index. Still working on the lines across the chart.
Reason: