TradingView
ceyhun
6 cze 2019 11:45

Volatility Band Long Only Reversal Trading System 

Dow Jones Industrial Average IndexDJ

Opis

Volatility Band Long Only Reversal Trading System

Informacje o Wersji

bugs fixed

Informacje o Wersji

fix

Informacje o Wersji

v4 fix
Komentarze
speckles
Thanks for that, This is it updated to V4

//@version=4
study("Volatility Band Long Only Reversal Trading System", shorttitle="Volatility Band Reversal", overlay=true)

av = input(8, title="Band Average")
vp = input(13, title="Volatility Period")
df = input(3.55, title="Deviation Factor", minval=0.1)
lba = input(0.9, title="Lower Band Adjustment", minval=0.1)

src = hlc3
typical = src >= src[1] ? src - low[1] : src[1] - low
deviation = sum(typical, vp) / vp * df
devHigh = ema(deviation, av)
devLow = lba * devHigh
medianAvg = ema(src, av)

UpperBand = plot(ema(medianAvg, av) + devHigh, color=#EE82EE, linewidth=2, title="UpperBand")
LowerBand = plot(ema(medianAvg, av) - devLow, color=#EE82EE, linewidth=2, title="LowerBand")
MidLine = plot(sma(medianAvg, av), color=color.blue, title="MidLine")
up = ema(medianAvg, av) + devHigh
down = ema(medianAvg, av) - devLow

///Entry Rules
//1)First candle close below the Lower Band of the volatility Band
//2)Second candle close above the lower band
//3)Third Candle closes above the previous candle
Buy = close[2] < down[2] and close[1] > down[1] and close > close[1]
plotshape(Buy, "BUY", shape.labelup, location.belowbar, color.green, text="BUY", textcolor=color.black)
barcolor(close[2] < down[2] and close[1] > down[1] and close > close[1] ? color.blue : na)
bgcolor(close[2] < down[2] and close[1] > down[1] and close > close[1] ? color.green : na)

///Exit Rules
//1)One can have a static stops initially followed by an trailing stop based on the risk the people are willing to take
//2)One can exit with human-based decisions or predefined target exits. Choice of deciding the stop loss and profit targets are left to the readers.
Sell = close[2] > up[2] and close[1] < up[1] and close < close[1]
plotshape(Sell, "SELL", shape.labeldown, location.abovebar, color.red, text="SELL", textcolor=color.black)
barcolor(close[2] > up[2] and close[1] < up[1] and close < close[1] ? color.yellow : na)
bgcolor(close[2] > up[2] and close[1] < up[1] and close < close[1] ? color.red : na)

//Buyer = crossover(close,Buy)
//Seller = crossunder(close,Sell)
Buyer = Buy[1]
Seller =Sell[1]
alertcondition(Buyer, title="Buy Signal", message="Buy")
alertcondition(Seller, title="Sell Signal", message="Sell")
ceyhun
@speckles, thanks
yunnythinh
The indicator works very well.
Karthi056
Thanks for yours efforts and helping us 🙏
tiamo3733
Thank you for sharing. It's very useful.
ceyhun
@tiamo3733, thank you too
Więcej