Hello friends,

I'm a not an expert coder and confound the way to add green color to get positive histogram and red color for negative histogram with this indior.


The indior code :
Inserted Code // ------------------------------------------------------------------ //| CandleAverage_v1. mq4 | //| Copyright © 2006, Forex-TSD. Com | //| Composed by IgorAD,[email protected] | //| http://finance.groups.yahoo.com/group/TrendLaboratory | //p------------------------------------------------------------------ #property copyright Copyright © 2006, Forex-TSD. Com #property link http://www.forex-tsd.com/ #property indior_separate_window #property indior_buffers 1 #property indior_color1 DeepSkyBlue //-- enter parameters extern int Length=31; extern int H_period=25; extern int L_period=27; extern int C_period=9; //-- buffers dual CandleAvg#91;#93;; dual BarValue#91;#93;; // ------------------------------------------------------------------ //| Custom indior initialization function | // ------------------------------------------------------------------ int init() //-- indiors IndiorBuffers(2); SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexBuffer(0,CandleAvg); SetIndexBuffer(1,BarValue); //-- name for DataWindow and indior subwindow label string short_name=CandleAverage( Length ); IndiorShortName(short_name); SetIndexLabel(0,CandleAvg); SetIndexDrawBegin(0,Length); //-- return(0); // ------------------------------------------------------------------ //| Custom indior iteration serve | // ------------------------------------------------------------------ int begin() int change, limit, counted_bars=IndiorCounted(); dual UpDel,DnDel,H,L,C; //-- if(counted_barslt;0) return(-1); if (counted_bars==0) limit=Bars-Length-1; //-- final counted bar is going to be recounted if(counted_barsgt;0) limit=Bars-counted_bars; limitation -- for(shift=limitation; shiftgt;=0; change --) H = iMA(NULL,0, H_period,0, MODE_EMA, PRICE_HIGH, change); L = iMA(NULL,0, L_period,0, MODE_EMA, PRICE_LOW, change); C = iMA(NULL,0, C_period,0, MODE_EMA, PRICE_CLOSE, change); UpDel = H - C; DnDel = C - L; if ( UpDel lt; DnDel ) BarValue#91;change#93; = 1; if ( UpDel gt; DnDel ) BarValue#91;change#93; = -1; if ( UpDel == DnDel ) BarValue#91;change#93; = 0; for(shift=limitation; shiftgt;=0; change --) CandleAvg#91;change#93; = iMAOnArray(BarValue,0,Length,0,MODE_SMA,change); //-- return(0); // ------------------------------------------------------------------ I tried change the code like bellow :

Inserted Code #property indior_separate_window #property indior_buffers 2 #property indior_color1 DeepSkyBlue #property indior_color2 Red But didn't work because histogram value saved just in 1 buffer, CandleAvg.

How to separate negative and positive worth from CandleAvg buffer and add red green color?

Please advice.

Thanks for the help.