How to set an indicator line as a constant number

 
I would like to set an indicator line as a constant number, such as 10. But code below doesn't work.
What is wrong with that code? Thanks a lot

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- buffers
double ExtMapBuffer1[];

int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
//----
   return(0);
  }

int deinit()
  {
   return(0);
  }

int start()
  {
   int limit,counter;
   int counted_bars=IndicatorCounted();

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

   for(int i=0; i<limit; i++)
     {ExtMapBuffer1[i]=10;
     }
   return(0);
  }
 
I would like to set an indicator line as a constant number, such as 10. But code below doesn't work.
What is wrong with that code? Thanks a lot

#property indicator_separate_window
#property indicator_buffers 2                        // Changed
#property indicator_color1 Red
#property indicator_color2 Blue                     // Added
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];                               // Added
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);

   SetIndexStyle(1,DRAW_LINE);                   // Added
   SetIndexBuffer(1,ExtMapBuffer2);               // Added
//----
   return(0);
  }

int deinit()
  {
   return(0);
  }

int start()
  {
   int limit,counter;
   int counted_bars=IndicatorCounted();

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

   for(int i=0; i<limit; i++)
     {
     ExtMapBuffer1[i]=10;
     ExtMapBuffer2[i]=9.9999;                // 10 will not work
     }
   return(0);
  }



This has been very interesting problem on which I have spent several hours to debug and am still unsure if there is a "BUG" in MT4 or if it is meant to be.

Firstly, it appears that MT4 indicator will not work with only one buffer.
Secondly, it appears that MT4 indicator having two buffers will work but the value cannot be same in both buffers.
10 and 10 will not work but 10 and 9.9999 will work.
Only Slawa can explain this one!
 
Thanks, sub

I think MT4 can work with one buffer. If 10 in my original code is replaced by i (varible number), a perfect downward straight line will be drawn. So one buffer can work. But if I set indicator buffer as a constant number(such as 10), code would fail. I cannot figure out this problem.
 
Maybe it must be a double ? Do you have try 10.0 ?
 
Maybe it must be a double ? Do you have try 10.0 ?

No!
The double will not work and putting 10 or 10.0 into a double variable will not work either.
It appears that "i" works because the "i" is changing so there is more than one value in the buffer.
So as long as there is only one value in the buffer it will not work.
However, initializing the buffer outside of the ( i=0; i<limit;) limits to any other value will work.
Reason: