707 2
This study shows a pair of colored moving averages filled with the color of the direction of the trend.
This study calculates the moving averages with standard or exponential M.A.'s. By default it uses a couple of fast exponential moving average pair (5,13) with the closing price as the source.

Parameters:
• source
• fast MA length
• slow MA Length
• type of moving average
```// Madrid : 16/Jun/2015 12:12 : 2.0 : Trend Spotter
// This study shows a pair of colored moving averages filled with the color of the
// direction of the trend.
// This study calculates the moving averages with standard or exponential M.A.'s
// By default it uses a couple of fast exponential moving average pair (5,13) with
// the closing price as the source.
// Parameters: source, fast MA length, slow MA Length, type of moving average.
//
src = input(close, type="source")
fastLen = input(5, minval=1)
slowLen = input(13, minval=1)
ema = input(true, title="Exponential")

maColor(ma) =>
change(ma,3)>=0?lime:red

fastMA = ema?ema(src, fastLen):sma(src, fastLen)
slowMA = ema?ema(src, slowLen):sma(src, slowLen)

fastUT = plot(fastMA>=slowMA?fastMA:na, color=maColor(fastMA), style=linebr, linewidth=1)
slowUT = plot(fastMA>=slowMA?slowMA:na, color=maColor(slowMA), style=linebr,linewidth=1)
fill(fastUT, slowUT, color=lime, transp=80)

fastDT = plot(fastMA<slowMA?fastMA:na, color=maColor(fastMA), style=linebr,linewidth=1)
slowDT = plot(fastMA<slowMA?slowMA:na, color=maColor(slowMA), style=linebr,linewidth=1)
fill(fastDT, slowDT, color=red, transp=80)

plot(fastMA, color=maColor(fastMA), linewidth=2)
plot(slowMA, color=maColor(slowMA), linewidth=2)
```
Hello.
Since now I congratulate and reinforce the praise for all your excellent work with the many indicators that share here with the community. They are all excellent.
I have been testing some of them more deeply and would like to test the indicator from this post.
The issue is that when I add the indicator to the chart it gives error. It says, "Error: Could not compile scrip'Madrid Trend Spotter '".
Can you help ???
Thanks and continuation of the excellent work ...
What is your idea behind? Why using a pair of moving average, simple or exponential, and not plot 2 moving averages 8 and 55?
Nice coding!
English
English (UK)
English (IN)
Deutsch
Français
Español
Italiano
Polski
Türkçe
Русский
Português
Bahasa Indonesia
Bahasa Melayu
ภาษาไทย
Tiếng Việt

한국어

Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter