4X4good

% Above/Below SMA

162 2 21
A simple script that calculates the percent above or below a moving average .
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
study("% Above/Below SMA")

//inputs
len=input(defval=200)

//vars
c=close
sma200=sma(close,len)
diff=((c-sma200)/c)*100

// horizontal linenp
hline(0)
//color the line
colr=diff  >0 ?  white : black
//plot
plot(diff,color=colr,linewidth=2,style=histogram)
jta3 PRO
8 months ago
Could be interesting to choose instruments, so there could be and overview with several instruments on same charts. :)
Reply
JohnKer PRO
4 months ago
Very interesting tool, so simple yet powerful. One suggestion: give it a better name.
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out