// Lower Timeframe MA Plot(LTF_MA, "LTF MA", colorYellow, styleLine | styleDots);
// Trend Zone Background if(ShowZones) styleNoLabel, 0, 1);
// ----------------------------------------------------------- // SIGNAL GENERATION (Confluence) // ----------------------------------------------------------- // Buy: HTF trend up + LTF momentum up + RSI not overbought BuySignal = HTF_TrendUp_Exp AND LTF_MomentumUp AND LTF_RSI < RSIOverbought; // Sell: HTF trend down + LTF momentum down + RSI not oversold SellSignal = HTF_TrendDown_Exp AND LTF_MomentumDown AND LTF_RSI > RSIOversold; amibroker afl collection
// Signals if(ShowSignals)
// ----------------------------------------------------------- // USER INPUTS // ----------------------------------------------------------- TF1 = ParamTimeFrame("Higher Timeframe", "Weekly"); TF2 = ParamTimeFrame("Lower Timeframe", "Daily"); // Lower Timeframe MA Plot(LTF_MA, "LTF MA", colorYellow,
You can save it as MTF_Trend_Momentum.afl .
// Expand HTF values to current timeframe HTF_MA_Exp = TimeFrameExpand(HTF_MA, TF1, expandFirst); HTF_TrendUp_Exp = TimeFrameExpand(HTF_TrendUp, TF1, expandFirst); HTF_TrendDown_Exp = TimeFrameExpand(HTF_TrendDown, TF1, expandFirst); HTF_RSI_Exp = TimeFrameExpand(HTF_RSI, TF1, expandFirst); // Lower Timeframe MA Plot(LTF_MA
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone), colorBrightGreen, 0, Low, -15); PlotShapes(IIf(Sell, shapeDownArrow, shapeNone), colorRed, 0, High, -15); PlotShapes(IIf(Short, shapeHollowDownArrow, shapeNone), colorOrange, 0, High, -25); PlotShapes(IIf(Cover, shapeHollowUpArrow, shapeNone), colorLime, 0, Low, -25);
// Higher Timeframe MA Plot(HTF_MA_Exp, "HTF MA (" + Name() + ")", colorOrange, styleLine | styleThick);