Hello, lately I’m using the indicator [B]Gann Hilo Histo[/B] and i am getting great results with it, it is basically an adjusted moving average, which has a lot of accuracy to indicate when a trend is ending. In order to perform backtests in excel I wish someone translate the code for me in a way I could get an excel spreadsheet (the mathematical formula itself), could anyone?
thats the code:
int start() {
int limit, counted_bars, i;
counted_bars=IndicatorCounted();
if(counted_bars < 0) return (-1);
if(counted_bars>0) counted_bars–;
if(counted_bars==0) counted_bars=2;
limit=MathMax(Bars-counted_bars,period);
limit=Bars-counted_bars;
//for (i=0; i<limit; i++) {
for (i=limit; i>=0; i–) {
ghl_buffer[i]=ghl_buffer[i+1];
if (Close[i]==0)
ghl_buffer[i]=EMPTY_VALUE;
else if(Close[i]>iMA(Symbol(),0,period,0,MODE_SMA,PRICE_HIGH,i+1))
ghl_buffer[i]=1;
else if(Close[i]<iMA(Symbol(),0,period,0,MODE_SMA,PRICE_LOW,i+1))
ghl_buffer[i]=-1;
up_buffer[i] = EMPTY_VALUE;
dn_buffer[i] = EMPTY_VALUE;
if (ghl_buffer[i]==1) {
up_buffer[i] = 1;
dn_buffer[i] = 0;
}
else if (ghl_buffer[i]==-1){
dn_buffer[i] = 1;
up_buffer[i] = 0;
}
}
return(0);