Kingii91

Need help changing this script to long only

ASX:ASL   None
Not sure how to fix this but i want to take all the short trades out as i believe this wil reduce the drawdown.

Any help would be greatly appreciated


//@version=2
strategy("MOMENTUM", overlay=true)

//RSI Section
length = input(2, "RSI Period")
overSold = input(30, "Oversold Level")
overBought = input(70, "Overbought Level")
price = close
vrsi = rsi (price, length)

//VSTOP Section
vlength = input(5)
mult = input(2)
atr_ = atr(5)
max1 = max(nz(max_), close)
min1 = min(nz(min_), close)
is_uptrend_prev = nz(is_uptrend, true)
stop = is_uptrend_prev ? max1 - mult * atr_ : min1 + mult * 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_ - mult * atr_ : min_ + mult * atr_ : vstop1
plot(vstop, color = is_uptrend ? green : red, style=circles, linewidth=2)

if vrsi > overBought
strategy.entry("Buy", strategy.long, comment="Buy")

if vrsi < overSold and vstop > price
strategy.entry("Sell", strategy.short, comment="Sell")
Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.