ChrisMoody

CM Percent Move Lower V1

CM Percent Move Lower V1

Created by ChrisMoody on 9/3/2014 by Request from vlad.adrian

**Plots the percent move based on the Close of Bar Compared to the Close of Previous Bar

**If Bar closes Up then Histogram is Green, If Bar Closes Down Histogram is Red.

**Ability to Show/Hide Background Highlights, Horizontal Lines, % Histogram, and SMA of Percent Moves

Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?
//Created by ChrisMoody on 9/3/2014 by Request from vlad.adrian
//Plots the percent move based on the close of Bar based on close of Previous Bar
//If Bar closes up then histogram is Green, If Bar Closes Down Histogram is Red.
//Ability to Show/Hide Background Highlights, Horizontal Lines, and SMA of Percent Moves
study("CM_Percent_Move_Lower", overlay=false)
sbh = input(true, title="Show Background Highlights?")
sl = input(true, title="Show Horizontal Lines?")
sh = input(true, title="Show % Move Histogram?")
len = input(50, title="Look Back Period for SMA")
shsma = input(true, title="Show Simple Moving Average of % Moves?")
//Percent Calculations
diff = close-close[1]
pct = abs(diff/close)*100
pctsma = sma(pct, len)
//BackGround Color Definitions
rlpct = pct < .5
lpct = pct >= .5 and pct < 1
mpct = pct >= 1 and pct < 1.5
hpct = pct >= 1.5 and pct < 2
rhpct = pct >= 2
//BackGround Color Plots
bgcolor(sbh and rlpct ? silver : na, transp=80)
bgcolor(sbh and lpct ? gray : na, transp=50)
bgcolor(sbh and mpct ? yellow : na, transp=50)
bgcolor(sbh and hpct ? orange : na, transp=50)
bgcolor(sbh and rhpct ? fuchsia : na, transp=40)
//Color of Histogram...Positive Close = Green...Close Down = Red...
col = close < close[1] ? red : close > close[1] ? lime : yellow
//Plot Statements
plot(sh and pct ? pct : na, title="Percentage Move", style=histogram, linewidth=4, color=col)
plot(shsma and pctsma ? pctsma : na, title="SMA of % Moves", style=circles, linewidth=3, color=aqua)
plot(sl and .5 ? .5 : na, title=".5% Line", style=line, linewidth=2, color=gray)
plot(sl and 1 ? 1 : na, title=".5% Line", style=line, linewidth=2, color=yellow)
plot(sl and 1.5 ? 1.5 : na, title=".5% Line", style=line, linewidth=3, color=orange)
plot(sl and 2 ? 2 : na, title=".5% Line", style=line, linewidth=4, color=fuchsia)