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 อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?