Hawkeye Afl-Amibroker

#1
Hi guys

Found a useful afl on the internet. Would like to share with you all. I remember seeing a long thread trying to get this concept converted to afl.

http://www.traderji.com/amibroker/90684-has-anybody-seen-hawkeye-indicator-equivalent-afl.html

The bottomline:

Hawkeye HeatMap

The Heatmap ia a momentum indicator that graphically shows what the three trend speeds – conservative, normal & aggressive – are doing during a single timeframe. When all three trends agree, then the Heatmap is either bright green or bright red. When one or two of the trends don’t agree, then the Heatmap is dark green or dark red color. It’s called the Heatmap because it is a graphical representation of the strength of the trend. It therefore assists in determining whether the market momentum favors a higher- or lower- risk trading opportunity.

Here is the code:
--------------------------------------------------------
//HEATMAP HAWKEYE
//3 TRENDSPEEDS CONSERVATIVE NORMAL AGGRESSIVE
//TRENDSPEED RSI(20)>MA(RSI(20),7) AS PER TRADESTATION


GraphXSpace =15;
_SECTION_BEGIN("RALLY+DECLINE");
SetChartBkColor(64);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
n = Param("Bars",5,2,20,1);
H5 = HHV(H,n); L5 = LLV(L,n);
Plot(H5,"HHV5",colorBlueGrey,styleNoLine|styleDots,0,0,1);
Plot(L5,"LLV5",colorLime,styleNoLine|styleDots,0,0,1);
UP = H > Ref(H5,-1); DN = L < Ref(L5,-1);
UP = ExRem(UP,DN); DN = ExRem(DN,UP);
PlotShapes(5*UP+6*DN,colorWhite,0,IIf(UP,L,H),-20);
PriceColor = IIf(BarsSince(UP)<BarsSince(DN), colorBrightGreen, colorRed);
SetBarFillColor(IIf(C > O, GetChartBkColor(), PriceColor));
Plot( C, "Close", PriceColor, styleCandle | styleNoTitle,0,0,0,1);
_SECTION_END();



UPTREND= RSI(20)>MA(RSI(20),7);
DNTREND = RSI(20)<MA(RSI(20),7);
RSI20 =RSI(20);
MARSI =MA(RSI20,7);

//CONSERVATIVE HOURLY
//NORMAL =DAILY
//AGGRESSIVE = WEEKLY
//===============================================================
TimeFrameSet( in15Minute ); // switch to 5 minute frame

/* RSI_15 now operates on 15 minute data,RSI_15 holds time-compressed 20 bar RSI of 15min bars */

RSI_15 =RSI20 ;
MARSI_15 =MARSI;
TimeFrameRestore(); // restore time frame to original
//==============================================================================
TimeFrameSet( inHourly ); // switch now to hourly
RSI_H =RSI20 ;
MARSI_H =MARSI;


TimeFrameRestore(); // restore time frame to original
//===================================================================
TimeFrameSet( 4*inHourly ); // switch now to 4hourly
RSI_4H =RSI20 ;
MARSI_4H =MARSI;


TimeFrameRestore(); // restore time frame to original
//==============================================================
TimeFrameSet( inDaily ); // switch now to DAIly


RSI_D =RSI20 ;
MARSI_D =MARSI;

TimeFrameRestore(); // restore time frame to original

//===================================================


RSI_15EXP = TimeFrameExpand( RSI_15, in15Minute);
MARSI_15EXP =TimeFrameExpand( MARSI_15, in15Minute);


RSI_HEXP = TimeFrameExpand( RSI_H, inHourly);
MARSI_HEXP = TimeFrameExpand( MARSI_H, inHourly);



RSI_4HEXP = TimeFrameExpand( RSI_4H, 4*inHourly);
MARSI_4HEXP = TimeFrameExpand( MARSI_4H, 4*inHourly);

