Convert tradingview Volatility stop to EasyLanguage


0
0

Hello Pete. Is it possible to convert this script to an easyscript? Its a volatility stop study that plots red dots above price bars in case of a downtrend and green dots under price bars in case of an uptrend. Its great for placing your stops.

 

study(“Volatility Stop”, shorttitle=”VStop”, overlay=true)
length = input(20)
mult = input(2)
atr_ = atr(length)
max1 = max(nz(max_[1]), close)
min1 = min(nz(min_[1]), close)
is_uptrend_prev = nz(is_uptrend[1], true)
stop = is_uptrend_prev ? max1 – mult * atr_ : min1 + mult * atr_
vstop_prev = nz(vstop[1])
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_ – mult * atr_ : min_ + mult * atr_ : vstop1
plot(vstop, color = is_uptrend ? green : red, style=cross, linewidth=2)

 

 

 

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on June 30, 2020 4:37 pm
19 views
0
Private answer

Sorry but I cannot complete this in the brief amount of time I have available for free solutions in the Q&A forum.

Marked as spam
Posted by (Questions: 38, Answers: 3345)
Answered on July 1, 2020 11:26 am