RicardoSantos

[RS]Trade System 002 Oscilator V1

EXPERIMENTAL: Multiple indicator Analysis
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

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.

Want to use this script on a chart?
study(title="[RS]Trade System 002 Oscilator V1", shorttitle="[RS]TS002O.V1", overlay=false)
//  ||---   Input:
useHA = input(true)
smooth = input(1)
src = avg(highest(max(open,close), 4), lowest(min(open,close), 4))//input(open)
//  ||---   Globals:
_s = useHA ? security(heikenashi(tickerid), period, src) : src
smooth_price = sma(_s, smooth)
transp_value = 90
//  ||---   Sequencer Signal
sequenceLimiter = 5
shortSequence = smooth_price < smooth_price[1] ? nz(shortSequence[1])+1 : 0
longSequence = smooth_price > smooth_price[1] ? nz(longSequence[1])+1 : 0
s_con = shortSequence > 0//(longSequence[1] >= sequenceLimiter and shortSequence > 0)
b_con = longSequence > 0//(shortSequence[1] >= sequenceLimiter and longSequence > 0)
SequenceSignal = b_con ? 1 : s_con ? -1 : 0
//  ||---   RSI Signal:
_rsi = rsi(smooth_price, 50)
s_con_01 = _rsi < 45
b_con_01 = _rsi > 55
RSISignal = b_con_01 ? 1 : s_con_01 ? -1 : 0
//  ||---   CCI Signal:
_cci = cci(smooth_price, 100)
s_con_02 = _cci < 0
b_con_02 = _cci > 0
CCISignal = b_con_02 ? 1 : s_con_02 ? -1 : 0
//  ||---   Momentum Signal:
_mom = mom(smooth_price, 50)
s_con_03 = _mom < 0
b_con_03 = _mom > 0
MOMSignal = b_con_03 ? 1 : s_con_03 ? -1 : 0
//  ||---   Fast MA oscilator Signal:
_fast_ma_str = smooth_price-sma(smooth_price, 12)
s_con_04 = _fast_ma_str < 0
b_con_04 = _fast_ma_str > 0
XMA1Signal = b_con_04 ? 1 : s_con_04 ? -1 : 0
//  ||---   Slow MA oscilator Signal:
_slow_ma_str = smooth_price-sma(smooth_price, 48)
s_con_05 = _slow_ma_str < 0
b_con_05 = _slow_ma_str > 0
XMA2Signal = b_con_05 ? 1 : s_con_05 ? -1 : 0
//  ||---   Track Fast/Slow Donchian:
_fast_HH = highest(smooth_price, 12)
_fast_LL = lowest(smooth_price, 12)
_slow_HH = highest(smooth_price, 48)
_slow_LL = lowest(smooth_price, 48)
b_con_06 = _fast_HH == _slow_HH
s_con_06 = _fast_LL == _slow_LL
DonchianSignal = b_con_06 ? 1 : s_con_06 ? -1 : 0
//  ||---   MACD Signals:
[_, _, MACDhist] = macd(smooth_price, 14, 34, 8)
MACDSignal = MACDhist > 0 ? 1 : MACDhist < 0 ? -1 : 0
//  ||---   Williams %R Signal:
upper = highest(100)
lower = lowest(100)
WILLR = 100 * (smooth_price - upper) / (upper - lower)
SmoothWR = sma(WILLR, 8)
WRSignal = SmoothWR > -50 ? +1 : SmoothWR < -50 ? -1 : 0
//  ||---   SAR Signal:
SAR = sar(0.03,0.01,0.2)
SARSignal = SAR < smooth_price ? 1 : -1
//  ||---
power1 = SequenceSignal + RSISignal + CCISignal + MOMSignal + XMA1Signal + XMA2Signal + DonchianSignal + MACDSignal + WRSignal + SARSignal
power = wma(power1, 4)
powerSignal = ema(power, 8)
signalHist = power-ema(power, 32)
plot(power, color=black, linewidth=2)
plot(powerSignal, color=purple, linewidth=2)
plot(signalHist, color=purple, style=histogram, linewidth=1)
plot(power1, color=gray, linewidth=1)
hline(0)
hline(10)
hline(-10)
powerColor = power >= 8 ? green : 
        power >= 5 and power < 8 ? lime : 
        power >= 1 and power < 5 ? olive : 
        power <= -1 and power > -5 ? orange : 
        power <= -5 and power > -8 ? red : 
        power <= -8 ? maroon : yellow
bgcolor(powerColor, transp=40)
barcolor(powerColor)