EMA Crossover Trading Guide


EMA Crossover Trading Guide
EMA Crossover Trading Guide


//www.aflcode.com
_SECTION_BEGIN("EMA");

P = ParamField("Price field",-1);

//Plot( EMA( P, 11), "EMA(CLOSE,11)", colorBlue,ParamStyle("Stylethick")); "\n";
//Plot( EMA( P, 22), "EMA(CLOSE,22)", colorAqua,ParamStyle("Stylethick")); "\n";

Plot( MA( C, 4),"MA(Close,4)", colorGold, ParamStyle("Stylethick")); "\n";
Plot( MA( C, 17),"MA(Close,17)", colorGreen, ParamStyle("Stylethick"));"\n"; 
Plot( EMA( C ,34),"EMA(Close,34)", colorPink, ParamStyle("Stylethick") ); 
Plot( MA( C, 50),"MA(Close,50)", colorRed, ParamStyle("Stylethick") ); 


Buy1=Cross(MA(C,4),MA(C,17));
Buy2=Cross(MA(C,17),EMA(C,34));
Buy3=Cross(EMA(C,34),MA(C,50));
Sell1=Cross(MA(C,50),EMA(C,34));
Sell2=Cross(EMA(C,34),MA(C,17));
Sell3=Cross(MA(C,17),MA(C,4));


Mycolor = IIf(buy1 AND buy2,IIf(buy2 AND buy3 AND C>Peak(C,2,1),colorBrightGreen,colorRed),
          IIf(sell3 AND Sell2 ,IIf(sell2 AND sell1,colorRed,colorBlue),colorGrey50));

PlotOHLC( Open,  High,  Low,  Close,"", Mycolor, styleBar  ); 

shape = Buy1 * shapeUpArrow + Sell3 * shapeDownArrow;


PlotShapes( shape, IIf( Buy1, colorBrightGreen, colorRed ),0, IIf( Buy1, Low, High ) );

GraphXSpace = 5;
dist = 1.5*ATR(8); 

for( i = 0; i < BarCount; i++ ) 
{
  if( Buy1[i] ) PlotText( "Buy\n@" + C[ i-1 ], i-1, L[ i-1 ]-dist[i], colorBrightGreen ); 
  if( Sell3[i] ) PlotText( "Sell\n@" + H[ i-1], i-1, H[ i-1 ]+dist[i], colorRed); 
}

Previous
Next Post »