Skip to main content

Bull Bear Identifier for Amibroker (AFL)

WillIAm about 15 years ago Amibroker (AFL)

  • Rating:
    4 / 5 (Votes 3)
  • Tags:
    amibroker, macd, stochastic

This indicator identifies whether a trend is bullish or bearish.
- A green solid arrow is a buy signal. A green hollow signals a bull market trend.
- A red solid arrow is a sell signal. A red hollow signals a bear market trend.

Enjoy.

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("Arrow Detection");

periods = Param( "Periods", 14, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
myStochD =StochD( periods , Ksmooth, DSmooth );
myStochK =StochK( periods , Ksmooth);
Overbought = 80 ;
Oversold =20 ;
Center = 50 ;
 
Buy = Cross( myStochK, Oversold ) ;
Sell = Cross( Overbought, myStochK );


Bull = Cross (myStochK, myStochD) ;
Bear = Cross (myStochD, myStochK) ;
 
PlotShapes(IIf( Sell, shapeDownArrow , shapeNone), colorRed,0, High, Offset=-20) ;
PlotShapes(IIf( Buy , shapeUpArrow , shapeNone), colorGreen,0, Low, Offset=-20) ;

PlotShapes(IIf( Bear, shapeDownArrow , shapeNone), colorRed,0, High, Offset=-20) ;
PlotShapes(IIf( Bull , shapeUpArrow , shapeNone), colorGreen,0, Low, Offset=-20) ;


r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );


Buy= Cross(MACD(12,26),Signal(12,26,9));
Sell = Cross( Signal(12, 26, 9), MACD(12,26) );

PlotShapes(IIf(Buy, shapeHollowUpArrow,shapeNone) ,colorGreen,0, Low, Offset=-10) ;
PlotShapes(IIf(Sell, shapeHollowDownArrow,shapeNone),colorRed,0, High, Offset=-10) ;

_SECTION_END();

4 comments

Leave Comment

Please login here to leave a comment.