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")
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.