pr0nster

Volatility Sars

pr0nster 업데이트됨   
This script makes use of volatility stop in combination with parabolic sars and price over/under sma to visualize market conditions. I originally wrote it because I wanted something i could zoom all the way out with and easily get an idea at a glance which direction a market is headed. Try it, let me know what you think. Feedback is greatly appreciated!

Usage: Buy the red, sell the green
릴리즈 노트:
I *believe* I fixed my formula. There is no logic for backtesting at the moment.
릴리즈 노트:
flipped the arrows around.. green up arrows for buy.. red down arrows for sell, instead of vice versa.... heres the code for the script. if you guys make any changes and find them more suitable for you then feel free to share!

its not top secret, im not sure why i did not make it open... but heres the source anyways


//@version=3
study("Volatility Sars" , shorttitle="vsars_strat",overlay=true)

//---------- vstop --------------
vlength = input(50)
vmult = input(2)
atr_ = atr(vlength)

max1=0.0
min1=0.0
is_uptrend_prev = false
stop=0.0
vstop_prev=0.0
vstop1=0.0
is_uptrend=false
is_trend_changed=false
max_ = 0.0
min_ = 0.0
vstop=0.0

max1 := max(nz(max_), close)
min1 := min(nz(min_), close)


is_uptrend_prev := nz(is_uptrend, true)

stop := is_uptrend_prev ? max1 - vmult * atr_ : min1 + vmult * atr_
vstop_prev := nz(vstop)
vstop1 := is_uptrend_prev ? max(vstop_prev, stop) : min(vstop_prev, stop)
is_uptrend := close - vstop1 >= 0
is_trend_changed := is_uptrend != is_uptrend_prev
max_ := is_trend_changed ? close : max1
min_ := is_trend_changed ? close : min1
vstop := is_trend_changed ? is_uptrend ? max_ - vmult * atr_ : min_ + vmult * atr_ : vstop1
codiff = vstop - close
sarcolor = codiff < 0 ? red : green

//----------- psars ---------------------
start = input(0.015)
increment = input(0.015)
maximum = input(0.12)
out = sar(start, increment, maximum)

//----------- sma -----------------
sma = sma(close,20)

//----------- roc -----------------
source = close, length = input(3, minval=1)
roc = 100 * (source - source)/source
coroc = (codiff * 1) * roc

plotarrow(coroc, colorup = green, colordown = red, transp=40, minheight = 10, maxheight = 15,offset=1)
plot(out, color=sarcolor, style=circles, linewidth=3)
smap = plot(sma,color=(sma < ohlc4 ? green : red),linewidth=2,offset=-1)
ol = plot(open,color=(sma < ohlc4 ? green : red), linewidth=2,offset=-1)
fill(smap,ol)
보호된 스크립트입니다
이 스크립트는 클로즈 소스로 게시되며 자유롭게 사용할 수 있습니다. 당신은 스크립트를 차트에 사용하기 위해 그것을 즐겨찾기 할 수 있습니다. 소스 코드는 보거나 수정할 수 없습니다.
면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?