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 de código aberto

Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no gráfico?
//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)