Skip to main content

Buy with moving and macd for Amibroker (AFL)

rajsumi almost 15 years ago Amibroker (AFL)

  • Rating:
    3 / 5 (Votes 2)
  • Tags:
    trading system, amibroker

This is combination of 50 ema and macd for buying signals .

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates,colorRed);

Plot(C,"Price",IIf(C>O,colorSeaGreen,colorBrown),styleCandle);

_N(Title = StrFormat("{{NAME}} - {{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", ParamColor("Color", colorBlack ), 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 )));
}


Plot(EMA(Close,50),"50EMA",colorRed,style=styleThick);

_SECTION_END();


B1 = Cross (C, EMA(C,50));
S1 = Cross (EMA(C,50),C);
B2 = Cross (MACD(), Signal());
S2 = Cross (Signal(), MACD());

EMAUP = Flip(B1,S1);
MACDUP = Flip(B2,S2);

BSig = EMAUP AND MACDUP;
SSig = (NOT EMAUP) AND (NOT MACDUP);

BSig = ExRem(Bsig,Ssig);
SSig = ExRem(Ssig,Bsig);

Buy = Bsig;



AddColumn(Close,"Close",1.4);
AddColumn(Buy,"buy",1.2);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorBlue, 0, L, Offset=-20);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorBlue, 0,L, Offset=-30); 
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-25); 

4 comments

almost 15 years ago

Dear rajsumi

only buy signals r coming no sell signals. this is so good if sell signals coming in analysis also.
almost 15 years ago

dear gangadharji here it is
_SECTION_BEGIN(“Price”);
SetChartOptions(0,chartShowArrows|chartShowDates,colorRed);

Plot(C,“Price”,IIf(C>O,colorSeaGreen,colorBrown),styleCandle);

_N(Title = StrFormat("{{NAME}} – {{INTERVAL}} {{DATE}} Open g, Hi %g, Lo %g, Close %g (.1f%%) Vol " WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC) ));
Plot( C, “Close”, ParamColor(“Color”, colorBlack ), 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));
}

Plot(EMA,“50EMA”,colorRed,style=styleThick);

_SECTION_END();

B1 = Cross (C, EMA);
S1 = Cross (EMA,C);
B2 = Cross (MACD);
S2 = Cross (Signal(), MACD;

EMAUP = Flip(B1,S1);
MACDUP = Flip(B2,S2);

BSig = EMAUP AND MACDUP;
SSig = (NOT EMAUP) AND (NOT MACDUP);

BSig = ExRem(Bsig,Ssig);
SSig = ExRem(Ssig,Bsig);

Buy = Bsig;
Sell= Ssig;

AddColumn(Close,“Close”,1.4);
AddColumn(Buy,“buy”,1.2);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorBlue, 0, L, Offset=-20);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorBlue, 0,L, Offset=-30);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-25);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, L, Offset=25);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0,L, Offset=25);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,L, Offset=-25);

almost 15 years ago

Dear ram

thanks for sell signals also. verymuch thank full to u.for other afl contact me peddhah20002000@yahoo.co.in

Leave Comment

Please login here to leave a comment.