Help required to add buy sell signals

#1
Dear Friends,

Please find below afl. I need buy sell signals when price appeared

_SECTION_BEGIN( "Heikin Ashi" );
SetChartOptions( 0, chartShowArrows | chartShowDates );

HaClose = ( O + H + L + C ) / 4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
xDiff = ( HaHigh - Halow ) * 10000;
barcolor = IIf( HaClose >= HaOpen, colorGreen, colorRed );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "", barcolor, styleCandle );
_SECTION_END();

// pivots and prices
// based on Pramod's comments http://www.amibroker.com/library/detail.php?id=617
// adapted by Reinsley : Prices on Pivot and ajustable digits #
// mod by Sanjiv Bansal : take care of Highs or Lows when two adjacent bars are equal
// does not reference to future

SetChartOptions( 0, chartShowDates );

_SECTION_BEGIN( "Price" );
_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} Op %g, Hi %g, Lo %g, Cl %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
//Plot( C, "Close", ParamColor( "Color", colorBlack ), styleNoTitle | styleCandle | styleThick );
_SECTION_END();

_SECTION_BEGIN( "pivot" );
price = ParamToggle( "Plot Price", "Off|On", 1 );
num = Param( "trend", 4, 1, 10, 1 );
dist = 0.5 * ATR( 10 );
rightfig = Param( "rightfig ", 7, 1, 10, 1 );
xspace = Param( "GraphXSpace ", 10, 1, 20, 1 );

mHHV = HHV( H, num );
mLLV = LLV( L, num );

FirstVisibleBar = Status( "FirstVisibleBar" );
Lastvisiblebar = Status( "LastVisibleBar" );

for ( b = Firstvisiblebar + num; b <= Lastvisiblebar AND b < BarCount -
num; b++ )
{
i = num;
ml = 0;
mu = 0;

while ( i > 0 )
{

if ( L < L[b+i] )
{
ml++;
}


if ( H > H[b+i] )
{
mu++;
}

i--;
}


if ( ml == num AND L == mLLV )
{
PlotText( "\n *\n", b, L, colorGreen );

if ( price == 1 )
{
p = StrRight( NumToStr( L, 4.1 ), rightfig );
PlotText( "\n\n" + p, b - 2 , L , colorGreen );

}
}

if ( mu == num AND H == mHHV )
{
PlotText( " *\n", b, H, colorRed );

if ( price == 1 )
{
p = StrRight( NumToStr( H, 4.1 ), rightfig );
PlotText( p , b - 2 , H + dist + 1, colorRed );

}
}
}

_SECTION_END();

GraphXSpace = xspace;
 

Similar threads