Trend Levels Indicator: A Dynamic Support, Resistance and Trend Indicator

Trend Levels Indicator: A Dynamic Support, Resistance and Trend Indicator

The Trend Levels is a technical indicator designed to identify and visually represent trend changes and dynamic support and resistance levels on price charts. This indicator helps traders detect key market moments through reference lines, labels, and arrows that clearly signal direction changes.
It is a valuable tool for both intraday traders and those who operate on higher timeframes.


How the Indicator Works

1. Key Value Calculations

The indicator calculates the highest (hi) and lowest (lo) values over a user-defined period using the length parameter.
These values serve as references to determine when a new high or low is reached, potentially indicating a trend reversal.

2. Trend Direction

The trend direction is determined by comparing the highest (hi) and lowest (lo) values with recent highs and lows:

  • Uptrend (trend = 1): occurs when the price reaches a new high within the defined period.
  • Downtrend (trend = -1): is triggered when the price hits a new low within the defined period.

This trend change is key to identifying significant turning points in the market.

3. Drawing Trend Change Arrows

When the indicator detects a trend change, it draws arrows to mark these key points:

  • Up arrow (lime green): signals the start of an uptrend.
  • Down arrow (fuchsia): marks the beginning of a downtrend.

These signals allow traders to visually identify moments when the price may initiate a significant new movement.

4. Dynamic Level Calculations

From the moment a trend change occurs, the indicator calculates the following levels:

  • h1 (upper level): the highest value since the trend began.
  • l1 (lower level): the lowest value since the trend began.
  • m1 (mid-level): the average between the h1 and l1 levels.

These levels help identify dynamic support and resistance zones on the chart, providing clear visual references for technical analysis.

Visual Interpretation on the Chart

  • Reference Lines
    The Trend Levels indicator draws three horizontal reference lines:

    • h1 (upper line): displayed in lime green.
    • l1 (lower line): displayed in fuchsia.
    • m1 (mid-line): displayed in gray with a dotted style.
  • Text and Labels
    Next to each line, in the lastbarindex, the indicator displays a label showing the value of each level (#h1##l1##m1#).

Indicator Configuration

Customizable Parameters

  • length: The number of bars used to calculate highs and lows (default value: 30).
    This parameter allows the analysis period to be adjusted for different timeframes, ranging from intraday charts to daily charts.

Code Trend Levels indicator

Conclusion

The Trend Levels Indicator is an effective tool for identifying key dynamic support and resistance zones and detecting trend changes in a visual and precise way. By combining reference lines and arrows that highlight market turning points, this indicator provides traders with a clear view of entry and exit opportunities.
It is recommended to adjust the length parameter according to the timeframe and asset being analyzed to maximize the indicator’s effectiveness in different market contexts.

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
Related users ' posts
Iván
2 months ago
Madrosat Bonjour ivan Quelle différence il y a t il entre Extra trend et ultra trend lequel est le p...
MaoRai54 dear Ivan, it seems to be very interesting but please clarify what are all the lines I see i...
Iván Hi! you have the answer in the last line of code... MacdMiddle as "histo" style(histogra...
kats Le Top , a utiliser avec le nuage violet et alerte TN pour plus de précision.
roccafragius Hello Ivan, very good job! May I ask you to translate teh script from TradingView named Tre...
Iván Hi! yes. You can ask for it here: https://www.prorealcode.com/free-code-conversion/
roccafragius Thank you so much Ivan! I created this request in english Translate from TradingView Indicat...
Regisnew très bel indicateur merci
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...
Iván
9 months 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...
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
11 months 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