("Moving Average Cross-over Trading System");
MACDswitch = ParamToggle("Use MACD?", "No | Yes", 0);
ShortEMA = EMA(C, 5);
LongEMA = EMA(O, 6);
M = MACD();
S = Signal();
Buy = Cross(ShortEMA, LongEMA);
Sell = Cross(LongEMA, ShortEMA);
if (MACDswitch)
{
Buy = Cross(ShortEMA, LongEMA) AND M > S;
Sell = Cross(LongEMA, ShortEMA) AND M < S;
}
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
Marker = Buy * shapeUpArrow + Sell * shapeDownArrow;
MarkerColor = IIf(Buy, colorBrightGreen, colorRed);
MarkerDist = IIf(Buy, L, H);
//You can uncomment next two lines if you want to plot the EMAs also
//Plot(ShortEMA, "EMA5 Close", colorGreen);
//Plot(LongEMA, "EMA6 Open", colorRed);
PlotShapes(Marker, MarkerColor, 0, MarkerDist);