DSL Trend Analysis

DSL Trend Analysis

1. Introduction to the Indicator

The DSL Trend Analysis indicator is designed as a visual tool to clearly identify trend changes in financial markets. It focuses on the analysis of dynamic support and resistance levels that adjust automatically to price behavior. Through a system of bands and a trendline calculated using linear regression, this indicator helps traders detect areas of buying or selling pressure and anticipate potential trend reversals.

Unlike traditional trend indicators such as simple moving averages, DSL Trend Analysis introduces the logic of historical thresholds to generate visual signals when price breaks key levels. Its implementation emphasizes not just recent data, but also comparisons with past levels, offering a more robust and less noisy perspective.

The result is a graphical representation highlighting key zones with shaded bands and a trendline whose color reflects the strength of price movement. This makes it a valuable tool for both trend-following and reversal trading strategies.

2. Indicator Foundation

The core of the DSL Trend Analysis consists of three main components: the Simple Moving Average (SMA), the Highest High Value (HHV), and the Lowest Low Value (LLV) over a configurable period (len, default 10). These are calculated to establish dynamic reference levels.

The logic is activated using the offset parameter, which introduces a time delay in evaluating price extremes. This allows for comparison of the current price with highs and lows from several bars ago, offering a clearer retrospective view and avoiding false signals caused by recent fluctuations.

The thresholds derived from these values (thresholdUp and thresholdDn) act as triggers for DSL levels:

  • If the current close is higher than the delayed high, a DSL Up level is plotted at the SMA value.

  • If the close is lower than the delayed low, a DSL Down level is plotted at the SMA value.

This logic ensures the indicator reacts to meaningful breakouts while filtering out market noise.

3. DSL Band Calculation

Once the primary DSL levels (dslUp and dslDn) are identified, the indicator draws two additional bands to define a visual buffer zone. These bands use the 200-period Average True Range (ATR), adapting their width to market volatility.

The width parameter multiplies the ATR value to scale the bands’ spacing. Higher values widen the bands, suitable for volatile markets.

The bands are defined as follows:

  • DSL Upper Band: dslUp1 = dslUp - ATR

  • DSL Lower Band: dslDn1 = dslDn + ATR

These bands act not as direct signals but as transition zones, helping traders spot areas where price may react before confirming a trend change.

4. Dynamic Visualization and Coloring

A distinctive feature of DSL Trend Analysis is its advanced visual representation using shaded zones. This is achieved with the colorbetween function, which fills the area between the DSL levels and their corresponding bands.

Once enough bars have accumulated (more than 200, required for ATR calculation), the following zones are drawn:

  • Upper Zone (between dslUp and dslUp1): Light green, indicating bullish pressure.

  • Lower Zone (between dslDn and dslDn1): Orange, indicating bearish pressure.

These visual zones provide quick context:

  • A green area above price may act as dynamic resistance.

  • An orange area below price may act as dynamic support.

Though not direct signals, they offer valuable information about the current market structure.

5. Trend Line Based on Linear Regression

In addition to the DSL bands, the indicator features a TrendLine calculated using a 5-period linear regression of the closing price. This line reflects the short-term direction of the price and updates dynamically.

What makes it powerful is its adaptive coloring system:

  • Bright green (opacity 255): Price breaks above dslUp – strong bullish momentum.

  • Bright orange (opacity 255): Price breaks below dslDn – strong bearish momentum.

  • Soft green (opacity 60): Price between dslUp1 and dslUp – potential bullish continuation.

  • Soft orange (opacity 60): Price between dslDn and dslDn1 – potential bearish continuation.

  • Transparent (opacity 0): Price not in any significant zone.

This system transforms the trendline into a visual guide, helping to assess the market’s strength and direction at a glance.

6. Indicator Settings

The DSL Trend Analysis includes three configurable parameters to adapt it to various trading styles and market conditions:

  • len (Length)
    Default: 10
    Defines the number of bars for SMA, HHV, and LLV.

    • Lower values = more responsive (for scalping/intraday).

    • Higher values = smoother (for swing or longer-term analysis).

  • offset (Threshold delay)
    Default: 30
    Controls how far back the highs/lows are checked for thresholds.

    • Higher values = more conservative signals.

  • width (Band width factor)
    Default: 1
    Multiplies the ATR to set the width of the DSL bands.

    • Higher values = wider buffer zones (useful in volatile conditions).

These options allow traders to fine-tune the indicator for optimal responsiveness and clarity.

7. Conclusion

