a little help please

 

hello i am currently working on a system,
and i am trying to create a histogram like the one attached below 

i want to make it like this


but what i currently have is this:

currently its like this


so a little help would be appreciated. 
source code to my indicator is: 

#include <stdlib.mqh>
#include <stderror.mqh>

//--- indicator settings
#property indicator_separate_window
#property indicator_buffers 2

#property indicator_type1 DRAW_HISTOGRAM
#property indicator_style1 STYLE_SOLID
#property indicator_width1 2
#property indicator_color1 0x00FF2B
#property indicator_label1 "Buy"

#property indicator_type2 DRAW_HISTOGRAM
#property indicator_style2 STYLE_SOLID
#property indicator_width2 2
#property indicator_color2 0x2B00FF
#property indicator_label2 "Sell"

//--- indicator buffers
double Buffer1[];
double Buffer2[];

extern int Fast_EMA = 12;
extern int slow_EMA = 26;
extern int macd_sma = 9;
extern double value = 0;
extern int Period1 = 14;
extern double value2 = 0;
extern double value3 = 0;
extern double value4 = 0;
double myPoint; //initialized in OnInit

void myAlert(string type, string message)
  {
   if(type == "print")
      Print(message);
   else if(type == "error")
     {
      Print(type+" | sample @ "+Symbol()+","+Period()+" | "+message);
     }
   else if(type == "order")
     {
     }
   else if(type == "modify")
     {
     }
  }

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {   
   IndicatorBuffers(2);
   SetIndexBuffer(0, Buffer1);
   SetIndexEmptyValue(0, 0);
   SetIndexBuffer(1, Buffer2);
   SetIndexEmptyValue(1, 0);
   //initialize myPoint
   myPoint = Point();
   if(Digits() == 5 || Digits() == 3)
     {
      myPoint *= 10;
     }
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
  {
   int limit = rates_total - prev_calculated;
   //--- counting from 0 to rates_total
   ArraySetAsSeries(Buffer1, true);
   ArraySetAsSeries(Buffer2, true);
   //--- initial zero
   if(prev_calculated < 1)
     {
      ArrayInitialize(Buffer1, 0);
      ArrayInitialize(Buffer2, 0);
     }
   else
      limit++;
   
   //--- main loop
   for(int i = limit-1; i >= 0; i--)
     {
      if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation   
      //Indicator Buffer 1
      if(iMACD(NULL, PERIOD_CURRENT, Fast_EMA, slow_EMA, macd_sma, PRICE_CLOSE, MODE_MAIN, i) > value //MACD > fixed value
      && iCCI(NULL, PERIOD_CURRENT, Period1, PRICE_CLOSE, i) > value2 //Commodity Channel Index > fixed value
      )
        {
         Buffer1[i] = Low[i]; //Set indicator value at Candlestick Low
        }
      else
        {
         Buffer1[i] = 0;
        }
      //Indicator Buffer 2
      if(iMACD(NULL, PERIOD_CURRENT, Fast_EMA, slow_EMA, macd_sma, PRICE_CLOSE, MODE_MAIN, i) < value3 //MACD < fixed value
      && iCCI(NULL, PERIOD_CURRENT, Period1, PRICE_CLOSE, i) < value4 //Commodity Channel Index < fixed value
      )
        {
         Buffer2[i] = High[i]; //Set indicator value at Candlestick High
        }
      else
        {
         Buffer2[i] = 0;
        }
     }
   return(rates_total);
  }
 
One condition, set one buffer to zero and the other to one. Not two different conditions: if(condition1)... if(condition2) Buffer2... Not to High or Low.
 
whroeder1:
One condition, set one buffer to zero and the other to one. Not two different conditions: if(condition1)... if(condition2) Buffer2... Not to High or Low.

thank you i am gonna try this 
i'll post the result here

 
whroeder1:
One condition, set one buffer to zero and the other to one. Not two different conditions: if(condition1)... if(condition2) Buffer2... Not to High or Low.


currently i am somewhat close to what i want it to be 

here is what i did

 {
      if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation   
      //Indicator Buffer 1
      if(iMACD(NULL, PERIOD_CURRENT, Fast_EMA, slow_EMA, macd_sma, PRICE_CLOSE, MODE_MAIN, i) > value //MACD > fixed value
      && iCCI(NULL, PERIOD_CURRENT, Period1, PRICE_CLOSE, i) > value2 //Commodity Channel Index > fixed value
      )
        {
         Buffer1[i] = Low[1]; //Set indicator value at Candlestick Low
        }
      else
        {
         Buffer1[i] = 0;
        }
      //Indicator Buffer 2
      if(iMACD(NULL, PERIOD_CURRENT, Fast_EMA, slow_EMA, macd_sma, PRICE_CLOSE, MODE_MAIN, i) < value3 //MACD < fixed value
      && iCCI(NULL, PERIOD_CURRENT, Period1, PRICE_CLOSE, i) < value4 //Commodity Channel Index < fixed value
      )
        {
         Buffer2[i] = High[1]; //Set indicator value at Candlestick High
        }
      else
        {
         Buffer2[i] = 0;
        }
     }
   return(rates_total);
  }

but when i remove the high and low the histogram disappear

and when i replace it with open and close the histogram bars gets of different sizes

now how can i increase the size of green histogram bars , so that it could be of the same size as red? 

 
sam016: but when i remove the high and low the histogram disappear
  1. Why would you expect anything else to happen?
  2. What part of "one buffer to zero and the other to one," was unclear?
 
whroeder1:
  1. Why would you expect anything else to happen?
  2. What part of "one buffer to zero and the other to one," was unclear?

thank you 
its done 
thanks for your help

Reason: