This indicator is designed to provide buy (long) and sell (short) signals based on a combination of moving average (MA) crossovers, the Relative Strength Index (RSI), and a custom moving average filter. It allows traders to identify potential entry and exit points based on price trends and momentum.
Key Components
1. Moving Averages (MAs):
Short EMA (Exponential Moving Average): Default length of 9.
Long EMA: Default length of 21.
These are used to detect trend crossovers, where the short EMA crossing above the long EMA indicates a potential bullish trend, and vice versa for bearish trends.
2. Custom Moving Average (Custom MA):
Configurable to be one of the following: SMA (Simple Moving Average), EMA, WMA (Weighted Moving Average), or VWMA (Volume Weighted Moving Average).
Default length is 200, commonly used as a long-term trend indicator.
Color-coded dynamically:
Green: Price is above the Custom MA.
Red: Price is below the Custom MA.
3. Relative Strength Index (RSI):
Default length of 14.
Customizable Overbought Level (default: 60) and Oversold Level (default: 40).
Provides a momentum filter to ensure trades are taken when the market exhibits strong trends in a favorable direction.
Signal Logic
Buy Signal (Long Entry - XL):
The Short EMA crosses above the Long EMA (bullish crossover).
RSI value is above the oversold level (indicating momentum is not excessively weak).
The price is above the Custom MA, confirming alignment with the prevailing trend.
Sell Signal (Short Entry - XS):
The Short EMA crosses below the Long EMA (bearish crossover).
RSI value is below the overbought level (indicating momentum is not excessively strong).
The price is below the Custom MA, confirming alignment with the prevailing trend.
Pending Signals
Pending signals account for situations where the crossover and RSI conditions are met, but the price has not yet crossed the Custom MA. These are tracked to activate only when the price moves in alignment with the Custom MA:
Pending Buy: Triggered when:
Short EMA crosses above Long EMA.
RSI > Oversold Level.
Price is below the Custom MA.
Activates when the price crosses above the Custom MA.
Pending Sell: Triggered when:
Short EMA crosses below Long EMA.
RSI < Overbought Level.
Price is above the Custom MA.
Activates when the price crosses below the Custom MA.
Visual Elements
EMA Lines:
Blue Line: Short EMA.
Red Line: Long EMA.
Custom MA:
Green: Indicates price is above the Custom MA.
Red: Indicates price is below the Custom MA.
Signal Arrows:
Green UP Arrow (XL): Buy signal.
Red DOWN Arrow (XS): Sell signal.
Alerts
Configurable alerts notify the user when:
Buy Signal: "Price crossed above the short EMA and RSI is oversold."
Sell Signal: "Price crossed below the short EMA and RSI is overbought."
Strategy Overview
This strategy combines trend-following (EMA crossovers) and momentum confirmation (RSI) with a Custom MA filter to ensure trades align with broader market trends. The Custom MA acts as a safety check, preventing trades against the prevailing trend.
Disclaimer
This script is for educational purposes only. Trading involves significant financial risk, and past performance is not indicative of future results. Use this script at your own discretion, and always back test before deploying it in live markets. The author is not responsible for any financial losses incurred while using this script.
This indicator is suitable for traders who prefer to combine trend-based strategies with momentum confirmation to filter out false signals and increase trade reliability.