OPEN-SOURCE SCRIPT
RSI MTF 15m + 1h (Oriol)

//version=5
indicator("RSI MTF 15m + 1h (Oriol)", overlay = false, timeframe = "", timeframe_gaps = true)
// ─── PARÀMETRES ─────────────────────────────────────────────
rsiLength = input.int(14, "Període RSI")
src = input.source(close, "Font de preu")
tfFast = input.timeframe("15", "Timeframe ràpid (RSI 15m)")
tfSlow = input.timeframe("60", "Timeframe lent (RSI 1h)")
showSignals = input.bool(true, "Mostrar senyals LONG/SHORT")
// ─── RSI MULTITIMEFRAME ────────────────────────────────────
// RSI del timeframe ràpid (per defecte 15m)
src_fast = request.security(syminfo.tickerid, tfFast, src)
rsi_fast = ta.rsi(src_fast, rsiLength)
// RSI del timeframe lent (per defecte 1h)
src_slow = request.security(syminfo.tickerid, tfSlow, src)
rsi_slow = ta.rsi(src_slow, rsiLength)
// ─── DIBUIX RSI ─────────────────────────────────────────────
plot(rsi_fast, title = "RSI ràpid (15m)", color = color.new(color.aqua, 0), linewidth = 2)
plot(rsi_slow, title = "RSI lent (1h)", color = color.new(color.orange, 0), linewidth = 2)
hline(70, "Sobrecomprat", color = color.new(color.red, 70), linestyle = hline.style_dashed)
hline(30, "Sobrevenut", color = color.new(color.lime, 70), linestyle = hline.style_dashed)
hline(50, "Mitja", color = color.new(color.gray, 80))
// ─── CONDICIONS D’EXEMPLE ───────────────────────────────────
// LONG: RSI 1h < 40 i RSI 15m creua cap amunt 30
// SHORT: RSI 1h > 60 i RSI 15m creua cap avall 70
longCond = (rsi_slow < 40) and ta.crossover(rsi_fast, 30)
shortCond = (rsi_slow > 60) and ta.crossunder(rsi_fast, 70)
// ─── SENYALS (SENSE SCOPE LOCAL) ────────────────────────────
plotshape(showSignals and longCond,
title = "Possible LONG",
style = shape.triangleup,
location = location.bottom,
color = color.new(color.lime, 0),
size = size.small,
text = "LONG")
plotshape(showSignals and shortCond,
title = "Possible SHORT",
style = shape.triangledown,
location = location.top,
color = color.new(color.red, 0),
size = size.small,
text = "SHORT")
// ─── ALERTES ────────────────────────────────────────────────
alertcondition(longCond, title = "Senyals LONG RSI 15m+1h",
message = "Condició LONG RSI 15m + 1h complerta")
alertcondition(shortCond, title = "Senyals SHORT RSI 15m+1h",
message = "Condició SHORT RSI 15m + 1h complerta")
indicator("RSI MTF 15m + 1h (Oriol)", overlay = false, timeframe = "", timeframe_gaps = true)
// ─── PARÀMETRES ─────────────────────────────────────────────
rsiLength = input.int(14, "Període RSI")
src = input.source(close, "Font de preu")
tfFast = input.timeframe("15", "Timeframe ràpid (RSI 15m)")
tfSlow = input.timeframe("60", "Timeframe lent (RSI 1h)")
showSignals = input.bool(true, "Mostrar senyals LONG/SHORT")
// ─── RSI MULTITIMEFRAME ────────────────────────────────────
// RSI del timeframe ràpid (per defecte 15m)
src_fast = request.security(syminfo.tickerid, tfFast, src)
rsi_fast = ta.rsi(src_fast, rsiLength)
// RSI del timeframe lent (per defecte 1h)
src_slow = request.security(syminfo.tickerid, tfSlow, src)
rsi_slow = ta.rsi(src_slow, rsiLength)
// ─── DIBUIX RSI ─────────────────────────────────────────────
plot(rsi_fast, title = "RSI ràpid (15m)", color = color.new(color.aqua, 0), linewidth = 2)
plot(rsi_slow, title = "RSI lent (1h)", color = color.new(color.orange, 0), linewidth = 2)
hline(70, "Sobrecomprat", color = color.new(color.red, 70), linestyle = hline.style_dashed)
hline(30, "Sobrevenut", color = color.new(color.lime, 70), linestyle = hline.style_dashed)
hline(50, "Mitja", color = color.new(color.gray, 80))
// ─── CONDICIONS D’EXEMPLE ───────────────────────────────────
// LONG: RSI 1h < 40 i RSI 15m creua cap amunt 30
// SHORT: RSI 1h > 60 i RSI 15m creua cap avall 70
longCond = (rsi_slow < 40) and ta.crossover(rsi_fast, 30)
shortCond = (rsi_slow > 60) and ta.crossunder(rsi_fast, 70)
// ─── SENYALS (SENSE SCOPE LOCAL) ────────────────────────────
plotshape(showSignals and longCond,
title = "Possible LONG",
style = shape.triangleup,
location = location.bottom,
color = color.new(color.lime, 0),
size = size.small,
text = "LONG")
plotshape(showSignals and shortCond,
title = "Possible SHORT",
style = shape.triangledown,
location = location.top,
color = color.new(color.red, 0),
size = size.small,
text = "SHORT")
// ─── ALERTES ────────────────────────────────────────────────
alertcondition(longCond, title = "Senyals LONG RSI 15m+1h",
message = "Condició LONG RSI 15m + 1h complerta")
alertcondition(shortCond, title = "Senyals SHORT RSI 15m+1h",
message = "Condició SHORT RSI 15m + 1h complerta")
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.