//+------------------------------------------------------------------+
//| myCandle.mq4 |
//| Copyright © 2011, Aiman |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, Aiman"
#property link ""
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 DarkViolet
#property indicator_color2 DarkSlateBlue
#property indicator_color3 DarkViolet
#property indicator_color4 DarkSlateBlue
double low[],high[],open[],close[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 2);
SetIndexBuffer(0, low);
SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 2);
SetIndexBuffer(1, high);
SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 4);
SetIndexBuffer(2, open);
SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID, 4);
SetIndexBuffer(3, close);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int newBar=Bars-counted_bars;
double O,C,H,L;
//----
for (int i=newBar; i>-1; i--)
{
O = iOpen(0,0,i);
C = iClose(0,0,i);
H = iHigh(0,0,i);
L = iLow(0,0,i);
//--- hammer pattern
if(((H-L)>3*(O-C))&&((C-L)/(0.001+H-L)>0.6)&&((O-L)/(0.001+H-L)>0.6))
{
open[i] = O;
close[i] = C;
high[i] = H;
low[i] = L;
if (O>C)
{
high[i] = L;
low[i] = H;
}
}
//---
}
//----
return(0);
}
//+------------------------------------------------------------------+