OPEN-SOURCE SCRIPT
Telah dikemas kini

MA RSI MACD Signal Suite

2 610
This Pine Script™ is designed for use in Trading View and generates trading signals based on moving average (MA) crossovers, RSI (Relative Strength Index) signals, and MACD (Moving Average Convergence Divergence) indicators. It provides visual markers on the chart and can be configured to suit various trading strategies.

1. Indicator Overview
The indicator includes signals for:

  • Moving Averages (MA): It tracks crossovers between different types of moving averages.
  • RSI: Signals based on RSI crossing certain levels or its signal line.
  • MACD: Buy and sell signals generated by MACD crossovers.


2. Inputs and Customization

Moving Averages (MAs):
  • You can customize up to 6 moving averages with different types, lengths, and colors.
  • MA Type: Choose from different types of moving averages:
  • SMA (Simple Moving Average)
  • EMA (Exponential Moving Average)
  • HMA (Hull Moving Average)
  • SMMA (RMA) (Smoothed Moving Average)
  • WMA (Weighted Moving Average)
  • VWMA (Volume Weighted Moving Average)
  • T3, DEMA, TEMA
  • Source: Select the price to base the MA on (e.g., close, open, high, low).
  • Length: Define the number of periods for each moving average.
    Examples:
  • MA1: Exponential Moving Average (EMA) with a period of 9
  • MA2: Exponential Moving Average (EMA) with a period of 21


  • RSI Settings:
    RSI is calculated based on a user-defined period and is used to identify potential overbought or oversold conditions.

  • RSI Length: Lookback period for RSI (default 14).
  • Overbought Level: Defines the overbought threshold for RSI (default 70).
  • Oversold Level: Defines the oversold threshold for RSI (default 30).
    You can also adjust the smoothing for the RSI signal line and customize when to trigger buy and sell signals based on the RSI crossing these levels.

    MACD Settings:
    MACD is used for identifying changes in momentum and trends.
  • Fast Length: The period for the fast moving average (default 12).
  • Slow Length: The period for the slow moving average (default 26).
  • Signal Length: The period for the signal line (default 9).
  • Smoothing Method: Choose between SMA or EMA for both the MACD and the signal line.


  • 3. Signal Logic
    Moving Average (MA) Crossover Signals:
  • Crossover: A bullish signal is generated when a fast MA crosses above a slow MA.
  • Crossunder: A bearish signal is generated when a fast MA crosses below a slow MA.

    The crossovers are plotted with distinct colors, and the chart will display markers for these crossover events.

    RSI Signals:
  • Oversold Crossover: A bullish signal when RSI crosses over its signal line below the oversold level (30).
  • Overbought Crossunder: A bearish signal when RSI crosses under its signal line above the overbought level (70).
    RSI signals are divided into:

  • Aggressive (Early) Entries: Signals when RSI is crossing the oversold/overbought levels.
  • Conservative Entries: Signals when RSI confirms a reversal after crossing these levels.

    MACD Signals:
  • Buy Signal: Generated when the MACD line crosses above the signal line (bullish crossover).
  • Sell Signal: Generated when the MACD line crosses below the signal line (bearish crossunder).

    Additionally, the MACD histogram is used to identify momentum shifts:

  • Rising to Falling Histogram: Alerts when the MACD histogram switches from rising to falling.
  • Falling to Rising Histogram: Alerts when the MACD histogram switches from falling to rising.

    4. Visuals and Alerts
    Plotting:
    The script plots the following on the price chart:

  • Moving Averages (MA): The selected MAs are plotted as lines.
  • Buy/Sell Shapes: Triangular markers are displayed for buy and sell signals generated by RSI and MACD.
  • Crossover and Crossunder Markers: Crosses are shown when two MAs crossover or crossunder.

    Alerts:
    Alerts can be configured based on the following conditions:

  • RSI Signals: Alerts for oversold or overbought crossover and crossunder events.
  • MACD Signals: Alerts for MACD line crossovers or momentum shifts in the MACD histogram.

    Alerts are triggered when specific conditions are met, such as:

  • RSI crosses over or under the oversold/overbought levels.
  • MACD crosses the signal line.
  • Changes in the MACD histogram.

    5. Example Usage

    1. Trend Reversal Setup:
  • Buy Signal: Use the RSI oversold crossover and MACD bullish crossover to identify potential entry points in a downtrend.
  • Sell Signal: Use the RSI overbought crossunder and MACD bearish crossunder to identify potential exit points or short entries in an uptrend.

    2. Momentum Strategy:
  • Combine MACD and RSI signals to identify the strength of a trend. Use MACD histogram analysis and RSI levels for confirmation.
    3. Moving Average Crossover Strategy:
  • Focus on specific MA crossovers, such as the 9-period EMA crossing above the 21-period EMA, for buy signals. When a longer-term MA (e.g., 50-period) crosses a shorter-term MA, it may indicate a strong trend change.

    6. Alerts Conditions
    The script includes several alert conditions, which can be triggered and customized based on the user’s preferences:

  • RSI Oversold Crossover: Alerts when RSI crosses over the signal line below the oversold level (30).
  • RSI Overbought Crossunder: Alerts when RSI crosses under the signal line above the overbought level (70).
  • MACD Buy/Sell Crossover: Alerts when the MACD line crosses the signal line for a buy or sell signal.

    7. Conclusion
    This script is highly customizable and can be adjusted to suit different trading strategies. By combining MAs, RSI, and MACD, traders can gain multiple perspectives on the market, enhancing their ability to identify potential buy and sell opportunities.

















