Amibroker Afl Collection -
// ----------------------------------------------------------- // 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) styleArea
//---------------------------------------------------------- // 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); amibroker afl collection
// ----------------------------------------------------------- // USER INPUTS // ----------------------------------------------------------- TF1 = ParamTimeFrame("Higher Timeframe", "Weekly"); TF2 = ParamTimeFrame("Lower Timeframe", "Daily");
// 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); chartShowDates | chartWrapTitle
Short = SellSignal; // Example short logic Cover = BuySignal;
// ----------------------------------------------------------- // LOWER TIMEFRAME MOMENTUM (e.g., Daily) // ----------------------------------------------------------- LTF_MA = MA(C, PeriodMA); LTF_RSI = RSI(RSIPeriod); LTF_MomentumUp = C > LTF_MA AND LTF_RSI > 50; LTF_MomentumDown = C < LTF_MA AND LTF_RSI < 50; TF2 = ParamTimeFrame("Lower Timeframe"
// ----------------------------------------------------------- // HIGHER TIMEFRAME TREND (e.g., Weekly) // ----------------------------------------------------------- TimeFrameSet(TF1); HTF_Close = C; HTF_MA = MA(C, PeriodMA); HTF_RSI = RSI(RSIPeriod); HTF_TrendUp = HTF_Close > HTF_MA; HTF_TrendDown = HTF_Close < HTF_MA; TimeFrameRestore();