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 avatar avatar
Related users ' posts
Thomas
6 years ago
Thomas Como? no intiendo. Can you write in english . It works! Download the itf file.
Thomas New Version comin soon...
CHARLESRACHELLE OLA NAO SERVE PARA MT4?
illenza
6 years ago
ribes65 Buongiorno Illenza, Il tuo indicatore è molto efficace, ma non funziona su tutte le azion...
coscar Ottimo lavoro. come sempre!
luxrun Nello studio di Sepiashvili viene descritto anche un altro indicatore, il Q-indicator, che è...
juanj
6 years ago
juanj I have actually completely redesigned this indicator with loads of improvements, so will res...
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'...
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...
ottimo Thank you Nicolas, great indicator, N. 1
tikigai Merci Nicolas! First Happy new Year 2020. Very good indicator BUT (yes the french "oui, m...
Nicolas Whats prorealtime version? Did you try in version prior to v11? indicator's call and loop ca...
Nicolas
7 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.
Marcos Alvarez Dominguez Hello Nicolas, is it possible to stablish a bullish screener for this indicator when the cen...
Nicolas Please open a topic in the screener section to ask for this specific query.
zaher123 Hello, the indicator doesn't show up anything on the screen, any suggestions please?
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...
Nicolas Apply it on the price chart. The indicator plot just one single line. There are two in the...
jamesoc Hi Nicolas, do you happen to know if there is an indicator that can be applied to charts, to...
gustavobp Buenos dias Nicolas, al agregar tu indicador no me reconoce la variable Price ni en la linea...
Nicolas
7 years ago
Maxime Baudin Interesting, Thank you! :)
franck-david Bonjour Nicolas , actuellement je me forme grace a vos videos tres tres bien expliques mer...
Nicolas Merci. ça n'est pas le lieu pour poser ce genre de question :) Merci d'utiliser le forum Pro...
bharatjai Script 'Adaptive ATR' has been saved line 24: no viable alternative at input 'lr' Gettin...
Nicolas download the itf file and import it into your platform.
Francis3332 Bonjour à tous, J'aime beaucoup cet indicateur et j'aimerais pouvoir l'utiliser sur la dern...
Vonasi Discussion on this indicator/filter can be found here: https://www.prorealcode.com/topic/121...
Domenec Claro Juanjo de todas maneras en deinversoratrader.com tienes estsos osciladores evolucionad...
Dron Hola Domenec, en la descripción hablas del indicador velas de colores, no lo encuentro en la...
Domenec Hola Dron mira en el blog deinversoratrader.com en formacion indicadores ahi hay varios grat...
AGTrader Interesante, muy visual Doc. Felicidades!!!
Andraxx simplemente impresionante Dom...te sigo en youtube. Me ha gustado tu canal. Gracias por comp...
Geronima Ortiz I watched the video three times, but I can not put the npips parameter as a variable. I do...
Geronima Ortiz I think the video is for an old version of prorealtime, the images do not correspond at all ...
Nicolas indicator1 = CALL “PRC_StopReversal”[npips, 1] and define npips in the optimization window ...

Top