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
オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。

チャートでこのスクリプトを利用したいですか?
///@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)