Ensemble Alerts█ OVERVIEW
This indicator creates highly customizable alert conditions and messages by combining several technical conditions into groups , which users can specify directly from the "Settings/Inputs" tab. It offers a flexible framework for building and testing complex alert conditions without requiring code modifications for each adjustment.
█ CONCEPTS
Ensemble analysis
Ensemble analysis is a form of data analysis that combines several "weaker" models to produce a potentially more robust model. In a trading context, one of the most prevalent forms of ensemble analysis is the aggregation (grouping) of several indicators to derive market insights and reinforce trading decisions. With this analysis, traders typically inspect multiple indicators, signaling trade actions when specific conditions or groups of conditions align.
Simplifying ensemble creation
Combining indicators into one or more ensembles can be challenging, especially for users without programming knowledge. It usually involves writing custom scripts to aggregate the indicators and trigger trading alerts based on the confluence of specific conditions. Making such scripts customizable via inputs poses an additional challenge, as it often involves complicated input menus and conditional logic.
This indicator addresses these challenges by providing a simple, flexible input menu where users can easily define alert criteria by listing groups of conditions from various technical indicators in simple text boxes . With this script, you can create complex alert conditions intuitively from the "Settings/Inputs" tab without ever writing or modifying a single line of code. This framework makes advanced alert setups more accessible to non-coders. Additionally, it can help Pine programmers save time and effort when testing various condition combinations.
█ FEATURES
Configurable alert direction
The "Direction" dropdown at the top of the "Settings/Inputs" tab specifies the allowed direction for the alert conditions. There are four possible options:
• Up only : The indicator only evaluates upward conditions.
• Down only : The indicator only evaluates downward conditions.
• Up and down (default): The indicator evaluates upward and downward conditions, creating alert triggers for both.
• Alternating : The indicator prevents alert triggers for consecutive conditions in the same direction. An upward condition must be the first occurrence after a downward condition to trigger an alert, and vice versa for downward conditions.
Flexible condition groups
This script features six text inputs where users can define distinct condition groups (ensembles) for their alerts. An alert trigger occurs if all the conditions in at least one group occur.
Each input accepts a comma-separated list of numbers with optional spaces (e.g., "1, 4, 8"). Each listed number, from 1 to 35, corresponds to a specific individual condition. Below are the conditions that the numbers represent:
1 — RSI above/below threshold
2 — RSI below/above threshold
3 — Stoch above/below threshold
4 — Stoch below/above threshold
5 — Stoch K over/under D
6 — Stoch K under/over D
7 — AO above/below threshold
8 — AO below/above threshold
9 — AO rising/falling
10 — AO falling/rising
11 — Supertrend up/down
12 — Supertrend down/up
13 — Close above/below MA
14 — Close below/above MA
15 — Close above/below open
16 — Close below/above open
17 — Close increase/decrease
18 — Close decrease/increase
19 — Close near Donchian top/bottom (Close > (Mid + HH) / 2)
20 — Close near Donchian bottom/top (Close < (Mid + LL) / 2)
21 — New Donchian high/low
22 — New Donchian low/high
23 — Rising volume
24 — Falling volume
25 — Volume above average (Volume > SMA(Volume, 20))
26 — Volume below average (Volume < SMA(Volume, 20))
27 — High body to range ratio (Abs(Close - Open) / (High - Low) > 0.5)
28 — Low body to range ratio (Abs(Close - Open) / (High - Low) < 0.5)
29 — High relative volatility (ATR(7) > ATR(40))
30 — Low relative volatility (ATR(7) < ATR(40))
31 — External condition 1
32 — External condition 2
33 — External condition 3
34 — External condition 4
35 — External condition 5
These constituent conditions fall into three distinct categories:
• Directional pairs : The numbers 1-22 correspond to pairs of opposing upward and downward conditions. For example, if one of the inputs includes "1" in the comma-separated list, that group uses the "RSI above/below threshold" condition pair. In this case, the RSI must be above a high threshold for the group to trigger an upward alert, and the RSI must be below a defined low threshold to trigger a downward alert.
• Non-directional filters : The numbers 23-30 correspond to conditions that do not represent directional information. These conditions act as filters for both upward and downward alerts. Traders often use non-directional conditions to refine trending or mean reversion signals. For instance, if one of the input lists includes "30", that group uses the "Low relative volatility" condition. The group can trigger an upward or downward alert only if the 7-period Average True Range (ATR) is below the 40-period ATR.
• External conditions : The numbers 31-35 correspond to external conditions based on the plots from other indicators on the chart. To set these conditions, use the source inputs in the "External conditions" section near the bottom of the "Settings/Inputs" tab. The external value can represent an upward, downward, or non-directional condition based on the following logic:
▫ Any value above 0 represents an upward condition.
▫ Any value below 0 represents a downward condition.
▫ If the checkbox next to the source input is selected, the condition becomes non-directional . Any group that uses the condition can trigger upward or downward alerts only if the source value is not 0.
To learn more about using plotted values from other indicators, see this article in our Help Center and the Source input section of our Pine Script™ User Manual.
Group markers
Each comma-separated list represents a distinct group , where all the listed conditions must occur to trigger an alert. This script assigns preset markers (names) to each condition group to make the active ensembles easily identifiable in the generated alert messages and labels. The markers assigned to each group use the format "M", where "M" is short for "Marker" and "x" is the group number. The titles of the inputs at the top of the "Settings/Inputs" tab show these markers for convenience.
For upward conditions, the labels and alert messages show group markers with upward triangles (e.g., "M1▲"). For downward conditions, they show markers with downward triangles (e.g., "M1▼").
NOTE: By default, this script populates the "M1" field with a pre-configured list for a mean reversion group ("2,18,24,28"). The other fields are empty. If any "M*" input does not contain a value, the indicator ignores it in the alert calculations.
Custom alert messages
By default, the indicator's alert message text contains the activated markers and their direction as a comma-separated list. Users can override this message for upward or downward alerts with the two text fields at the bottom of the "Settings/Inputs" tab. When the fields are not empty , the alerts use that text instead of the default marker list.
NOTE: This script generates alert triggers, not the alerts themselves. To set up an alert based on this script's conditions, open the "Create Alert" dialog box, then select the "Ensemble Alerts" and "Any alert() function call" options in the "Condition" tabs. See the Alerts FAQ in our Pine Script™ User Manual for more information.
Condition visualization
This script offers organized visualizations of its conditions, allowing users to inspect the behaviors of each condition alongside the specified groups. The key visual features include:
1) Conditional plots
• The indicator plots the history of each individual condition, excluding the external conditions, as circles at different levels. Opposite conditions appear at positive and negative levels with the same absolute value. The plots for each condition show values only on the bars where they occur.
• Each condition's plot is color-coded based on its type. Aqua and orange plots represent opposing directional conditions, and purple plots represent non-directional conditions. The titles of the plots also contain the condition numbers to which they apply.
• The plots in the separate pane can be turned on or off with the "Show plots in pane" checkbox near the top of the "Settings/Inputs" tab. This input only toggles the color-coded circles, which reduces the graphical load. If you deactivate these visuals, you can still inspect each condition from the script's status line and the Data Window.
• As a bonus, the indicator includes "Up alert" and "Down alert" plots in the Data Window, representing the combined upward and downward ensemble alert conditions. These plots are also usable in additional indicator-on-indicator calculations.
2) Dynamic labels
• The indicator draws a label on the main chart pane displaying the activated group markers (e.g., "M1▲") each time an alert condition occurs.
• The labels for upward alerts appear below chart bars. The labels for downward alerts appear above the bars.
NOTE: This indicator can display up to 500 labels because that is the maximum allowed for a single Pine script.
3) Background highlighting
• The indicator can highlight the main chart's background on bars where upward or downward condition groups activate. Use the "Highlight background" inputs in the "Settings/Inputs" tab to enable these highlights and customize their colors.
• Unlike the dynamic labels, these background highlights are available for all chart bars, irrespective of the number of condition occurrences.
█ NOTES
• This script uses Pine Script™ v6, the latest version of TradingView's programming language. See the Release notes and Migration guide to learn what's new in v6 and how to convert your scripts to this version.
• This script imports our new Alerts library, which features functions that provide high-level simplicity for working with complex compound conditions and alerts. We used the library's `compoundAlertMessage()` function in this indicator. It evaluates items from "bool" arrays in groups specified by an array of strings containing comma-separated index lists , returning a tuple of "string" values containing the marker of each activated group.
• The script imports the latest version of the ta library to calculate several technical indicators not included in the built-in `ta.*` namespace, including Double Exponential Moving Average (DEMA), Triple Exponential Moving Average (TEMA), Fractal Adaptive Moving Average (FRAMA), Tilson T3, Awesome Oscillator (AO), Full Stochastic (%K and %D), SuperTrend, and Donchian Channels.
• The script uses the `force_overlay` parameter in the label.new() and bgcolor() calls to display the drawings and background colors in the main chart pane.
• The plots and hlines use the available `display.*` constants to determine whether the visuals appear in the separate pane.
Look first. Then leap.
Strategydevelopment
Parabolic SAR Waves [MMA]Parabolic SAR Waves
Description:
The "Parabolic SAR Waves " is an advanced version of the traditional Parabolic SAR indicator, customized for TradingView. This script incorporates dynamic acceleration factors and optional gradient coloration to enhance visual interpretation and utility for traders aiming to accurately capture trends and predict potential reversals.
Features:
- Dynamic Acceleration: Adjust the initial, incremental, and maximum values of the acceleration factor to suit various market conditions and trading preferences.
- Gradient Coloring: Use gradient colors to indicate the strength and stability of the trend, providing visual cues that are easy to interpret.
- Trend Visibility: The SAR dots are plotted directly on the price chart, making it easy to spot trend changes and maintain situational awareness.
- Overlay Feature: Designed to overlay directly on the price charts, allowing for seamless integration with other technical analysis tools.
Benefits:
- Trend Detection: Helps in identifying the beginning and potential reversal of trends, aiding in timely decision-making.
- Stop-Loss Management: Utilizes the positions of the SAR dots as dynamic stop-loss points, which helps in risk management.
- Visual Simplicity: Enhances the decision-making process through a straightforward visual representation of trend data.
Parameters:
- Acceleration Start (accel_start): The initial value for the acceleration, set to 0.02 by default.
- Acceleration Increment (accel_inc): The amount by which the acceleration increases, set to 0.005 by default.
- Acceleration Maximum (accel_max): The maximum limit of the acceleration factor, set to 0.1 by default.
- Use Gradient Colors (use_gradient): A boolean toggle to enable or disable gradient coloring, enabled by default.
Indicator Usage:
1. To apply, select this indicator from TradingView's indicator library.
2. Adjust the acceleration parameters based on your specific trading strategy and market analysis.
3. Interpret the indicator signals:
- Green SAR dots below the price bars indicate a bullish trend.
- Red SAR dots above the price bars signify a bearish trend.
- Gradient colors, if enabled, provide insights into the acceleration factor's intensity relative to trend strength.
Alerts:
- Bullish Reversal Alert: Issues a notification if there is a potential upward reversal when the trend shifts to bullish.
- Bearish Reversal Alert: Alerts when there's potential for a downward move as the trend turns bearish.
The "Parabolic SAR Waves " is a robust tool, ideal for traders who need precise, customizable trend-following capabilities that integrate seamlessly with other market analysis strategies. Enhance your trading with detailed trend insights and adaptive parameter controls.