You are on page 1of 2

Gann HiLo activator bars

//+------------------------------------------------------------------+
//|
Gann HiLo - bars.mq4 |
//|
mladen |
//|
|
//| Original introduced by Robert Krausz
|
//| (February 1998, Stocks & Commodities Magazine
|
//+------------------------------------------------------------------+
#property copyright "www.forex-tsd.com"
#property link
"www.forex-tsd.com"
#property
#property
#property
#property

indicator_chart_window
indicator_buffers 2
indicator_color1 Blue
indicator_color2 Red

//
//
//
//
//
extern int Lb = 10;
double hi[];
double lo[];
double Hlv[];
//+------------------------------------------------------------------+
//|
|
//+------------------------------------------------------------------+
//
//
//
//
//
int init()
{
IndicatorBuffers(3);
SetIndexBuffer(0,hi); SetIndexDrawBegin(0,Lb+1); SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(1,lo); SetIndexDrawBegin(1,Lb+1); SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(2,Hlv);
return(0);
}
//
//
//
Page 1

Gann HiLo activator bars


//
//
int start()
{
int counted_bars=IndicatorCounted();
int i,limit;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//
//
//
//
//
for(i=limit;i>=0;i--)
{
Hlv[i] = Hlv[i+1];
if(Close[i]>iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1)) Hlv[i] = 1;
if(Close[i]<iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1)) Hlv[i] = -1;
if(Hlv[i] == -1)
{ lo[i] = High[i]; hi[i] = Low[i]; }
else { hi[i] = High[i]; lo[i] = Low[i]; }
}
return(0);
}

Page 2

You might also like