ShirokiHeishi

Trend v4.0 Another update

96
Yet another update, default settings can be customized to your needs. Be aware that while this is similar to the other versions, this can only repaint an active bar, but that slows it down by one period. You are warned. Be that as it may, the basic idea is the same; trying to capture the really strong moves into overbought or oversold territory as defined by Relative Strength index. In RSI mode, you can see the smoothing has slowed it down a bit, but warrants backtesting.
First green bar go long, First red bar go short, first white bar possible trend exhaustion. Or use crossovers and such, play with the inputs OB/OS, RSI length, signal length, tick length, swing length, as I said customize to your tastes. I offer no surety as to its efficacy, but we all learn.
Trade Responsibly,
Shiroki
Skrip open-source

Dalam semangat TradingView, penulis dari skrip ini telah mempublikasikannya ke sumber-terbuka, maka trader dapat mengerti dan memverifikasinya. Semangat untuk penulis! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.

Inggin menggunakan skrip ini pada chart?
///@version=2
//norepaint
study("Trend v4.0", overlay=true)
overlay = input(false, title="Show Trend Color?")
mode    = input(false, title="RSI mode?")
Period  = input(4, title="Length")
Period2 = input(10, title="Signal")
src     = input(ohlc4, title="Source", type=source)
up      = security(tickerid,period,rma(max(change(src), 0), Period),false)
down    = security(tickerid,period,rma(-min(change(src), 0), Period),false)
rsi     =  ema(down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)),Period2)
OB      = input(50)
OS      = input(50)
trend   = rsi>wma(rsi,Period2) and rsi>=OB?teal:rsi<wma(rsi,Period2) and rsi<=OS?maroon:na
trendid = rsi>wma(rsi,Period2) and rsi>=OB?1:rsi<wma(rsi,Period2)  and rsi<=OS?-1:0
p1      = input(defval=3,minval=2,title="Up length")
p2      = input(defval=3,minval=2, title="Down length")
p3      = input(8, title="Swing threshold", minval=0)
cross_s = cross(sma(hlc3,p1) , sma(hlc3,p2)[1])
tick = barssince(cross_s)
barcolor(overlay?trend:na, color=trend)
rsio    = rsi>=OB?rsi:rsi<=OS?rsi:na
plotshape(tick>=p3?tick:na, style=shape.square, color=white, transp=0, location=location.bottom)
plotshape(trendid==1?trendid:na, style=shape.square, color=tick>=p3?white:teal, location=location.bottom, transp=0)
plotshape(trendid==-1?trendid:na,style=shape.square, color=tick>=p3?white:maroon,location=location.bottom, transp=0)
plot(mode?rsi:na, color=white,linewidth=2, transp=0)
plot(mode?wma(rsi,Period2):na, color=maroon,linewidth=2, transp=0)
plot(mode?OB:na, color=#2F4F4F, transp=0)
plot(mode?OS:na, color=#2F4F4F, transp=0)