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);

// Signals if(ShowSignals)

// Lower Timeframe MA Plot(LTF_MA, "LTF MA", colorYellow, styleLine | styleDots); amibroker afl collection

// Trend Zone Background if(ShowZones) styleArea

// 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); styleLine | styleDots)

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);

// Optional: Exit signals Buy = ExRem(BuySignal, SellSignal); Sell = ExRem(SellSignal, BuySignal); HTF_TrendUp_Exp = TimeFrameExpand(HTF_TrendUp

PeriodMA = Param("MA Period", 20, 5, 200, 1); RSIPeriod = Param("RSI Period", 14, 5, 50, 1); RSIOverbought = Param("RSI Overbought", 70, 50, 90, 1); RSIOversold = Param("RSI Oversold", 30, 10, 50, 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;

// Higher Timeframe MA Plot(HTF_MA_Exp, "HTF MA (" + Name() + ")", colorOrange, styleLine | styleThick);