Multi Deviation Scaled Moving Average (Multi-DSMA)

Multi Deviation Scaled Moving Average (Multi-DSMA)

1) What is the Multi-DSMA?

The Multi Deviation Scaled Moving Average (by ChartPrime) is an adaptive moving average that stacks eight Deviation-Scaled MAs (DSMAs) with progressively longer lookbacks. Each DSMA self-adjusts to current market activity via RMS scaling, then all eight are averaged into a single line. A score gauges how many fast layers are above the slowest layer, driving dynamic color/opacity and generating early/late crossover signals.

Use it when you need a trend-aware line that reacts quickly in acceleration phases but remains calm in choppy markets.

2) How it Works — The Short Version

Pipeline per bar:

  1. Super Smoother prefilter → noise reduction with low lag.

  2. RMS scaling (via exponential average) → dimensionless, volatility-aware signal.

  3. Adaptive alpha → bigger |signal| ⇒ faster DSMA; clamped to avoid overshoot.

  4. Eight DSMA layers → periods = Periods + k×step (k = 0..7).

  5. Average of 8 layers → final “Multi DSMA Avg” line.

  6. Score (0–1) → fraction of fast layers above the slowest layer.

  7. Color/Opacity from score + Signals at 0.30/0.70 crossovers.

3) Core Mechanics

3.1 Super Smoother (per layer)

Each layer takes a zero-mean input (close - close[2]) and runs it through a 2-pole Super Smoother (Ehlers-style) using period-dependent coefficients. This removes high-frequency noise without the lag typical of simple MAs.

3.2 RMS Normalization

rms = sqrt(ExponentialAverage(period)(filt^2))
Dividing the filtered signal by its RMS (scaledFilt) makes the amplitude comparable across regimes (quiet vs. volatile), so the adaption depends on structure, not raw volatility.

3.3 Adaptive DSMA

alpha = min( |scaledFilt| * 5 / period , 1 )
DSMA = alpha * close + (1 - alpha) * DSMA[1]
When structure builds (|scaled| ↑), alpha increases and the DSMA hugs price more tightly. In calm conditions, alpha shrinks and the line smooths out.

3.4 The Eight Layers & Sensitivity Inversion

  • Base period = Periods.

  • Step = max(100 - Sensitivity, 1) → higher Sensitivitysmaller step ⇒ layers are closer together ⇒ more responsiveness.

  • Layer periods: Periods, Periods+step, ..., Periods+7×step.

3.5 Multi-Layer Average

The plotted line “Multi DSMA Avg” is the simple average of the 8 DSMA values. This blend keeps the agility of fast layers while anchoring to the slower context.

3.6 Score Construction (0–1)

Compare each of the seven fast layers to the slowest (DSMA8). Each fast-above-slow adds ≈ 1/7.

  • Score ≈ 1 → strong bullish stack (broad alignment).

  • Score ≈ 0 → strong bearish stack.

  • Middle → mixed/transition.

3.7 Dynamic Color & Opacity

  • If score > 0.5: gradient fades in towards the upper color (bullish).

  • If score ≤ 0.5: gradient fades out from the down color (bearish).
    Opacity follows the same logic: conviction (stack agreement) literally shows up as a more opaque line.

3.8 Signals (Hysteresis Band)

  • Bullish signal when score crosses up 0.30early heads-up.

  • Bearish signal when score crosses down 0.70late confirmation.
    This asymmetric band reduces flip-flops by asking for more evidence before flipping bearish.

4) How to Read It on the Chart

  • Line direction: trend bias of the blended stack.

  • Color & opacity: confidence. Deeper/denser = stronger alignment.

  • Arrows:

    • ▲ at the Multi DSMA Avg when score crosses above 0.30.

    • ▼ at the Multi DSMA Avg when score crosses below 0.70.

  • On-chart panel (last bar): two vertical bars show Up% vs Down% (score×100 vs 100–score×100), updated on the most recent update.

