Amibroker | Afl Collection
//---------------------------------------------------------- // Multi-Timeframe Trend & Momentum Scanner // For Amibroker AFL Collection //---------------------------------------------------------- SetChartOptions(0, chartShowDates | chartWrapTitle, 0, 0); SetChartBkColor(ColorRGB(10,10,20)); SetChartBkGradientFill( ColorRGB(5,5,15), ColorRGB(20,20,40)); SetTradeDelays(1,1,1,1);
// ----------------------------------------------------------- // COMMENT BLOCK (for documentation) /* == MULTI-TIMEFRAME TREND & MOMENTUM SCANNER ==
// Optional: Exit signals Buy = ExRem(BuySignal, SellSignal); Sell = ExRem(SellSignal, BuySignal);
You can save it as MTF_Trend_Momentum.afl . amibroker afl collection
// ----------------------------------------------------------- // SCAN / EXPLORATION OUTPUT (for AA Window) // ----------------------------------------------------------- Filter = Buy OR Sell; AddColumn(C, "Close", 1.2); AddColumn(LTF_RSI, "RSI", 1.2); AddColumn(HTF_RSI_Exp, "HTF RSI", 1.2); AddColumn(IIf(Buy, "BUY", IIf(Sell, "SELL", "")), "Signal", 1.0);
// RSI in separate window rsiColor = IIf(LTF_RSI > RSIOverbought, colorRed, IIf(LTF_RSI < RSIOversold, colorGreen, colorLightGrey)); Plot(LTF_RSI, "RSI (" + RSIPeriod + ")", rsiColor, styleLine | styleThick); Plot(RSIOverbought, "OB", colorRed, styleDashed); Plot(RSIOversold, "OS", colorGreen, styleDashed);
// Lower Timeframe MA Plot(LTF_MA, "LTF MA", colorYellow, styleLine | styleDots); chartShowDates | chartWrapTitle
Short = SellSignal; // Example short logic Cover = BuySignal;
// ----------------------------------------------------------- // 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;
// Trend Zone Background if(ShowZones)
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);
// ----------------------------------------------------------- // USER INPUTS // ----------------------------------------------------------- TF1 = ParamTimeFrame("Higher Timeframe", "Weekly"); TF2 = ParamTimeFrame("Lower Timeframe", "Daily");