Please find a quick update and quickly test. check it.
please publish your code with the code button. Easy to read and copy/paste.
cheers
Philippe
Code: Select all
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 LimeGreen
extern int MA_Period = 25;
//--- global variables
//--- buffers
double hhlc[];
double llhc[];
double pnt;
//--- buffers
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,108);
SetIndexBuffer(0,hhlc);
SetIndexEmptyValue(0,0.0);
SetIndexLabel(0,"HighHigh_LowerClose");
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,108);
SetIndexBuffer(1,llhc);
SetIndexEmptyValue(1,0.0);
SetIndexLabel(1,"LowerLow_HigherClose");
pnt=MarketInfo(Symbol(),MODE_POINT);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
int limit = Bars - IndicatorCounted() -2; // we need to look 1 bar ahead of the position so Bar-1 is too large
if( limit < 1 )
limit = 1;
// note that we never draw the ZERO
// bar as it will almost always be an inside bar initiall
for( int n=limit; n>0; n-- )
if( (High[n]>High[n+1]) && (Close[n]<Close[n+1]) )
{ // this is an Higher High Lower Close bar
if (High[n] > iMA(NULL,0,MA_Period,0,MODE_EMA,PRICE_CLOSE,n))
{
hhlc[n] = High[n]+10*pnt;
}
else hhlc[n] = (0);
}
else if ( (Low[n]<Low[n+1]) && (Close[n]>Close[n+1]) )
{ // this is an Lower Low Higher Close bar
if (Low[n] < iMA(NULL,0,MA_Period,0,MODE_EMA,PRICE_CLOSE,n))
{
llhc[n] = Low[n]-10*pnt;
}
else llhc[n]= (0);
}
else{ // it is not anything useful so don't draw it
hhlc[n] = (0);
llhc[n]= (0);
}
//----
return(0);
}