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 avatar
Related users ' posts
ChemaGeek Bonjour Nicolas, j'ai récemment découvert cet indicateur (Regularized Momentum 2017) et je l...
YvesRobert Bonjour, nouveau sur PRT (qq jours), j'essaie un peu de voir quel type d'indicateur me convi...
Xenotrax A première vue, sa à l'air d'être un indicateur très puissant sur de petites temporalités, j...
merri Bonjour Nicolas, Comment transformer cet indicateur en bot sur PRT ?
Nicolas Cela a déjà été fait, voir ce sujet: https://www.prorealcode.com/topic/strategia-con-lindica...
Nicolas change the last line with: return v coloured(r,g,b) style(line,2), v+band coloured(168,168,1...
Paolo.B Thanks ... works as i wanted.
Kanamax Bonjour Nicolas, comme Paolo.B je souhaiterais utiliser cette indicateur au sein d'un code. ...
zilliq Thanks @Nicolas. I tried to use it as Trend in a proorder system, but don't know why, it doe...
Suzu Yuk He is right. MT and mavgMT are not defined and causing errors.....
RakeshPoluri I have a question about the bands on the candles. Is it bollinger bands or something else?
Nicolas I think that's 2 Bollinger Bands
Emperor.it "style(line,2)" C'è una guida ai parametri che si possono modificare ? Tipo stile della lin...
IV Mcm https://www.prorealcode.com/programming-with-prorealtime/
StephFor //ind1 = ZigZagPoint[2*averagetruerange[200]](close) avr = 3 //3% ind1 = ZigZag[avr](close...
Manu L. @Steph un grand merci pour ton aide mais :-( J'ai copier le code tel quel mais cependant j...
AlphaMauss Je n'ai pas réussi à faire fonctionner l'indicateur avec le code fourni en commentaire sur P...
Daniele Maddaluno Écrivez-moi où vous préférez you can easily find me on LinkedIn
AK27 C'est payant visiblement sur linkdin je peux pas vous envoyer, discord vous avez ?
Pensera Bonjour Nicolas, comment est-il possible de backtester cet indicateur? cela fait une erreu...
Nicolas Oui bien sûr, il doit y avoir pas mal de sujets dans le forum à ce propos.
simmerseb Bonjour, merci beaucoup pour cet indicateur je le trouve très clair et pertinent.
Nicolas Il doit s'agir d'un mauvais copier/coller. Je suggère de télécharger le fichier itf contenu ...
Bard Hello @Nicolas, I can get this to display in a separate indicator panel but not on Price as ...
Stenozar Hi @Nicolas, how can I put the bands on price? Thanks, Stefano
Nicolas Oui c'est possible. Merci de ne pas poster des demandes qui sont hors sujets. Pour les deman...
Igor Merci pour cet itf. Question : comment faire pour instruire un screener ?
Nicolas tester le croisement du Close avec la première valeur de l'indicateur : "TrailingStop", faci...
Guillaume Mcm I gave the above message fix ;)
Tradingrob Is it possible to put the itf-file in the right way here in Prorealcode? so the right 'trend...
Guillaume Mcm Update link ;) https://www.prorealcode.com/topic/trend-histogramme-cci-mise-a-jour-suite-...
Screw27 Hi man, I installed the indicator and i don't know why but my graph it is so big
HelixKing sounds interesting I'll take a look
Godo Bonjour Souhait Sam, Après de nombreux essais pour le mettre en format afin d'utiliser ce c...
Nicolas Il faut supprimer celles qui existent dans la fenêtre d'optimisation et les créer en dur dan...
crusoe76 hi there, anyone can help making this strategy work, i have a message saying replace variabl...
Screw27 Salut nicolas j'aimerais savoir tes résulats grace a cettte methode
eva.g.forsgren It dose not work, I get a strap instead of candels???????????????????????????????????????????
Nicolas That indicator is the one below the chart. The indicator to put on the price chart is this o...
pyhrus P.S : IG , que j'ai contacté ,m'indique que la version V11 , ne sera pas disponible avant un...
Hasardeur Dear Nicolas, is there someting at the arry to modify in order to run the trend at the actu...
MALIMALO Dear Nicolas, just try touse your indicator with backtest but it's not working. is anybody...

Top