Skip to main content

HURST BANDS for Amibroker (AFL)

Pascal SAMSON over 15 years ago Amibroker (AFL)

  • Rating:
    4 / 5 (Votes 10)
  • Tags:
    amibroker, bands

Trading bands are lines plotted in and around the price structure to form an «envelope».
They are powerful, as they give Buy and Sell signals based on price touching the bands.
They answer the question of whether prices are high or low on a relative basis.
It is the action of prices near the edges of the envelope that we are particularly interested in.

J.M. Hurst’s approach involved the drawing of smoothed envelopes around price to aid in cycle identification.
Here is an example of this technique: different envelopes are used for cycles of different lenghts.

Screenshots

Indicator / Formula

Copy & Paste Friendly
CY1 =  Param("Short Cycle Length?" ,10, 1 ,1000 ,1 )/2;
CY2 =  Param("Medium Cycle Length?" ,80, 1 ,1000 ,1 )/2;
M1 =  Param("Short Cycle Multiplyer?" ,1, 0.01 ,10 ,1 );
M2 =  Param("Medium Cycle Multiplyer?" ,3, 0.01 ,10 ,1 );
T1 =  Ref(MA(Close ,CY1 ),CY1/2)+ M1*ATR(CY1 );
B1 =  Ref(MA( Close ,CY1 ),CY1/2)- M1*ATR(CY1 );
T2 =  Ref(MA(Close ,CY2 ),CY2/2)+ M2*ATR(CY2 );
B2 =  Ref(MA( Close ,CY2 ),CY2/2)- M2*ATR(CY2 );

Plot(T1, "", colorLime);
Plot(B1, "", colorLime);
Plot(T2, "", colorRed);
Plot(B2, "", colorRed);

GraphXSpace = 5;
_SECTION_BEGIN( "Price" );
SetChartOptions( 0, chartShowDates | chartShowArrows | chartLogarithmic | chartWrapTitle );
_N( Title = StrFormat( "{{NAME}} - " + SectorID( 1 ) + " - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + WriteVal( V, 1.0 ) + " {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", colorRose, styleCandle | styleNoTitle | ParamStyle( "Style" ) | GetPriceStyle() );

if ( ParamToggle( "Tooltip shows", "All Values|Only Prices" ) )
{
    ToolTip = StrFormat( "Open: %g\nHigh:  %g\nLow:   %g\nClose:  %g (%.1f%%)\nVolume: " + NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 ) ) );
}
_SECTION_END();

6 comments

1. pras
over 15 years ago

Sir,

You have highlighted of reliability of this band based signal with lower panel crossover rule but unfortunately this afl not include. So, i would request you pl share said afl or give the name of this afl.

Thanks

over 15 years ago

Hello Pras,

I suppose that the afl you are talking about is TSI (True Strenght Index), and you can find it on Wisestocktrader.

Regards

3. demon
over 15 years ago

This looks to the future. Sometimes it gives useful signals but not sa good as it shows in the past :) Where should I learn how to use it?

over 7 years ago

don’t know the creator , but this version almost done
still must corrected, repaint/redraw occurs
since “interpolation algorithm” is missing

other version i know is KelvinHand version
( please correct me if i am wrong )

hope KelvinHand or other coder can repair afl code.
here’s mql code for interpolation,
something like this

if (Interpolate) 
{   
      _time = iTime(NULL,timeFrame,y);
      for(int n = 1; i+n < Bars && Time[i+n] >= _time; n++) {}	
      for(int m = 1; m < n; m++)
      {
             UpEnv[i+m] = UpEnv[i]  +(UpEnv[i+n]-UpEnv[i])*m/n;
             DnEnv[i+m] = DnEnv[i]  +(DnEnv[i+n]-DnEnv[i])*m/n;
             tmBuf[i+m] = tmBuf[i]  +(tmBuf[i+n]-tmBuf[i])*m/n;
      }         
}

Leave Comment

Please login here to leave a comment.