MACD sur RSI

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #244407 quote
    BatesonBateson
    Participant
    Junior

    Bonjour,
    Pourriez vous m’aider à traduire le code ci-dessous issu de Trading view ?
    Il s’agit d’appliquer une MACD sur le RSI. Je met la photo du résultat.
    L’indicateur existe par défaut sur l’application smartphone de Trading View et est très pratique.
    Avec mes remerciements

    // © l_lonthoff
    //@version=5
    indicator(title="MACD on RSI", shorttitle="MACD on RSI", format=format.price, precision=2, timeframe="", timeframe_gaps=true)
    
    rsiLengthInput = input.int(15, minval=1, title="RSI Length", group="RSI Settings")
    rsiSourceInput = input.source(close, "Source", group="RSI Settings")
    maLengthInput = input.int(14, title="MA Length (slow)", group="MA Settings", display = display.status_line)
    ma2LengthInput = input.int(20, title="MA Length (fast)", group="MA Settings", display = display.status_line)
    
    rsi = ta.rsi(rsiSourceInput,rsiLengthInput)
    rsiMA = ta.ema(ta.ema(rsi,maLengthInput), maLengthInput)
    rsiMA2 = ta.ema(ta.ema(rsi,ma2LengthInput), ma2LengthInput)
    
    MACDh = rsiMA - rsiMA2 
    MACDhcolor =  (MACDh >= 0 ? (MACDh[1] < MACDh ? #26A69A : #B2DFDB) : (MACDh[1] < MACDh ? #FFCDD2 : #FF5252))
    
    plot(MACDh, color = MACDhcolor, style = plot.style_columns, display = display.pane + display.price_scale)
    plot(rsiMA-50, "RSI-based MA", color=color.rgb(255, 59, 150), display = display.pane + display.price_scale)
    plot(rsiMA2-50, "RSI-based MA", color=color.rgb(59, 105, 255), display = display.pane + display.price_scale)
    
    midline = hline(50, "RSI Middle Band", color=color.new(#787B86, 50))
    
    
    Capture-decran-2025-02-27-124834.png Capture-decran-2025-02-27-124834.png
    #244456 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Vous êtes ici.

    rsiLengthInput = 15 // RSI Length
    rsiSourceInput = close // Source
    maLengthInput = 14 // MA Length (slow)
    ma2LengthInput = 20 // MA Length (fast)
     
    myrsi = rsi[rsiLengthInput](rsiSourceInput)
    rsiMA = average[maLengthInput,1](average[maLengthInput,1](myrsi))
    rsiMA2 = average[ma2LengthInput,1](average[ma2LengthInput,1](myrsi))
     
    MACDh = rsiMA - rsiMA2
    
    if MACDh >= 0 then
    if MACDh[1]<MACDh then
    r=38
    g=166
    b=154
    else
    r=178
    g=223
    b=219
    endif
    else
    if MACDh[1]<MACDh then
    r=255
    g=205
    b=210
    else
    r=255
    g=82
    b=82
    endif 
    endif
    return MACDh coloured(r,g,b)style(histogram), rsiMA-50 as "RSI-based MA"coloured(255, 59, 150),rsiMA2-50 as "RSI-based MA"coloured(59, 105, 255)
    #244464 quote
    BatesonBateson
    Participant
    Junior

    Bonjour Ivan
    Encore une fois un très grand merci pour votre proposition.
    Vraiment du travail propre !
    Belle fin de journée

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

MACD sur RSI


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Bateson @bateson Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by BatesonBateson
1 year, 6 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 02/27/2025
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...