repo32

Moving Average Colored EMA/SMA

This script will give you the ability to put an EMA and/or SMA on the chart that changes color based upon the direction. Default at startup is EMA visible and SMA hidden. When the MA is moving up, it is green. When the MA is moving down, it is red. You can change the color to whatever you like.
Gỡ bỏ khỏi Script Ưa thích Thêm vào Script Ưa thích
//Created by Robert Nance on 072315
study(title="Moving Average Colored EMA/SMA", shorttitle="Colored EMA /SMA", overlay=true)
emaplot = input (true, title="Show EMA on chart")
len = input(8, minval=1, title="ema Length")
src = close
out = ema(src, len)
up = out > out[1]
down = out < out[1]
mycolor = up ? green : down ? red : blue
plot(out and emaplot ? out :na, title="EMA", color=mycolor, linewidth=3)


smaplot = input (false, title="Show SMA on chart")
len2 = input(8, minval=1, title="sma Length")
src2 = close
out2 = sma(src2, len2)
up2 = out2 > out2[1]
down2 = out2 < out2[1]
mycolor2 = up2 ? green : down2 ? red : blue
plot(out2 and smaplot ? out2 :na , title="SMA", color=mycolor2, linewidth=1)
I have had a lot of questions about setting up an alert for this indicator. I was able to have it work for me with BTC. Settings: Colored EMA , Moving Up, 1.00 in 2 bars. Gave alert when changed from red to green. Reverse would be true for moving from green to red.
Phản hồi
a63812 repo32
@repo32, Hi! your indicator is awesome! Could you please confirm what would be the "reverse" setup be, for when the EMA changes from green to red?

I tried to put: Moving down 1.00, but it doesn't work, and it doesn't let me put -1 or 0.

Thanks a lot!
Phản hồi
repo32 a63812
@a63812, Just change the alert to green to red. The movement is still up for both arguments.
Phản hồi
a63812 repo32
@repo32, Thanks for your reply. Sorry, I'm new to Tradingview, how do I "change the alert to green to red" in the new alert window? There is not a box that allows to alert by colour in the alert window.
Phản hồi
repo32 a63812
@a63812, Just tried playing with it. Looks like it is not possible anymore on this one. Sorry.
Phản hồi
Great indicator.. Does anyone know how to somehow screen for this indicator?
Phản hồi
Great thanks so much!
In addition I would like to get the same type of colored EMA applied not only on charts, but also on indicators (for example, I wish to do it for an EMA of a stochastic or of a MACD zero lag).
Could you help me to get it ?

Thanks in advance,
Phil
Phản hồi
@ebly, Just right click on the indicator (i.e. Stochastic) and "apply indicator on Stochastic"
Phản hồi
This is really great, thanks for making it available.

I'm trying to apply the idea to this HPotter's ADV Line indicator, but can't figure it out. Any chance you could help?
This is the code:

study(title="Advance/Decline Volume Line", shorttitle="ADV Line", overlay = false)
AdvSymbolVolume = input(title="Advancing Volume Symbol", type=symbol, defval="USI:UVOL")
DecSymbolVolume = input(title="Declining Volume Symbol", type=symbol, defval="USI:DVOL")
Resolutin = input(title="Resolution", type=resolution, defval="D")
xASVValue = security(AdvSymbolVolume, Resolutin, close)
xDSVValue = security(DecSymbolVolume, Resolutin, close)
NetADV = xASVValue - xDSVValue
nRes = nz(nRes, 0) + NetADV
plot(nRes, color=green, title="ADV Line", style=line)

Many thanks in advance.
+2 Phản hồi
Trang chủ Bộ lọc cổ phiếu Bộ lọc Forex Bộ lọc Tiền điện tử Lịch kinh tế Shows Cách thức hoạt động Tính năng Biểu đồ Giá Quy tắc Áp dụng Người điều hành Giải pháp cho Website & Nhà môi giới Widget Giải pháp biểu đồ Thư viện Biểu đồ Lightweight Trung tâm Trợ giúp Giới thiệu bạn Yêu cầu tính năng Blog & Tin tức Câu hỏi thường gặp Wiki Twitter
Hồ sơ Tùy chỉnh Hồ sơ Tài khoản và Thanh toán Giới thiệu bạn Ticket Hỗ trợ của tôi Trung tâm Trợ giúp Các ý tưởng đã đăng Người theo dõi Đang theo dõi Tin nhắn riêng Trò chuyện Đăng xuất