Skip to main content

Red Buy Green Sell for Amibroker (AFL)

janet0211 about 16 years ago Amibroker (AFL)

  • Rating:
    3 / 5 (Votes 4)
  • Tags:
    amibroker, moving average

JUST SO SIMPLE
Red Buy Green Sell

Based on a Moving Average crossover.

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("Red Buy Green Sell");

GraphXSpace=8;

P1 = Param( "MA01 Period", 5, 2, 200 );
P2 = Param( "MA02 Period", 10, 2, 200 );

MA01=MA(C,P1 );
MA02=MA(C,P2 );

RG=IIf(MA01>MA02,MA01-MA02,-(MA02-MA01));

PlotOHLC( MA02,RG+MA02,MA02,RG+MA02,"",23, styleCandle+4096); 
Plot( SelectedValue(C), "",IIf(SelectedValue(MA01)>SelectedValue(MA02),4,34),styleNoLine);
PlotShapes( IIf( Cross(MA01,MA02),shapeUpArrow,0),4,0, MA02-ATR(30) ,0);
PlotShapes( IIf( Cross(MA02,MA01),shapeDownArrow,0),34,0, MA02+ATR(30), 0);

Title = EncodeColor(44)+Name() +"    ( "+Interval(2)+" )    "+EncodeColor(41 )+WriteVal( DateTime(), formatDateTime);

_SECTION_END();

2 comments

Leave Comment

Please login here to leave a comment.