OPEN-SOURCE SCRIPT

CCI Buy and Sell Signals with 20/30 EMA

CCI Buy and Sell Signals with EMA and ATR Stop Loss/Take Profit
This indicator is designed to identify buy and sell signals based on a combination of the Commodity Channel Index (CCI) and Exponential Moving Averages (EMA). It also includes an optional ATR-based stop loss and take profit system, which is useful for traders who want to manage their trades with dynamic risk levels.

Features:
CCI Buy and Sell Signals:

Buy Signal: A buy signal is triggered when the CCI crosses up through -100 (from an oversold condition), the 20-period EMA is above the 30-period EMA, and the price is above the 200-period EMA. This suggests that the market is entering an upward trend.
Sell Signal: A sell signal is triggered when the CCI crosses down through +100 (from an overbought condition), the 20-period EMA is below the 30-period EMA, and the price is below the 200-period EMA. This suggests that the market is entering a downward trend.
Exponential Moving Averages (EMA):

The script plots three EMAs:
20-period EMA (Green): Used to identify short-term trends.
30-period EMA (Red): Used to capture medium-term trends.
200-period EMA (Orange): A long-term trend filter, with the price above it generally indicating bullish conditions and below it indicating bearish conditions.
ATR-Based Stop Loss and Take Profit:

Optional Feature: The ATR (Average True Range) indicator can be used to set stop loss and take profit levels based on market volatility.
Stop Loss: Set at a multiple of the ATR below the entry price for long positions and above the entry price for short positions.
Take Profit: Set at a multiple of the ATR above the entry price for long positions and below the entry price for short positions.
Customizable: You can adjust the ATR length, Stop Loss Multiplier, and Take Profit Multiplier through the settings.
Dots: The stop loss and take profit levels are plotted as dots on the chart when the ATR feature is enabled.
Alert Conditions:

Buy Signal Alert: Triggered when a buy signal occurs based on CCI crossing up -100 and other conditions being met.
Sell Signal Alert: Triggered when a sell signal occurs based on CCI crossing down +100 and other conditions being met.
Any Signal Alert: This is a combined alert that triggers for either a buy or sell signal. It helps you stay updated on both types of signals simultaneously.
How to Use:
The indicator will plot buy and sell arrows on the chart, giving clear entry points for trades based on CCI and EMA conditions.
The ATR stop loss and take profit dots (when enabled) provide automatic risk management levels, adjusting dynamically with market volatility.
Traders can customize the ATR settings to fine-tune their stop loss and take profit levels, making this strategy adaptable to different trading styles and market conditions.

כתב ויתור