("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);
("Linear Regression Slope based System");
p1 = Param("Long Reg Period", 20, 3, 100, 1);
p2 = Param("Short Reg Period", 10, 3, 100, 1);
p3 = Param("MACD Fast Period", 12, 3, 50, 1);
p4 = Param("MACD Slow Period", 26, 3, 50, 1);
p5 = Param("MACD Signal Period", 9, 3, 50, 1);
MACDswitch = ParamToggle("Use MACD?", "NO | YES", 1);
LongSlope = LinRegSlope(C, p1);
ShortSlope = LinRegSlope(C, p2);
M = MACD(p3, p4);
S = Signal(p3, p4, p5);
Buy = Cross(ShortSlope, LongSlope);
Sell = Cross(LongSlope, ShortSlope);
if (MACDswitch)
{
Buy = Cross(ShortSlope, LongSlope) AND M > S;
Sell = Cross(LongSlope, ShortSlope) AND M < S;
}
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
Marker=Buy * shapeUpArrow + Sell * shapeDownArrow;
MarkerColor = IIf(Buy, colorSeaGreen, colorRed);
MarkerDist = IIf(Buy, L, H);
PlotShapes(Marker, MarkerColor, 0, MarkerDist);
//To Plot the slope lines uncomment the following two lines
//Plot(LongSlope, "Long Slope", colorRed,styleOwnScale);
//Plot(ShortSlope, "Short Slope", colorGreen, styleOwnScale);
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
My experiments with MFs | Mutual Funds Discussion Forum | 93 | ||
R | Experiments with Market Profile | Advanced Trading Strategies | 53 | |
G | Trading logs/experiments | Commodities | 8 | |
My Experiments with Charts | Members Discussion Forums | 1 | ||
Experiments with OBV | Advanced Trading Strategies | 199 |