OPEN-SOURCE SCRIPT

Comprehensive Trend & Signal Strategy

119
Script Summary: "Configurable Trend & Signal System (CTSS)"

This TradingView script is a comprehensive technical analysis tool designed to generate trading signals (Long or Short) based on a configurable combination of several popular indicators. It aims to provide a flexible system where users can tailor the signal sensitivity and criteria to their specific trading style and market conditions.

Core Functionality:

Multi-Filter Signal Generation: The script generates buy (Long) or sell (Short) signals when conditions from several user-selected technical filters align.
Configurable Filters: It includes the following filters, each of which can be enabled or disabled and customized:
Main Trend Filter: Uses two Exponential Moving Averages (EMAs). A long signal requires the faster EMA to be above the slower EMA, and vice-versa for a short signal.
MACD Filter: Utilizes the Moving Average Convergence Divergence. Users can choose between a standard MACD or one derived from custom EMA lengths. A long signal requires the MACD line to be above its signal line, and vice-versa for a short.
RSI Filter: Employs the Relative Strength Index. For a long signal, it typically looks for the RSI to be below an oversold level (or simply not overbought, depending on configuration). For a short signal, it looks for the RSI to be above an overbought level (or not oversold).
Volume Filter: Analyzes trading volume. It can identify volume spikes (volume significantly above its moving average) which can be used to confirm the strength of a potential signal.
Sensitivity Presets: Offers global "Sensitivity Presets" (e.g., Conservative, Moderate, Aggressive) that automatically adjust the parameters of all underlying filters to predefined settings, simplifying initial setup. Users can then fine-tune from these presets.
Stop Loss (SL) and Take Profit (TP) Management:
Once a signal is generated, the script calculates and can display SL and TP levels.
These levels can be based on the Average True Range (ATR) multiplied by a user-defined factor, or a fixed number of pips/points.
It visually tracks these levels on the chart.
Visualizations:
Plots the selected indicators (EMAs, MACD lines, RSI, Volume MA) on the chart.
Displays signal markers ("L" for Long, "S" for Short) directly on the price bars where signals occur.
Draws horizontal lines for the current Stop Loss and Take Profit levels if a trade signal is active.
Includes an optional on-chart Information Table summarizing the status of all enabled filters, the current signal state (Long/Short/None), and active SL/TP levels.
Alerts: The script can generate alerts for:
New Long signals.
New Short signals.
When a Take Profit level is hit for a long or short trade.
When a Stop Loss level is hit for a long or short trade.
How Signals Are Generated:

A Long signal is generated only if all enabled filters simultaneously indicate bullish conditions. For example, if the Main Trend, MACD, and RSI filters are active, a Long signal would require:

Fast EMA > Slow EMA (Main Trend)
MACD Line > MACD Signal Line (MACD)
RSI is in a bullish state (e.g., coming out of oversold, or simply not overbought).
Similarly, a Short signal requires all enabled filters to indicate bearish conditions. The script manages one "trade" at a time; a new signal in the opposite direction will reverse the current position.

Instructions for Using the "Configurable Trend & Signal System (CTSS)" Script

Adding to Chart:

Open TradingView.
Open the Pine Editor (usually at the bottom of the chart).
Paste the entire script code into the editor.
Click "Add to Chart."
Accessing Settings:

