Can't get 2-colored histogram to work, except I already did elsewhere... a little help, please?

 

I've got two indicators I'm experimenting with, having not plotted a histogram before. The first one works but was just fooling around to make sure I got the color side of things right. The second one is set up just like the first one in the relevant areas, but doesn't work.

Code for the one that works, pilfered from an article online:

 //------------------------ Global stuff

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_plots   1
//--- input parameters
input int      bars=30;          // The period of a sinusoid in bars
input int      N=5;              // The number of ticks to change the histogram
//--- plot Color_Histogram
#property indicator_label1  "Color_Histogram"
#property indicator_type1   DRAW_COLOR_HISTOGRAM
//--- Define 8 colors for coloring sections (they are stored in a special array)
#property indicator_color1  clrLime,clrMagenta
#property indicator_style1  STYLE_SOLID
#property indicator_width1  5

//--- A buffer of values
double         Color_HistogramBuffer[];
//--- A buffer of color indexes
double         Color_HistogramColors[];

//------------------------ OnInit stuff

//--- indicator buffers mapping
   SetIndexBuffer(0,Color_HistogramBuffer,INDICATOR_DATA);
   SetIndexBuffer(1,Color_HistogramColors,INDICATOR_COLOR_INDEX);


//Set color for each index
    PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2);
    PlotIndexSetInteger(0, PLOT_LINE_COLOR, 0, clrLime);
    PlotIndexSetInteger(0, PLOT_LINE_COLOR, 1, clrMagenta);


//------------------------ OnCalculate stuff

//--- Fill in the indicator buffer with values
   for(int i=start;i<rates_total;i++)
     {
//--- A value
      Color_HistogramBuffer[i]=sin(i*multiplier);
      Color_HistogramColors[i] = (Color_HistogramBuffer[i] > 0) ? 0 : 1; // 0 for green, 1 for magenta
     }


The second one is the one I'm trying to do for real, and it won't work no matter what I've tried:

//------------------------ Global stuff

#property indicator_separate_window
//#property indicator_chart_window
#property indicator_buffers 14 
#property indicator_plots   13
//#property indicator_type1   DRAW_LINE
//#property indicator_color1  clrAqua
//#property indicator_width1   3
//#property indicator_applied_price 

#property indicator_type1   DRAW_COLOR_HISTOGRAM
//--- Define colors for coloring sections (they are stored in a special array)
#property indicator_color1  clrLime,clrMagenta

double   dbMeter[];
double   dbMeterCLR[];

//------------------------ OnInit stuff

//--- indicator buffers mapping

   SetIndexBuffer          (0,dbMeter,INDICATOR_DATA);
   SetIndexBuffer          (1,dbMeterCLR,INDICATOR_COLOR_INDEX);

      PlotIndexSetInteger  (0,PLOT_DRAW_TYPE,DRAW_HISTOGRAM);
      PlotIndexSetInteger  (0,PLOT_SHOW_DATA,true);
      PlotIndexSetInteger  (0,PLOT_LINE_STYLE,STYLE_SOLID);
      PlotIndexSetInteger  (0,PLOT_COLOR_INDEXES,2);
      PlotIndexSetInteger  (0,PLOT_LINE_COLOR,0,clrLime);
      PlotIndexSetInteger  (0,PLOT_LINE_COLOR,1,clrMagenta);
      PlotIndexSetInteger  (0,PLOT_LINE_WIDTH,5);
      PlotIndexSetString   (0,PLOT_LABEL,"Trade-O-Meter");
   

//------------------------ OnCalculate stuff

   CopyBuffer(iIndy_Hndl,0,0,iBarsCalcd,dbOSMA_4_9_3);
   
   for(int ix = 0; ix < iBarsCalcd; ix++)
   {
      dbMeter[ix]                      = dbOSMA_4_9_3[ix];
      dbMeterCLR[ix]                   = (dbMeter[ix] > 0) ? 0 : 1; // 0 for green, 1 for magenta
      int iii=0;
   }

   ChartRedraw(0);


Here are the results, the one that doesn't work being obvious:


My brain is racked. Anyone see the problem?

 
Millard Melnyk: Anyone see the problem?
Live in ignorance
 
Millard Melnyk:
(0,PLOT_DRAW_TYPE,DRAW_HISTOGRAM)
Did you mean DRAW_COLOR_HlSTOGRAM?
 
William Roeder #:
Live in ignorance

You're so rude, sarcastic, and unhelpful, why do you even bother? I guess maybe because that's all you got?

 
Yashar Seyyedin #:
Did you mean DRAW_COLOR_HlSTOGRAM?

I knew it would probably be another of my many opportunities to face-palm. I'd been at it for about eleven hours when I posted the question. I'd looked at the code side-by-side. Should have used Compare It! instead of my eyeballs.

And yes, DRAW_COLOR_HISTOGRAM is exactly what I meant. Just not what I coded, lol.

Thanks man.


Reason: