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

  1. Gaspare • 59 days ago #

    Grazie Ivan, ottimo indicatore
    posso chiedere, per favore, una strategia che apre posizioni long con freccia verde e short con la fucsia?
    Grazie

    • Iván • 58 days ago #

      thanks! maybe I could test it

avatar
Register or

Likes

avatar avatar
Related users ' posts
riz001 thnk u
geroniman bonjour Nicolas, j ai un indicateur le Tiger . J aiemrai placer des fleches buy et sell dire...
Nicolas Merci de formuler les demandes sur le forum. ça n'est pas le bon endroit et hors sujet ici ! ;)
avatar
Anonymous Hi robertogozzi - thank you very much for sharing this strategy. I have performed various ...
robertogozzi Thank you samsampop.
Dotan Hello guys I really appreciate this coding effort but can I use this code for Mt5 Forex Trad...
LucioleLucide Clean view, thanks for sharing
dertopen hi where i can found the window for candle configuration?
paolosab69 Ciao! . I have seen the pictures that explain this metod but i don't understand when is mome...
Vonasi Yes that was the issue. I have posted an updated ITF file here: https://www.prorealcode.com/...
crolakstrading @vonasi Thank you for fixing the issue! This is a great indicator.
gregoire good evening vonasi , I had made the request to create this indicator a few years ago and I ...
Giogio hello dear Vonasi, thank you for your indicator, can I ask you for some help in order to let...
Pottar24 HI Vonasi I would like to know how can this algorithm give me the value of the last max e mi...
parthapersonal Hello Vonasi, Great work. Is it possible to replicate this to get values of "Price Line" (1...
tobytarczy Hi Vonasi, Sounds lovely, I race yachts around europe myself. Most regattas cancelled unfor...
mlouys Hello Vonasi thank for your work ! A question how can we do it for minutes ( or 15 min or x ...
Vonasi I think that would be possible but probably in a whole new indicator as detecting when a new...
thierrybl Thanks a lot
B-ling1 Hi Vonasi, I love this indicator - good job! Just one question: If I want the monthly OHLC L...
ezman Copy and paste this code, don't work. error!
coscar Ottimo lavoro. come sempre!
luxrun Nello studio di Sepiashvili viene descritto anche un altro indicatore, il Q-indicator, che è...
datageek How do I change the thickness of the line or change it too dashed lines? Kind regards
lkiklkik NE fonctionne pas ( ou plus ... )
Nicolas il faut modifier toutes les références à top par itop et bottom par ibottom. Ces mots étant ...
Vonasi There is another version of this indicator that can plot the same lines but onto an indicato...
Martin35 Hello Vonasi, do you think it is possible with PRT to code with the same principle as on thi...
abhay I am getting a shading between the lines, how can I avoid that. I just want to see lines as ...
Vonasi Delete the 'Color Zone' in the indicator settings window.
Maik2404 wie kann ich den Code bekommen Paul?
jens_kittner Works with US Crude at 1h as well!
Jean-Claude REGIS Je préconise de regarder les graphiques H1 et M15 pour visualiser la tendance de fond et d'...
mathiasKN Steffen Schmauch • 12/11/2018 # hello Nicolas, can I change the indicator that I only get t...
Nicolas Please open a new topic in the indicator forum and explain there your query, thank you.
upupandaway This seems like a very useful indicator. However, it does not seem to open properly in the c...
mscharstrom Hi @robertogozzi, I really love this indicator. However, I'd like to tinker with it to fit ...
Ahimsa Hi Roberto I cannot thank you enough for writing this code. It could help me more than you ...
Nicolas With PRT v11, you have to click on "price" at the upper left side of the price chart.
capgros Bonjour @Nicolas, Thanks a lot for this tool, it is very useful for me. I would like to s...
Hans63 Would you add the possibility to color also the Heikin Ashi and bar chart?
Nicolas That's possible, please open a new topic in the indicator forum explaining what you need exa...
Nicolas
6 years ago
BSTrend
v10.3
BSTrend
10
Indicators
Florian Legeard C’est à dire sur le prix et non sur le temps ? Merci
Rohit82189 bstrend repaints
Nicolas No, it doesn't repaint.
Nicolas Sure, I suggest you open a new topic in the forum to discuss about your ideas.
hdgm Bonjour Nicolas, est ce que l'on peut en faire une stratégie de trading automatisée ?
Nicolas Non, pas en utilisant l'indicateur zigzag traditionnel de la plateforme.
cfta Hi Fulvio, many thanks for sharing this clever indicator, much appreciated. As Pepsmile ment...
cfta Sorry adding the PRT to code didn't work in the above comment so I guess we will have to set...
juanj Something appears to be wrong with this formula as graphing t shows t to almost never be wit...

Top