Once the script is on your chart, hover over its name in the top-left corner of the chart (or in the legend if it's an overlay).
Click the "Settings" (gear) icon. This will open the script's configuration panel.
Configuring the Script (Inputs Tab):

Global Settings & Presets:

Sensitivity Preset: Start here. Choose "Conservative," "Moderate," or "Aggressive." This will automatically set many of the parameters below. You can then fine-tune them. "Custom" means your individual settings will be used.
Main Trend Filter:

Use Main Trend Filter?: Check to enable this filter.
Fast MA Length, Slow MA Length: Set the periods for the two EMAs.
Show Main Trend MAs?: Toggle visibility of these EMAs on the chart.
Customize colors, width, and style for the plotted MAs.
MACD Filter:

Use MACD Filter?: Check to enable.
MACD Source Type:
Default: Uses standard MACD (12, 26, 9 periods typically). You can adjust Fast Length, Slow Length, Signal Smoothing.
Custom EMA Source: Derives MACD from two custom EMAs. Set Source Fast EMA Length, Source Slow EMA Length, and Signal Smoothing for Custom.
Show MACD Plot?: Toggle visibility of MACD and signal lines.
Customize colors and width.
RSI Filter:

Use RSI Filter?: Check to enable.
RSI Length: Set the period for RSI calculation.
RSI Overbought, RSI Oversold: Define the levels for overbought/oversold conditions.
Show RSI Plot?: Toggle visibility of the RSI line and OB/OS levels.
Customize colors and width.
Volume Filter:

Use Volume Filter?: Check to enable.
Volume MA Lookback: Period for the moving average of volume.
Volume Spike Multiplier: How many times the current volume must be above its MA to be considered a spike.
Show Volume MA?: Toggle visibility of the volume MA.
Customize color for the volume MA and volume bars indicating a spike.
Stop Loss & Take Profit Settings:

Use ATR for SL/TP?:
If checked: Uses ATR. Set ATR Length, SL ATR Multiplier, TP ATR Multiplier.
If unchecked: Uses fixed pips. Set Fixed SL Pips, Fixed TP Pips. (Note: "Pips" here means minimum price increments of the instrument).
Show SL/TP Lines on Chart?: Toggle visibility of the SL/TP lines when a signal is active.
Customize colors, width, and style for SL and TP lines.
Visuals & Alerts Group:

Show Signal Markers?: Toggle "L" and "S" markers on the chart.
Long/Short Signal Marker Color: Choose colors for these markers.
Show Information Table?: Toggle the on-chart summary table.
Table Position: Choose where the table appears (e.g., Top Right).
Table Text/Background Color: Customize table appearance.
Understanding the Chart Display:

Indicator Plots: You'll see the EMAs, MACD lines, RSI, and Volume MA plotted if you've enabled them.
Signal Markers: An "L" will appear below a bar for a long signal, and an "S" above a bar for a short signal.
SL/TP Lines: If a signal is active and SL/TP lines are enabled, you'll see horizontal lines at the calculated Stop Loss and Take Profit prices. These lines will extend with new bars until the trade is closed by an SL/TP hit or a reverse signal.
Information Table: If enabled, this table provides a real-time summary of:
The script's preset status.
The status of each enabled filter (e.g., Main Trend: Bullish, MACD: Bearish).
The current overall signal (Long, Short, or None).
If a signal is active: Entry Price, Stop Loss Price, Take Profit Price.
SL/TP Hit Labels: When a Stop Loss or Take Profit is hit, a small label ("SL Hit" or "TP Hit") will appear on the chart at that price level.
Setting Up Alerts (TradingView Feature):

Click the "Alert" button (clock icon) on the TradingView top toolbar or right-click on the chart and select "Add alert."
In the "Condition" dropdown, select the name of this script (e.g., "CTSS").
A second dropdown will appear, allowing you to choose the specific alert condition:
"CTSS: New Long Signal..."
"CTSS: New Short Signal..."
"CTSS: Long Take Profit Hit..."
"CTSS: Long Stop Loss Hit..."
"CTSS: Short Take Profit Hit..."
"CTSS: Short Stop Loss Hit..."
Choose your desired options (e.g., "Once Per Bar Close" is common for signal alerts).
Configure notification preferences (popup, email, etc.).
Click "Create."
General Advice for Use:

Backtesting & Forward Testing: Thoroughly test any configuration on historical data and then in a simulated (paper trading) environment before risking real capital.
Understand the Indicators: Familiarize yourself with how EMAs, MACD, RSI, and Volume analysis work independently to better understand their combined effect.
Start with Presets: Use the sensitivity presets as a starting point and then adjust individual parameters to suit the specific asset and timeframe you are trading.
Risk Management: This script provides SL/TP suggestions, but always apply your own comprehensive risk management strategy. The script itself is a tool, not a complete trading plan.
Not Financial Advice: This script is for educational and informational purposes. It does not constitute financial advice.
By following these instructions, you can effectively configure and utilize the "Configurable Trend & Signal System" to aid your trading analysis.

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.