Tip: The score panel uses anchored drawing near the bottom-right of the chart. If you customize positions, keep the anchor(bottomright, xshift, yshift) logic consistent.

5) Typical Uses

A) Trend Confirmation / Bias Filter

  • Trade only long when score > 0.5 and line slopes up; short when < 0.5 and slope down.

  • Use arrows as timing aids, not stand-alone entries.

B) Momentum Entries

  • Aggressive: act on the ▲ (0.30 cross up) if the line is already turning up and price pulls back to or slightly below the line.

  • Conservative: wait for price to reclaim the line and the score to sustain > 0.6 for several bars.

C) Exits / Risk Control

  • Partial exit when score slips below 0.7 from high levels (momentum fading).

  • Hard exit on ▼ (0.70 cross down) and line turning flat/down.

D) Multi-Timeframe

  • Use higher timeframe score as bias; execute with lower timeframe ▲/▼ around the Multi DSMA Avg.

This indicator is non-repainting (no future data; all calculations use current and past bars).

6) Inputs & Configuration

Periods (default 30)

  • Sets the base lookback.

  • Lower (e.g., 14–25): faster, more responsive, more signals.

  • Higher (e.g., 40–80): smoother trend backbone, fewer signals.

Sensitivity (default 60, range 0–100)

  • Controls step via step = max(100 - Sensitivity, 1).

  • Higher Sensitivity ⇒ smaller step ⇒ layers cluster ⇒ more agility.

  • Lower Sensitivity ⇒ larger step ⇒ wider spread ⇒ stronger “stack” requirement.

Recommended starting points:

  • Scalping: Periods 20–30, Sensitivity 70–85

  • Swing: Periods 30–50, Sensitivity 55–70

  • Position: Periods 50–80, Sensitivity 40–60