Nota Keluaran
📘 MA RSI MACD Signal Suite
A powerful all-in-one trend and momentum indicator integrating Moving Averages, RSI signals, MACD crossovers, and VWAP levels — designed for traders who seek both precision and clarity.

🔍 Features at a Glance:
✅ Up to 6 customizable Moving Averages

📉 MACD crossovers with visual signals

🔁 RSI signals with oversold/overbought alerts

📏 Built-in MA crossover detection

🟠 Multi-timeframe VWAPs: Intraday, Daily, Weekly

📡 Configurable alerts and visual markers

⚙️ Highly customizable input settings

📐 Moving Average Suite
Supports 6 user-defined MAs:

MA types: SMA, EMA, HMA, SMMA (RMA), WMA, VWMA

Custom length, source, and color

Toggle crossover tracking between pairs:

MA 1 ↔ MA 2

MA 3 ↔ MA 4

MA 5 ↔ MA 6

Crossover Signals:

Bullish crossover = Colored circles on the chart

Bearish crossunder = Colored circles with optional price tracking

📊 MACD Settings
Custom MACD engine with optional SMA or EMA smoothing:

Fast EMA: 12

Slow EMA: 26

Signal Line: 9

MACD = Fast - Slow

Signal = EMA/SMA of MACD

Histogram = MACD - Signal

MACD Signals:

🟢 Bullish crossover (MACD > Signal) → Green Triangle

🔴 Bearish crossunder (MACD < Signal) → Red Triangle

💡 RSI Signal Engine
Momentum detection through:

RSI period (default: 14)

RSI Signal smoothing (default: 9)

Overbought = 70, Oversold = 30

RSI Crossover Logic:

RSI cross above signal line under 30 → Bullish

RSI cross below signal line above 70 → Bearish

Visual markers appear with optional alerts

📈 RSI/SMA Crossover Buy/Sell
A custom crossover system using:

RSI(34) vs SMA of RSI(68)

✅ Buy when RSI crosses above SMA

❌ Sell when RSI crosses below SMA

Arrows plotted on chart for clear entries

📎 Multi-Timeframe VWAPs
VWAP support for:

🕐 Intraday VWAP: resets each session

📅 Daily VWAP: resets daily

📆 Weekly VWAP: resets weekly (thicker line for clarity)

VWAP Color Defaults:

Intraday: White

Daily: Blue

Weekly: Orange (with label)

🔔 Alerts Included
Custom alerts for:

📉 MACD histogram state change

🔄 RSI oversold/overbought crossovers

✅ RSI re-entering neutral zone from extreme levels

🧠 Ideal Use Cases
Trend confirmation using MA structure

Momentum reversal detection with RSI

Entry/exit signals using MACD and RSI crossover zones

Fair value tracking via multi-timeframe VWAPs

📌 Notes
All plots shown on main price chart (overlay=true)

Lightweight and optimized for intraday and swing trading

All visuals are optional and user-toggleable

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.