The DSL Trend Analysis is a visually rich indicator that combines dynamic level analysis, volatility-based banding, and an adaptive trendline using linear regression. It provides clear insight into support/resistance zones and trend direction, helping traders stay aligned with market momentum or spot potential reversals.

Its flexible settings and intuitive design make it suitable for a wide range of trading approaches, from short-term intraday setups to longer-term strategic entries. Whether used alone or as part of a more complex system, this indicator delivers clarity and precision to market analysis.

8. Code

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

avatar
Register or

Likes

avatar
Related users ' posts
Jean2139 Bonjour Yvan, Merci pour ton indicateur que je trouve très intéressant. Je suppose que tu ...
Suffi Hier eine kleine Korrektur: //-----Inputs-----------------------------------------// MALengt...
kats Bonjour, J'ai une question etes vous trader? Je m'explique , j'ai téléchargé tous les indi...
Faisalx Hola Ivan. Thanks for your great job. I would appreciate if you have look at my request http...
roccafragius Thank you for all these useful information!! Very great job Ivan! THank you so much
geroniman Merci Ivan, super travail. On peut toujours compter sur toi pour apporter des innovations su...
Stenozar Ciao IVAN , mi da errore per la riga 49 "print tema low"; puoi suggerirmi la modifica da met...
Iván Avete provato a scaricare il file .itf?
AndyB72 Caricato ora sulla V12, nessun errore.
Iván Allora crei un nuovo post. Lo aspetterò.
Stenozar Ciao Ivan, ho inserito il post con la richiesta di traduzione. Se puoi vedere, grazie!
Iván perfect!
kats BONSOIR c bon merci j ai trouve ce weekend merci de votre reponse cdlt
the_giorgio Hi, nice work I would like to understand something about prorealtime code. With your ...
Iván Hello. When you use the drawcandle() instruction then in the configuration window you add ...
Gaspare Ciao Ivan si puo' inserire una strategia su questo indicatore per ottimizzare le variabil...
Regisnew Bonjour Ivan serait il possible de proposer un screener pour détecter les zones de support v...
bembel242 Hello Ivan ! A belated HNY ! I know late ! Quick question on theis great indicator plse. I u...
gp38super Wow! This is GOLD! Great job!
larouedegann TIMEFRAME(15minutes) apparemment ne fonctionne pas
Iván Bonjour Je ne comprends pas bien le problème. L'indicateur fonctionne dans n'importe quelle...
larouedegann OUI je le sais, il fonctionne dans toutes les unités de temps. Mais je souhaite utiliser l'i...
Iván
1 year ago
Iván Si lo descargas e importas en tu PRT verás que se han creado las variables para luego config...
WhyAskOZ Hi, Ivan As always you are doing great coding. The code works on my PRT, however the issu...
Iván You can delete in the last line (return) the configuration for color. Delete coloured(xx,xx,...
Bernard13 (Je réécris mon commentaire -français- en français car certains mots ne correspondaient pas ...
Iván 1000 indicateurs !!! brutaux
Iván Gracias! Para el screener sólo tienes que copiar el indicador y poner como condición de búsq...
Lean Muchas gracias Iván, ya lo he podido crear.
bertoluce Hello Ivan, thank you very much for the indicator. An observation: would it be possible (and...
Iván sería así //------------------Inputs------------------------------ linreglength = 11//i...
Doddge Muchísimas gracias Iván, está genial.
superfalcio holaaa, have you run some statistics?
Doddge Hola Iván, ¿sería posible crear un screener que indique cuándo las velas coloreadas del indi...
RTR Ivan thank you for the pro-screener. I a trying to understand how to write the signals from ...
Iván Hi, Lines 62 and 63. These lines define buy and sell conditions.
Iván Hi You should delete from the indicator code all drawing functions and all variables not us...
Iván I've created a screener to show [longcondition or shortcondition]
Chrisinobi Hallo Ivan, Danke das ist Perfekt !! Kannst du bitte in der Screener-Bibliothek die itf. hoc...
MaoRai54 Thanks, now it's OK. in your first code at line 15-16 it's missing.
Madrosat Hello Ivan Did you try a strategy with this indicator
Iván Hi. No I didn't. This is a code translation requested by an user a few days ago.
Iván
1 year ago
cjr30 Simplemente modifica las lineas 19 y 21 por las siguientes: drawtext("▲",barindex,low-0.1*a...
groelandes Gracias!!
WhyAskOZ i copied the code into strategy and it gives error on line 21 and 23. it says " Line 1: ...

Top