Deviation Trend Profile indicator

Deviation Trend Profile indicator

1. Introduction

The Deviation Trend Profile indicator, developed by BigBeluga, merges trend analysis via a simple moving average (SMA) with a distribution profile based on ATR-scaled deviations. Its purpose is to highlight trend changes and zones of high or low price concentration, offering a visual map of volatility accumulation since the last market inflection.

2. What Is Deviation Trend Profile?

Deviation Trend Profile is a dual-purpose tool:

  • Trend: Plots an SMA whose color reflects momentum, and marks the exact bars where bullish or bearish turns begin.

  • Volatility & Distribution: Overlays six deviation lines (±1, ±2, ±3 ATR multiples) around the SMA, and generates a side histogram showing how many closes have fallen into each of a configurable number of bins between the maximum and minimum deviation levels.

This hybrid approach makes it easy to see when price deviates significantly from its mean and how those deviations are distributed over time.

3. How It Works

3.1. Calculation of SMA and ATR

  • SMA: Simple moving average of closes over a user-set period (smaLength, default 50).

  • ATR: 200-bar Average True Range, serving as the volatility baseline for scaling deviations.

3.2. Standard Deviation Levels

Six horizontal lines are drawn around the SMA:

  • Positive levels:

    • +1 = SMA + ATR × mult1

    • +2 = SMA + ATR × mult2

    • +3 = SMA + ATR × mult3

  • Negative levels:

    • –1 = SMA – ATR × mult1

    • –2 = SMA – ATR × mult2

    • –3 = SMA – ATR × mult3

These lines help distinguish “normal” price territory (±1 ATR) from stronger expansion zones (±2 and ±3 ATR).

3.3. Trend Change Detection

The indicator computes a normalized momentum:

avgDiff = SMA − SMA[5]
avgCol = avgDiff / ATR

A cross above +0.1 signals the start of a bullish trend; a cross below –0.1 signals the start of a bearish trend.

Each turn is marked with a point on the SMA.

4. Deep Dive into the Distribution Profile (Histogram)

This advanced feature works as follows:

  1. Initialize bins
    Create an array $bin of length bins (default 50), filled with zeros.

  2. Populate bins with closes
    For each bar since the last trend change (startIndex):

    • Compute the dynamic range: profileRange = maxDev − minDev.

    • Compute each bin’s width: step = profileRange / bins.

    • Determine which bin a close c falls into by comparing it against lower = minDev + step × i and upper = lower + step, then increment $bin[i].

  3. Determine color scaling
    Find maxVal, the highest frequency among all bins. This value is used to set each rectangle’s transparency proportionally (val / maxVal).

  4. Draw rectangles

    • Position the histogram to the right by profileOffset bars.

    • For each bin with val > 0, draw a rectangle from upper down to lower, with width proportional to val, filled semi-transparently in the current trend color.

The result is a lateral histogram showing price-close concentration since the last turn, highlighting potential dynamic support/resistance zones.

5. Parameter Configuration

Parameter Description Default
smaLength Period of the simple moving average 50
mult1 ATR multiplier for ±1 deviation 1
mult2 ATR multiplier for ±2 deviation 2
mult3 ATR multiplier for ±3 deviation 3
showTp Show distribution profile (1 = yes, 0 = no) 1
bins Number of histogram bins 50
profileOffset Horizontal offset (bars) for the histogram 30
colUpR/G/B RGB channels for bullish trend color 18/209/235
colDnR/G/B RGB channels for bearish trend color 250/40/86

6. Default Values and Recommendations

  • SMA (50) & ATR (200): a balanced medium-term setting.

  • Deviations 1–3: distinguish consolidation (±1) from strong expansions (±2, ±3).

  • Bins (50): balance detail and performance; reduce to 30–40 for faster charts, or increase to 70–100 for finer analysis.

  • Offset (30 bars): keeps the profile clear of price action; adjust to fit your chart width.

  • Colors: customize to match your template, ensuring good contrast against candles and other studies.

7. ProBuilder 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
Alai-n I really like it when you develop ideas around price movement! I am much less a fan of all t...
elcortijoverde Muy buen trabajo.Intuitivo y claro.Gracias por tu dedicación y aportación.
Nicolas
2 years ago
B-Xtrender
B-Xtrender
8
Indicators
616248 Bonjour Nicolas, Peux tu nous expliquer le principe de fonctionnement ? Ou nous mettre un...
Nicolas Le lien vers l'article IFTA de l'auteur est dans le post déjà :)
P. Marlowe Very poweful indeed. It deserves close attention. I really appreciate very much IFTA backgro...
JS
2 years ago
Trendilo
Trendilo
1
Indicators
Coded1 very interesting indicator, thanks JS
Nicolas
2 years ago
Lucas0000 Hello, Congratulations on this programming, it seems incredible to me, I am new to this but ...
plbourse Hello, I am trying to use this singal (in fact I have converted it to an indicateur giving B...
manfeber Buenos dias,alguien me podria decir como se descargar el archivo o el indicador Q-Trend??,ya...
BriceE Bonjour Nicolas, Je suis a la recherche d'indicateurs pour me donner la meilleure indicatio...
Nicolas
2 years ago
Maxime Baudin Well done Nicolas, creative!
Stenozar Hi Nicolas, please can you explain how to read/use this indicator? thanks!
JC_Bywan For people interested in the screener: https://www.prorealcode.com/topic/screener-buy-sell-m...
octum Gracias NJicolas. Las lineas 35 y 36 dan fallo. (¿Es adrede para iniciados?) Puedes co...
mortezaali14 Salut Nicholas, comment exécuter ce fichier dans les métadonnées
Nicolas Yes, Magic if the variable that contains the value of the line, you can test if it goes up o...
dadah1987 Bonjour Nicolas, merci pour cet indicateur. Utilisant pour l'instant la création simplifié p...
Nicolas Merci d'ouvrir un sujet sur le forum avec une description complète du système.
GustavoLoboOrenstein Is it possible to add histogram with only increasing bars?
YvesRobert Bonjour Nicolas, en effet ca marche, je me suis trompé, j'ai bien tout le tracé. C'est parce...
oliTR Bonjour, les conditions longCond et shortCond ne contiennent-elles pas une condition qui s'a...
xpe74 Utilitaire vraiment top, d'autant qu'ajouter des filtres de seuil peux aider a limiter le no...
Jiacky
3 years ago
Kalman Filter
Kalman Filter
0
Indicators
Stenozar Hi Sever, how can I visualize the coloured areas?
Sever Hi Stenozar, You need to add the color zones yourself , just go to Add Color Zone To set ...
atlante hi nicolas this indicator have 2 wrong borderline and islalastbarupdate. thank you can you h...
Nicolas That'"s because you are not using PRT v11? Just remove lines 59 to 62
Kanamax Hi Roberto, sorry for my confusing previous posts (forget them). My request is very simple,...
robertogozzi Please start a new topic in ProOrder support.
robertogozzi There you go: myMagicTrend = CALL “Magic Trend custom”[20, 14, 1, 5] alpha = 105 b = 0...
johann8 exactly :) Thank you all for the help!
max_92 Ciao Roberto, ho scaricato l'indicatore e come ti avevano già scritto sopra anch'io vedo la ...

Top