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

Skript med en öppen källkod

I sann TradingView-anda har författaren publicerat detta skript med öppen källkod så att andra handlare kan förstå och verifiera det. Hatten av för författaren! Du kan använda det gratis men återanvändning av den här koden i en publikation regleras av våra ordningsregler. Du kan ange den som favorit för att använda den i ett diagram.

Frånsägelse av ansvar

Informationen och publikationerna är inte avsedda att vara, och utgör inte heller finansiella, investerings-, handels- eller andra typer av råd eller rekommendationer som tillhandahålls eller stöds av TradingView. Läs mer i Användarvillkoren.

Vill du använda det här skriptet i ett diagram?
//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)