The Ultra Trend is an indicator designed to identify and follow the prevailing market trend, helping traders to leverage trends in a clear and efficient way. This indicator combines various advanced calculations, such as smoothing filters and directional price analysis, enabling it to detect trend shifts in market movements with high sensitivity and precision.
Useful for both upward and downward trends, the Ultra Trend is designed to provide visual signals that make it easier to identify potential entry or exit points. Thanks to its design, it is helpful for short-term traders looking to capture early trend shifts and for mid- to long-term traders seeking to confirm the market’s direction.
The Ultra Trend is a technical indicator that captures trend direction through a detailed analysis of recent prices. Unlike more basic indicators, the Ultra Trend uses advanced calculations, applying smoothing filters and price-tracking methods designed to respond to market changes without generating excessive false signals.
This indicator adapts to multiple trading styles, especially useful in markets with clear direction or well-defined trends. Its main advantage is the ability to smooth price movements and filter out market noise, making it easier for traders to identify when a trend begins or ends.
Compared to traditional indicators like moving averages or MACD, the Ultra Trend offers more adaptability and accuracy in trend changes, thanks to its adjustable parameters, allowing traders to fine-tune the analysis according to the specific market or asset.
The Ultra Trend features several customizable parameters, allowing traders to tailor the indicator to various strategies and market conditions. These parameters directly influence the sensitivity and accuracy of the generated signals, offering the flexibility needed to suit different trading styles. Below are the main parameters:
Each of these parameters can be adjusted to fit specific objectives. For example, traders looking to capture short-term trends may opt for lower values in utrPeriod and smooth, while those preferring to follow broader trends might raise these values.
The Ultra Trend employs advanced calculations to identify the market trend accurately, using a set of filters and internal adjustments to smooth out minor fluctuations and focus on the main trend direction. Here are the key elements of its functionality:
smooth and smoothPhase parameters to filter out minor fluctuations that could trigger false signals.valueUp and valueDn: As calculations progress for each bar, the Ultra Trend accumulates values in valueUp and valueDn, determining trend direction. If valueUp is greater than valueDn, the indicator signals an uptrend, and if valueDn exceeds valueUp, a downtrend is detected.utrPeriod and progression) to analyze prices and calculate the trend. Within this loop, multiple smoothing and filtering calculations determine the final values used for signal generation, ensuring signals reflect the ongoing trend rather than short-lived price movements.valp (positive trend) is greater than valm (negative trend). Based on this result, a signal is generated indicating whether the market is in an uptrend or downtrend. These signals are displayed on the chart via two lines, Ultra trend + and Ultra trend -, clearly showing trend direction.This design makes the Ultra Trend highly adaptable to different markets and trading styles. The combination of smoothing and advanced filtering helps avoid erratic signals caused by short-term volatility, providing a precise interpretation of the trend direction.
The Ultra Trend provides visual signals through two lines on the chart: Ultra trend +, indicating an uptrend, and Ultra trend -, indicating a downtrend. Interpreting these signals allows traders to identify entry and exit points based on the prevailing market direction.
Ultra trend +): When valp exceeds valm, the indicator shows the Ultra trend + line on the chart, typically in green. This indicates that the market may be in an uptrend, suggesting favorable buy opportunities. Traders often open or maintain long positions in this context.Ultra trend -): When valm is greater than valp, the indicator activates the Ultra trend - line, usually in orange. This signal points to a downtrend, and is interpreted as a cue for potential sell opportunities or for reducing long positions. For short traders, this signal may suggest initiating short positions.Ultra trend + line crosses above the Ultra trend - line, this suggests a trend shift to the upside and is often considered a buy signal.Ultra trend + stays above Ultra trend - or vice versa), this can be seen as a confirmation of the current trend direction, favoring trend continuation.The Ultra Trend signals allow traders to act confidently at key moments, capitalizing on trend direction changes and avoiding exposure during high-volatility, noisy market phases.
The Ultra Trend is an effective and versatile indicator that provides a clear view of the prevailing market direction, helping traders identify trend changes accurately. Its design, based on advanced smoothing and the Jurik method, enables the user to filter out market noise and focus on meaningful movements.
smooth) and base period (utrPeriod) parameters. Highly volatile assets, such as cryptocurrencies or tech stocks, may require higher smoothing to avoid erratic signals.//-------------------------------------------------------------//
//PRC Ultra trend
//version = 0
//23.05.2024
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//-------------------------------------------------------------//
defparam calculateonlastbars = 500 // Limits calculations to the last 500 bars
//-------------------------------------------------------------//
// Input Parameters
//-------------------------------------------------------------//
utrPeriod = 3 // Base period for trend calculation
progression = 5 // Progression factor for trend length
instances = 30 // Number of instances used in calculations
smooth = 5 // Smoothing factor for trend signal
smoothPhase = 100 // Phase adjustment for smoothing
pow1 = 6 // Power applied to the filter's beta value
//-------------------------------------------------------------//
// Main Calculation
//-------------------------------------------------------------//
if barindex > utrPeriod + progression * instances then
// Initialize variables
valp = 0 // Stores positive trend value
valpc = 0 // Coded positive trend signal
valm = 0 // Stores negative trend value
valmc = 0 // Coded negative trend signal
valueUp = 0 // Counts occurrences of uptrend
valueDn = 0 // Counts occurrences of downtrend
// Loop through 'k' values from utrPeriod up to the specified progression and instances
FOR k = utrPeriod TO (utrPeriod + progression * instances) DO
// Calculate Jurik smoothing for the previous close
src1 = close[1]
period1 = max(k, 1)
beta1 = 0.45 * (period1 - 1) / (0.45 * (period1 - 1) + 2)
alpha1 = pow(beta1, pow1)
corr1 = max(min(smoothPhase, 100), -100) / 100 + 1.5
filt01 = (1 - alpha1) * src1 + alpha1 * filt01[1]
det01 = (src1 - filt01[0]) * (1 - beta1) + beta1 * det01[1]
filt11 = filt01[0] + corr1 * det01[0]
det11 = (filt11[0] - jurik1[1]) * ((1 - alpha1) * (1 - alpha1)) + (alpha1 * alpha1) * det11[1]
jurik1 = jurik1[1] + det11[0]
// Calculate Jurik smoothing for the current close
src2 = close[0]
period2 = max(k, 1)
beta2 = 0.45 * (period2 - 1) / (0.45 * (period2 - 1) + 2)
alpha2 = pow(beta2, pow1)
corr2 = max(min(smoothPhase, 100), -100) / 100.0 + 1.5
filt02 = (1 - alpha2) * src2 + alpha2 * filt02[1]
det02 = (src2 - filt02) * (1 - beta2) + beta2 * det02[1]
filt12 = filt02 + corr2 * det02
det12 = (filt12 - jurik2[1]) * ((1 - alpha2) * (1 - alpha2)) + (alpha2 * alpha2) * det12[1]
jurik2 = jurik2[1] + det12
// Compare smoothed values to determine trend direction
IF jurik1 < jurik2 THEN
valueUp = valueUp + 1 // Increment uptrend count
ELSE
valueDn = valueDn + 1 // Increment downtrend count
ENDIF
NEXT
// Smoothing applied to the uptrend and downtrend values
// Final values for visual display
src3 = valueUp
period3 = MAX(smooth, 1)
beta3 = 0.45 * (period3 - 1) / (0.45 * (period3 - 1) + 2)
alpha3 = POW(beta3, pow1)
corr3 = MAX(MIN(smoothPhase, 100), -100) / 100.0 + 1.5
filt03 = (1 - alpha3) * src3 + alpha3 * filt03[1]
det03 = (src3 - filt03[0]) * (1 - beta3) + beta3 * det03[1]
filt13 = filt03[0] + corr3 * det03[0]
det13 = (filt13[0] - valp[1]) * ((1 - alpha3) * (1 - alpha3)) + (alpha3 * alpha3) * det13[1]
valp = valp[1] + det13[0]
// Apply smoothing to downtrend calculations
src4 = valueDn
period4 = MAX(smooth, 1)
beta4 = 0.45 * (period4 - 1) / (0.45 * (period4 - 1) + 2)
alpha4 = POW(beta4, pow1)
corr4 = MAX(MIN(smoothPhase, 100), -100) / 100.0 + 1.5
filt04 = (1 - alpha4) * src4 + alpha4 * filt04[1]
det04 = (src4 - filt04[0]) * (1 - beta4) + beta4 * det04[1]
filt14 = filt04[0] + corr4 * det04[0]
det14 = (filt14[0] - valm[1]) * ((1 - alpha4) * (1 - alpha4)) + (alpha4 * alpha4) * det14[1]
valm = valm[1] + det14[0]
//-------------------------------------------------------------//
// Define Signal Color Based on Trend Comparison
//-------------------------------------------------------------//
if valp > valm THEN
valpc = 1 // Positive trend condition
r = 0
g = 255
b = 0
ELSE
valpc = 2 // Negative trend condition
r = 255
g = 165
b = 0
endif
valmc = valpc
endif
//-------------------------------------------------------------//
// Display Trend Lines with Specified Colors
//-------------------------------------------------------------//
colorbetween(valp, valm, r, g, b, 30) // Color zone between valp and valm
//-------------------------------------------------------------//
RETURN valp AS "Ultra trend +" COLOURED(0, 255, 0), valm AS "Ultra trend -" COLOURED(255, 165, 0)