RSI_DEXP = TimeFrameExpand( RSI_D, 4*inDaily);
MARSI_DEXP = TimeFrameExpand( MARSI_D, inDaily);
//=====================================================
_SECTION_BEGIN("trending ribbon");
uptr15= RSI_15EXP>MARSI_15EXP ;
downtr15= RSI_15EXP<MARSI_15EXP ;

Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptr15, colorGreen, IIf( downtr15, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
//====================================

uptrH= RSI_HEXP>MARSI_HEXP ;
downtrH= RSI_HEXP<MARSI_HEXP ;

Plot( 4, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrH, colorDarkGreen, IIf( downtrH, colorDarkRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
//====================================

uptr4H= RSI_4HEXP>MARSI_4HEXP ;
downtr4H= RSI_4HEXP<MARSI_4HEXP ;

Plot( 6, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptr4H, colorBlue, IIf( downtr4H, colorYellow, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
//====================================

uptrD= RSI_DEXP>MARSI_DEXP ;
downtrD= RSI_DEXP<MARSI_DEXP ;

Plot( 8, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrD, colorLightBlue, IIf( downtrD, colorCustom12, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
--------------------------------------------------------

When i plotted the same it is giving nice buy sell signals (check Bank Nifty chart)

May i request the seniors to add the Exploration Code in this.
or try to explain how to interpret the chart in detail.

I hope its of use to someone..

cheers
 

pkgmtnl

Well-Known Member
#2
Hi guys

Found a useful afl on the internet. Would like to share with you all. I remember seeing a long thread trying to get this concept converted to afl.

http://www.traderji.com/amibroker/90684-has-anybody-seen-hawkeye-indicator-equivalent-afl.html

The bottomline:

Hawkeye HeatMap

The Heatmap ia a momentum indicator that graphically shows what the three trend speeds – conservative, normal & aggressive – are doing during a single timeframe. When all three trends agree, then the Heatmap is either bright green or bright red. When one or two of the trends don’t agree, then the Heatmap is dark green or dark red color. It’s called the Heatmap because it is a graphical representation of the strength of the trend. It therefore assists in determining whether the market momentum favors a higher- or lower- risk trading opportunity.

Here is the code:
--------------------------------------------------------
//HEATMAP HAWKEYE
//3 TRENDSPEEDS CONSERVATIVE NORMAL AGGRESSIVE
//TRENDSPEED RSI(20)>MA(RSI(20),7) AS PER TRADESTATION


GraphXSpace =15;
_SECTION_BEGIN("RALLY+DECLINE");
SetChartBkColor(64);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
n = Param("Bars",5,2,20,1);
H5 = HHV(H,n); L5 = LLV(L,n);
Plot(H5,"HHV5",colorBlueGrey,styleNoLine|styleDots,0,0,1);
Plot(L5,"LLV5",colorLime,styleNoLine|styleDots,0,0,1);
UP = H > Ref(H5,-1); DN = L < Ref(L5,-1);
UP = ExRem(UP,DN); DN = ExRem(DN,UP);
PlotShapes(5*UP+6*DN,colorWhite,0,IIf(UP,L,H),-20);
PriceColor = IIf(BarsSince(UP)<BarsSince(DN), colorBrightGreen, colorRed);
SetBarFillColor(IIf(C > O, GetChartBkColor(), PriceColor));
Plot( C, "Close", PriceColor, styleCandle | styleNoTitle,0,0,0,1);
_SECTION_END();



UPTREND= RSI(20)>MA(RSI(20),7);
DNTREND = RSI(20)<MA(RSI(20),7);
RSI20 =RSI(20);
MARSI =MA(RSI20,7);

//CONSERVATIVE HOURLY
//NORMAL =DAILY
//AGGRESSIVE = WEEKLY
//===============================================================
TimeFrameSet( in15Minute ); // switch to 5 minute frame

/* RSI_15 now operates on 15 minute data,RSI_15 holds time-compressed 20 bar RSI of 15min bars */

RSI_15 =RSI20 ;
MARSI_15 =MARSI;
TimeFrameRestore(); // restore time frame to original
//==============================================================================
TimeFrameSet( inHourly ); // switch now to hourly
RSI_H =RSI20 ;
MARSI_H =MARSI;


TimeFrameRestore(); // restore time frame to original
//===================================================================
TimeFrameSet( 4*inHourly ); // switch now to 4hourly
RSI_4H =RSI20 ;
MARSI_4H =MARSI;


TimeFrameRestore(); // restore time frame to original
//==============================================================
TimeFrameSet( inDaily ); // switch now to DAIly


RSI_D =RSI20 ;
MARSI_D =MARSI;

TimeFrameRestore(); // restore time frame to original

//===================================================


RSI_15EXP = TimeFrameExpand( RSI_15, in15Minute);
MARSI_15EXP =TimeFrameExpand( MARSI_15, in15Minute);


RSI_HEXP = TimeFrameExpand( RSI_H, inHourly);
MARSI_HEXP = TimeFrameExpand( MARSI_H, inHourly);



RSI_4HEXP = TimeFrameExpand( RSI_4H, 4*inHourly);
MARSI_4HEXP = TimeFrameExpand( MARSI_4H, 4*inHourly);

RSI_DEXP = TimeFrameExpand( RSI_D, 4*inDaily);
MARSI_DEXP = TimeFrameExpand( MARSI_D, inDaily);
//=====================================================
_SECTION_BEGIN("trending ribbon");
uptr15= RSI_15EXP>MARSI_15EXP ;
downtr15= RSI_15EXP<MARSI_15EXP ;

Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptr15, colorGreen, IIf( downtr15, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
//====================================

uptrH= RSI_HEXP>MARSI_HEXP ;
downtrH= RSI_HEXP<MARSI_HEXP ;

Plot( 4, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrH, colorDarkGreen, IIf( downtrH, colorDarkRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
//====================================

uptr4H= RSI_4HEXP>MARSI_4HEXP ;
downtr4H= RSI_4HEXP<MARSI_4HEXP ;

Plot( 6, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptr4H, colorBlue, IIf( downtr4H, colorYellow, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
//====================================

uptrD= RSI_DEXP>MARSI_DEXP ;
downtrD= RSI_DEXP<MARSI_DEXP ;

Plot( 8, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrD, colorLightBlue, IIf( downtrD, colorCustom12, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
--------------------------------------------------------

When i plotted the same it is giving nice buy sell signals (check Bank Nifty chart)

May i request the seniors to add the Exploration Code in this.
or try to explain how to interpret the chart in detail.

I hope its of use to someone..

cheers
First Chalk out your BUY / SELL conditions to make it Explore.
 

Similar threads

Broker Special Offers

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?