Colors (RGB triplets)

  • Upper color for bullish gradients, Down color for bearish.

  • You can soften opacity extremes by lowering the alpha scaling, but the default provides a clear conviction cue.

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

  1. efahmy • 3 mins ago #

    Hi Ivan, I have one of your great indicatores to catch reversals, I tried to add voice alert to it with the help of AI, but it sounds errors in 2 lines. could you please fix this error. here is the code //—————————————————//
    //PRC_N reversal Detector
    //version = 1 (with sound alerts)
    //04.10.2024
    //Iván González @ http://www.prorealcode.com
    //Sharing ProRealTime knowledge
    //Modified with sound alerts
    //—————————————————//
    //——————Inputs—————————//
    //—————————————————//
    ////Trend filetering
    //trendType=0 //0=no trend / 1=MA trend / 2=ST trend / 3=Donchian trend
    //TrendFilter=1 // True=Aligned / False=Opposite
    ////Moving average settings
    //maType=7
    //maFlength=50
    //maSLength=200
    ////Supertrend settings
    //atrPeriod=10
    //factor=3
    ////Donchian Channels settings
    //length=13
    ////Pattern Detection
    //numBars=7
    //minBars=50
    //—————————————————//
    //—–Trend indicators – Moving average Cloud——-//
    //—————————————————//
    maFast=average[maFlength,maType](close)
    maSlow=average[maSLength,maType](close)

    if trendType=1 then
    if maFast>maSlow then
    r=8
    g=153
    b=129
    else
    r=242
    g=54
    b=69
    endif
    colorbetween(maFast,maSlow,r,g,b,20)
    endif
    //—————————————————//
    //———Trend indicators – Supertrend————-//
    //—————————————————//
    atr = averagetruerange[atrPeriod](close)
    up = high – factor*atr
    up1 = up[1]
    if close[1] > up1 then
    up = max(up,up1)
    else
    up = up
    endif

    dn = low + factor*atr
    dn1 = dn[1]
    if close[1] dn1 then
    trend = 1
    elsif trend = 1 and close upper[1] then
    os=1
    r=8
    g=153
    b=129
    elsif lower<lower[1] then
    os=0
    r=242
    g=54
    b=69
    else
    os=os
    endif
    colorbetween(upper,lower,r,g,b,20)
    endif
    //—————————————————//
    //————–3-Bar Reversal Pattern—————//
    //—————————————————//
    if trendType=1 then
    if TrendFilter=1 then
    CDownTrend= close<maFast and maFastmaFast and maFast>maSlow
    elsif TrendFilter=0 then
    CDownTrend=close>maFast and maFast>maSlow
    CUpTrend=close<maFast and maFasthigh[numBars] then
    bullReversal=0
    break
    else
    bullReversal=1
    bullLow=min(bullLow,low[i])
    if open[i]>close[i] then
    bearCount=1+bearCount
    endif
    endif
    next

    if bearCount/(numBars-1)>= minBars/100 then
    bullReversal=1
    else
    bullReversal=0
    endif

    bullLow=min(bullLow,low)

    isBullish=bullReversal and high>high[numBars]

    bullishReversal=isBullish and CUpTrend
    //—————————————————//
    //———-Bearish Reversal Detection—————//
    //—————————————————//
    bearReversal=0
    bearHigh=high[numBars]
    bullCount=0

    for i=1 to numBars-1 do
    if low[i]<low[numBars] then
    bearReversal=0
    break
    else
    bearReversal=1
    bearHigh=max(bearHigh,high[i])
    if open[i]= minBars/100 then
    bearReversal=1
    else
    bearReversal=0
    endif

    bearHigh=max(bearHigh,high)
    isBearish=bearReversal and low<low[numBars]

    bearishReversal=isBearish and CDownTrend
    //—————————————————//
    //—————–Plot Signals———————-//
    //—————————————————//
    //Bullish conditions
    if bullishReversal and bullishReversal[1]=0 then

    prevlnABx=lnABx
    prevlnAB=lnAB

    lnAT=high[numbars]
    lnATx=barindex[numbars]
    lnAB=bullLow
    lnABx=barindex

    bullProcess=1

    drawtext("▲",barindex,low)coloured("green")
    drawsegment(lnATx,lnAT,barindex,lnAT)coloured(8,153,129)style(line,1)
    drawsegment(lnATx,bullLow,barindex,bullLow)coloured(8,153,129)style(line,1)
    drawrectangle(lnATx,bullLow,barindex,lnAT)coloured(8,153,129,0)fillcolor(8,153,129,25)

    if lowLevelbreaken=0 then
    drawsegment(prevlnABx+1,prevlnAB,barindex[1],prevlnAB)style(line,2)coloured(8,153,129)
    endif
    lowLevelbreaken=0
    ALERT "BULLISH REVERSAL – BUY SIGNAL DETECTED"
    endif

    if bullProcess=1 then
    if close[1]lnST and HighLevelbreaken=0 then
    HighLevelbreaken=1
    drawsegment(lnSTx+1,lnST,barindex[1],lnST)style(line,2)coloured(242,54,69)
    bearProcess=0
    endif
    endif
    //—————————————————//
    return

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Nicolas En effet, c'est le cas si on copie/colle le code. Ces 2 variables sont inscrites en externes...
Salocin Hello Nicolas, my french is not that well. It occurs an error which can not be solved by cop...
Nicolas Just download the ITF file and import it into your platform, follow these easy steps: https:...
Nicolas
9 years ago
Holt EMA
Holt EMA
1
Indicators
robertanthonyuk Hi,What do the each colour represent? Rob
Nicolas Je vais faire l'indicateur et expliquer comment en même temps dans un sujet de forum. Plus s...
gregus merci nicolas toute ma gratitude est pour toi sa sera bien pratique car je pense ne pas etre...
Nicolas Ok merci donc d'ouvrir un sujet spécifique pour cette demande donc :) 
Nicolas You'll need to preload bars to get the good calculations of you indicators. I did not test i...
David Nicolas I tried DEFPARAM Preloadbars = 5000 And still the same drawn output of entries/exit...
marcara Hi, Thank you very much for the Moving Average Daily indicator, I am using it as indicator i...
algotrader This indicator looks coolBut on attempt to use it for a strategy dev'I get an error.."The in...
dajvop @algotrader if you at the bottom of the code add: RETURN Buffer1 as "up", Buffer2 as "down",...
Bateson Si cela peut servir, l'indicateur Sadukey a été créé en utilisant un générateur de filtre ap...
Nicolas Je l'ai converti depuis un code pinescript. De mémoire il s'agit bien d'une variation d'une ...
Captain_Walker @Nicolas, I've copied your code into PRT indicator panel to create it. When I attempt to sav...
Nicolas Download the itf file and import it.
Nicolas Please post any question on forums, thanks.
Lavallette Bonjour Nicolas. J'utilise la version 11 et moi aussi j'ai une ligne horizontale malgré l'a...
Nicolas il faut modifier la ligne 20 avec: if adaptive=1 and averagePeriod > 1 and barindex>(...
dakaodo Hi, Wilko. Acc to the original FRAMA paper by Ehlers, Ehler's own code only takes inputs for...
dakaodo For reference, here is Ehlers' original paper: http://www.mesasoftware.com/papers/FRAMA.p...
dakaodo Here is the code with only SC included, per ETFHQ. pri=customclose //len>=4, even on...
Nicolas The code is correct, don't know if the label and color are the same as other trading softwar...
peppe novellino Hi Nicolas, the settings of the alligators are not editable. How can I change it? Thanks in ...
pabo_swe I got very bad performance with this script, it was slow... it seems like if one breaks out ...
Nicolas
9 years ago
ALMA MACD
ALMA MACD
7
Indicators
Arnaud HALVICK Great indicator, thank you!
JMat45 Hi Nicolas, just reviewing this indicator and noticed that you have double assigned the vari...
Nicolas That would not make any difference because the code is read from top to bottom.
bluetime6 Hello Doctrading.   Can you ask you for something? Can you code a screener screen po...
gianlox I added a simple momentum indicator (MACD). I think much better results:   achat = 0v...
gianlox achat = 0 vente = 0 MACD12M = MACDline[12,26,9](close) MACD12S = ExponentialAverage[9](MA...
MikeGC I don't know if you have used the variables a and b to optimise the parameters for the Super...
gianpiero75 I have not optimized, I multiplied the parameters for 6 (5,8), to use them on the 4  hoursTF...
bertrandpinoy bonjour Mike j utilise TrendChaser V2.0 et quand il prend position cela ne programme pas le ...
Nicolas Thank you for contribution. Please consider that advertising is tolerate as long as you cont...
triss1965@gmail.com  Hi, I cant make it work. And if you doing so much money. Why do you have to sell it? It don...
T-rader Eva... He dosen´t sell anything. He is just a nice guy that want to share on of his strategy...
eisi If i switch between different Markets, the Backgroundcolour will appear where it should not...
datageek How can I get alerts on colour change?
NAMBO40 Hello, I would like to add a 25 period SMA moving average. It's possible?
Fabio Anthony Terrenzio this strategy works only in a well defined trend
brosly Good afternoon I am trying to get the complete code of lex strategy made by adolfo since I s...
dreif123 hi Adolfo, is Alex Auto Trading Botindex working on DAX as well ? if so , can you post the...
Doctrading I forgot to write at the beginning :  a = 50 b = 50 These are intermediate levels Sorry
DerPat Thank you. This one could be an aid in my current research on stochastics.
Pelayo it is possible that in line 12 we should put seuilinf=-b, thaks for all
Doctrading Hello, Someone asked me something (his results seemed to be different) on my email, but it ...
Glen Marquis Not your best..So what is your best strategy? :)
Nicolas I would not recommend using this version of the linear regression channel, but this one inst...
Aragorna Hello, Is it possible to updated the indicator to the more updated versione of ProrealTime? ...
Nicolas Use that code instead: https://www.prorealcode.com/prorealtime-indicators/standard-deviation...

Top