
#property copyright "eevviill"
#property link      "http://alievtm.blogspot.com"
#property version   "1.00"
#property strict
#property indicator_chart_window

#property indicator_buffers 8
#property indicator_color1 clrRed
#property indicator_color2 clrBlue
#property indicator_color3 clrRed
#property indicator_color4 clrBlue
#property indicator_width1 5
#property indicator_width2 5
#property indicator_width3 1
#property indicator_width4 1
//yell
#property indicator_color5 clrYellow
#property indicator_color6 clrYellow
#property indicator_color7 clrYellow
#property indicator_color8 clrYellow
#property indicator_width5 5
#property indicator_width6 5
#property indicator_width7 1
#property indicator_width8 1


extern ENUM_TIMEFRAMES Time_frame = 1440;
extern int Candle_shift = 5;




double body_up[];
double body_down[];
double shadow_up[];
double shadow_down[];
//yell
double yell_body_up[];
double yell_body_down[];
double yell_shadow_up[];
double yell_shadow_down[];

datetime prevtime;


/////////////////////////////////////////////////////////////////
int OnInit()
  {
SetIndexBuffer(0,body_up);
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexShift(0,Candle_shift);

SetIndexBuffer(1,body_down);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexShift(1,Candle_shift);

SetIndexBuffer(2,shadow_up);
SetIndexStyle(2,DRAW_HISTOGRAM);
SetIndexShift(2,Candle_shift);

SetIndexBuffer(3,shadow_down);
SetIndexStyle(3,DRAW_HISTOGRAM);
SetIndexShift(3,Candle_shift);

//yell
SetIndexBuffer(4,yell_body_up);
SetIndexStyle(4,DRAW_HISTOGRAM);
SetIndexShift(4,Candle_shift);

SetIndexBuffer(5,yell_body_down);
SetIndexStyle(5,DRAW_HISTOGRAM);
SetIndexShift(5,Candle_shift);

SetIndexBuffer(6,yell_shadow_up);
SetIndexStyle(6,DRAW_HISTOGRAM);
SetIndexShift(6,Candle_shift);

SetIndexBuffer(7,yell_shadow_down);
SetIndexStyle(7,DRAW_HISTOGRAM);
SetIndexShift(7,Candle_shift);

   return(INIT_SUCCEEDED);
  }




//////////////////////////////////////////////////////////////////
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[])
  {
    //new bar
if (Time[0] != prevtime) 
{
 ArrayInitialize(body_up,EMPTY_VALUE);
ArrayInitialize(body_down,EMPTY_VALUE);
ArrayInitialize(shadow_up,EMPTY_VALUE);
ArrayInitialize(shadow_down,EMPTY_VALUE);
  ArrayInitialize(yell_body_up,EMPTY_VALUE);
ArrayInitialize(yell_body_down,EMPTY_VALUE);
ArrayInitialize(yell_shadow_up,EMPTY_VALUE);
ArrayInitialize(yell_shadow_down,EMPTY_VALUE);

prevtime = Time[0];
}
   

  
double open_=iOpen(Symbol(),Time_frame,0);
double close_=iClose(Symbol(),Time_frame,0);

//main
if(close_!=open_)
{
yell_body_up[0]=EMPTY_VALUE;
yell_body_down[0]=EMPTY_VALUE;
yell_shadow_up[0]=EMPTY_VALUE;
yell_shadow_down[0]=EMPTY_VALUE;

body_up[0]=open_;
body_down[0]=close_;

if(close_<open_)
{
shadow_up[0]=iHigh(Symbol(),Time_frame,0);
shadow_down[0]=iLow(Symbol(),Time_frame,0);
}
if(close_>open_)
{
shadow_up[0]=iLow(Symbol(),Time_frame,0);
shadow_down[0]=iHigh(Symbol(),Time_frame,0);
}
}

//yell
if(close_==open_)
{
body_up[0]=EMPTY_VALUE;
body_down[0]=EMPTY_VALUE;
shadow_up[0]=EMPTY_VALUE;
shadow_down[0]=EMPTY_VALUE;

yell_body_up[0]=open_;
yell_body_down[0]=close_;
yell_shadow_up[0]=iHigh(Symbol(),Time_frame,0);
yell_shadow_down[0]=iLow(Symbol(),Time_frame,0);
}



   return(rates_total);
  }

