//+------------------------------------------------------------------+
//| Candle strength.mq4 |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_minimum -60
#property indicator_maximum 60
#property indicator_level1 50
#property indicator_level2 0
#property indicator_level3 -50
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_width1 3
#property indicator_color2 Red
#property indicator_width2 3
double ind_buffer1[];
double ind_buffer2[];
int ExtCountedBars=0;
//+------------------------------------------------------------------+
int init() {
//+------------------------------------------------------------------+
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,3,Green);
SetIndexBuffer(0,ind_buffer1);
SetIndexEmptyValue(0,0.0);
SetIndexDrawBegin(0,0);
ArrayInitialize(ind_buffer1,EMPTY_VALUE);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,3,Red);
SetIndexBuffer(1,ind_buffer2);
SetIndexEmptyValue(1,0.0);
SetIndexDrawBegin(1,0);
ArrayInitialize(ind_buffer2,EMPTY_VALUE);
IndicatorShortName("Candle strength");
return(0);
}
//+------------------------------------------------------------------+
int deinit() {
//+------------------------------------------------------------------+
return(0);
}
//+------------------------------------------------------------------+
int start() {
//+------------------------------------------------------------------+
for (int i=0; i<=Bars; i++) {
double value = 100*(Open[i]-Low[i])/(High[i]-Low[i])-50;
if (Close[i] > Open[i])
ind_buffer1[i] = value;
else
ind_buffer2[i] = value;
}
return(0);
}