convertire l’indicateur trader xo Macro Trend Scanner

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #245768 quote
    Samir pluquin
    Participant
    New

    Bonjour,

    pouvez vous traduire cette indicateur ci dessous svp :

    // Paramètres
    indicator(“[@btc_charlie] Trader XO Macro Trend Scanner”, shorttitle=”XO Trend”, overlay=true)
    
    // Variables
    src = close // Source (type de prix)
    i_fastEMA = 12 // Fast EMA
    i_slowEMA = 25 // Slow EMA
    i_defEMA = 25 // Consolidated EMA
    
    // Calcul des EMAs
    v_fastEMA = ExponentialAverage(src, i_fastEMA)
    v_slowEMA = ExponentialAverage(src, i_slowEMA)
    v_biasEMA = ExponentialAverage(src, i_defEMA)
    
    // Définir la couleur des EMAs
    emaColor = (v_fastEMA > v_slowEMA) ? Green : (v_fastEMA < v_slowEMA) ? Red : Orange // Affichage des EMAs if (i_fastEMA > 0) then
    Plot(v_fastEMA, “Fast EMA”, emaColor)
    if (i_slowEMA > 0) then
    Plot(v_slowEMA, “Slow EMA”, emaColor)
    if (i_defEMA > 0) then
    Plot(v_biasEMA, “Consolidated EMA”, emaColor)
    
    // Condition d’achat et de vente
    buyCondition = (v_fastEMA > v_slowEMA)
    sellCondition = (v_fastEMA < v_slowEMA) 
    // Logique pour comptabiliser les signaux 
    countBuy = 0 
    countSell = 0 
    if (buyCondition) then 
    countBuy = countBuy + 1 
    countSell = 0 endif 
    if (sellCondition) then 
    countSell = countSell + 1 
    countBuy = 0 
    endif 
    // Signaux d'achat et de vente 
    buySignal = (countBuy < 2) AND (countBuy > 0) AND (countSell < 1) AND buyCondition AND NOT buyCondition[1] 
    sellSignal = (countSell > 0) AND (countSell < 2) AND (countBuy < 1) AND sellCondition AND NOT sellCondition[1] 
    // Colorier les barres 
    if (buySignal) then 
    SetBarColor(Green) 
    endif 
    if (sellSignal) then 
    SetBarColor(Red) 
    endif 
    // Affichage des formes pour les signaux Bull/Bear 
    if (buySignal) then 
    PlotArrowUp("Bull", color=Green) 
    endif 
    if (sellSignal) then 
    PlotArrowDown("Bear", color=Red) 
    endif 
    // Alertes 
    AlertWhen(crossover(v_fastEMA, v_slowEMA), "Bullish EMA Cross", "Bullish EMA crossover") 
    AlertWhen(crossunder(v_fastEMA, v_slowEMA), "Bearish EMA Cross", "Bearish EMA crossover") 
    
    // Stochastic RSI 
    smoothK = 3 
    smoothD = 3 
    lengthRSI = 14 
    lengthStoch = 14 
    rsi1 = RSI(src, lengthRSI) 
    k = SimpleAverage(Stochastic(rsi1, rsi1, rsi1, lengthStoch), smoothK) 
    d = SimpleAverage(k, smoothD) 
    // Bandes du Stoch RSI 
    bandno0 = 80 
    bandno1 = 20 
    bandno2 = 50 
    // Alertes Stoch RSI 
    crossupAlert = (crossover(k, d)) AND (k < bandno2 OR d < bandno2) 
    crossdownAlert = (crossunder(k, d)) AND (k > bandno2 OR d > bandno2)
    crossupOSAlert = (crossover(k, d)) AND (k < bandno1 OR d < bandno1) 
    crossdownOBAlert = (crossunder(k, d)) AND (k > bandno0 OR d > bandno0)
    
    // Couleur de fond pour les alertes
    if (crossupAlert) then
    SetBackgroundColor(Green)
    endif
    if (crossdownAlert) then
    SetBackgroundColor(Red)
    endif
    
    if (crossupOSAlert) then
    SetBackgroundColor(Orange)
    endif
    if (crossdownOBAlert) then
    SetBackgroundColor(Black)
    endif
    
    // Alertes de croisement
    AlertWhen(crossupAlert OR crossdownAlert, “Stoch RSI Crossover”, “Stoch RSI crossover”)
    #245774 quote
    Iván González
    Moderator
    Master
    //------------------------------------------------//
    //PRC_Macro trend scanner
    //version = 0
    //10.04.2025
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //------------------------------------------------//
    // Inputs
    //------------------------------------------------//
    src=close
    ifastema=12
    islowema=25
    idefema=50
    
    smoothK = 3
    smoothD = 3
    lengthRSI = 14
    lengthStoch = 14
    
    OS=20
    OB=80
    MD=50
    //------------------------------------------------//
    // Calculations
    //------------------------------------------------//
    // Moving averages
    vfastema=average[ifastema,1](src)
    vslowema=average[islowema,1](src)
    vbiasema=average[idefema,1](src)
    // Stochastic Rsi 
    rsi1=rsi[lengthRSI](src)
    maxrsi=highest[lengthStoch](rsi1)
    minrsi=lowest[lengthStoch](rsi1)
    osc=(rsi1-minrsi)/(maxrsi-minrsi)*100
    k=average[smoothK](osc)
    d=average[smoothD](k)
    //------------------------------------------------//
    // Color
    //------------------------------------------------//
    if vfastema>vslowema then
    r=0
    g=255
    b=0
    elsif vfastema<vslowema then
    r=255
    g=0
    b=0
    else
    r=124
    g=124
    b=124
    endif
    //------------------------------------------------//
    // Signals
    //------------------------------------------------//
    buySignal = vfastema crosses over vslowema
    sellSignal = vfastema crosses under vslowema
    
    drawcandle(open,high,low,close)coloured(r,g,b)
    
    if buySignal then
    drawarrowup(barindex,low)coloured("green")
    elsif sellsignal then
    drawarrowdown(barindex,high)coloured("red")
    endif
    //------------------------------------------------//
    // Stochastic RSI Alerts
    //------------------------------------------------//
    
    crossupAlert = (k crosses over d) AND (k < MD OR d < MD)
    crossdownAlert = (k crosses under d) AND (k > MD OR d > MD)
    
    crossupOSalert=k crosses over d and (k<OS or d<OS) 
    crossdownOBalert=k crosses under d and (k>OB or d>OB)
    //------------------------------------------------//
    // Background
    //------------------------------------------------//
    if crossupAlert then
    BackgroundColor("Green",30)
    endif
    if (crossdownAlert) then
    BackgroundColor("Red",30)
    endif
    
    if (crossupOSAlert) then
    BackgroundColor("Orange",30)
    endif
    if (crossdownOBAlert) then
    BackgroundColor("Black",30)
    endif
    //------------------------------------------------//
    return vfastema as "Fast EMA" coloured(r,g,b),vslowema as "Slow EMA"coloured(r,g,b),vbiasema as "Consolidates EMA"coloured(r,g,b)
    Samir pluquin thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

convertire l’indicateur trader xo Macro Trend Scanner


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Iván González
10 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 04/09/2025
Status: Active
Attachments: No files
Logo Logo
Loading...