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
Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?
///@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)