Madrid

Madrid MA Ribbon Bar

This study is the companion of the MMAR, displayed here in this publication. This displays the same information as MMAR, but in a linear format. This measures the possibilities of a trend reversal. If the bar fills over 50% of the opposite color from bottom to top then chances are there will be a trend reversal. Otherwise it is just a reentry point.
This study doesn't require but one parameter, and the default is very good. Define if you want to use the standard or the exponential moving average . It is simple, easy to interpret and doesn't require much space on the screen.
It uses only four standard colors
1. Red : A downtrend in progress
2. Green: A short reentry or a trend reversal warning
3. Lime : An uptrend in progress
4. Maroon: A long reentry or a trend reversal warning
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?
//
// Madrid : 26/Feb/2015 21:41: Moving Average Ribbon Bar: 1.0
// MMARB
// http://madridjourneyonws.blogspot.com/
//
// This is based on the Madrid Moving Average Ribbon study, 
// it displays the output in a bar format to better identify
// entry points, up/down trends and reversals
//

study(title="Madrid MA Ribbon Bar", shorttitle="MMARB", precision=0)

exponential = input(true, title="Exponential MA")
src = close

ma05 = exponential ? ema(src, 05) : sma(src, 05)
ma10 = exponential ? ema(src, 10) : sma(src, 10)
ma15 = exponential ? ema(src, 15) : sma(src, 15)
ma20 = exponential ? ema(src, 20) : sma(src, 20)
ma25 = exponential ? ema(src, 25) : sma(src, 25)
ma30 = exponential ? ema(src, 30) : sma(src, 30)
ma35 = exponential ? ema(src, 35) : sma(src, 35)
ma40 = exponential ? ema(src, 40) : sma(src, 40)
ma45 = exponential ? ema(src, 45) : sma(src, 45)
ma50 = exponential ? ema(src, 50) : sma(src, 50)
ma55 = exponential ? ema(src, 55) : sma(src, 55)
ma60 = exponential ? ema(src, 60) : sma(src, 60)
ma65 = exponential ? ema(src, 65) : sma(src, 65)
ma70 = exponential ? ema(src, 70) : sma(src, 70)
ma75 = exponential ? ema(src, 75) : sma(src, 75)
ma80 = exponential ? ema(src, 80) : sma(src, 80)
ma85 = exponential ? ema(src, 85) : sma(src, 85)
ma90 = exponential ? ema(src, 90) : sma(src, 90)
ma95 = exponential ? ema(src, 95) : sma(src, 95)
ma100 = exponential ? ema(src, 100) : sma(src, 100)

leadMAColor = change(ma05)>=0 and ma05>ma100 ? lime
            : change(ma05)<0  and ma05>ma100 ? maroon
            : change(ma05)<=0 and ma05<ma100 ? red
            : change(ma05)>=0 and ma05<ma100 ? green
            : gray
maColor(ma, maRef) => 
              change(ma)>=0 and ma05>maRef ? lime
            : change(ma)<0  and ma05>maRef ? maroon
            : change(ma)<=0 and ma05<maRef ? red
            : change(ma)>=0 and ma05<maRef ? green
            : gray


plot( 5, color=leadMAColor, style=line, title="MMA05", linewidth=2)
plot( 10, color=maColor(ma10,ma100), style=line, title="MMA10", linewidth=2)
plot( 15, color=maColor(ma15,ma100), style=line, title="MMA15", linewidth=2)
plot( 20, color=maColor(ma20,ma100), style=line, title="MMA20", linewidth=2)
plot( 25, color=maColor(ma25,ma100), style=line, title="MMA25", linewidth=2)
plot( 30, color=maColor(ma30,ma100), style=line, title="MMA30", linewidth=2)
plot( 35, color=maColor(ma35,ma100), style=line, title="MMA35", linewidth=2)
plot( 40, color=maColor(ma40,ma100), style=line, title="MMA40", linewidth=2)
plot( 45, color=maColor(ma45,ma100), style=line, title="MMA45", linewidth=2)
plot( 50, color=maColor(ma50,ma100), style=line, title="MMA50", linewidth=2)
plot( 55, color=maColor(ma55,ma100), style=line, title="MMA55", linewidth=2)
plot( 60, color=maColor(ma60,ma100), style=line, title="MMA60", linewidth=2)
plot( 65, color=maColor(ma65,ma100), style=line, title="MMA65", linewidth=2)
plot( 70, color=maColor(ma70,ma100), style=line, title="MMA70", linewidth=2)
plot( 75, color=maColor(ma75,ma100), style=line, title="MMA75", linewidth=2)
plot( 80, color=maColor(ma80,ma100), style=line, title="MMA80", linewidth=2)
plot( 85, color=maColor(ma85,ma100), style=line, title="MMA85", linewidth=2)
plot( 90, color=maColor(ma90,ma100), style=line, title="MMA90", linewidth=2)

hline(50, color=black, linewidth=1)
hline(25, color=red, linewidth=1)
hline(75, color=lime, linewidth=1)

Comments

How can I set an alarm to a full trend changing?
+7 Reply
And why Cant I see the indicator bar on the bottom?
+1 Reply
Madrid jesus.perales1
Those are two indicators. The ribbons and the bar, just look for the Moving Average Ribbon Bar. A full trend change happens when the 5 EMA crosses over or below the 90 EMA. So just set the alert to trigger when this event happens.
Reply
I'm a bit surprised TV doesn't allow us to have the bar and the candle script together by now. or 2 studies in one script.
Reply
TimeFliesBuy TimeFliesBuy
and believe me I've tried....
Reply
thank you very much
Reply
Great Indicator.....thank you
Reply
Hello Madrid

I have two questions

1. Is it possible to lower to 1 MA raster (instead of 5 MA step)
2. An if so, to put it all in one colour (e.g. blue)

Thanks

Regards
Reply
Hi Madrid,

Do you have any way to better tell between a reversal or reentry point?
Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Private Messages Chat Sign Out