Domanda e offerta

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #255195 quote
    Ciccarelli FrancoCiccarelli Franco
    Participant
    Senior

    Questo indicatore MTF mi sembra semplice ed efficace.

    Si può tradurlo?

    https://it.tradingview.com/script/QBxIIcvW-Supply-Demand-MTF-x3-Input-TF/

    #255308 quote
    Iván GonzálezIván González
    Moderator
    Legend
    Ciao. Vedo che l'indicatore non è disponibile.
    Captura-de-pantalla-2026-01-15-091851.jpg Captura-de-pantalla-2026-01-15-091851.jpg
    #255314 quote
    jacquesgermainjacquesgermain
    Participant
    Veteran
    hello voici le script Pine Script® // @version= 6 indicateur ( “Offre et demande MTF x3 (TF d’entrée)” , superposition = vrai , nombre_max_de_boîtes = 300 ) //────────────────────────────── // CONSTANTES //────────────────────────────── OFFRE = 1 DEMANDE = -1 //────────────────────────────── // PARAMÈTRES COMMUNS //────────────────────────────── groupe_commun = “Paramètres communs” leftBars = input.int ( 9 , “Swing left bars” , minval = 2 , group = group_common ) rightBars = input.int ( 9 , “Faire pivoter les barres vers la droite” , minval = 2 , group = group_common ) minZoneSize = input.float ( 0.01 , “Taille minimale de la zone %” , minval = 0.01 , step = 0.01 , group = group_common ) maxSupplyZones = input.int ( 1 , “Max Supply Zones” , minval = 1 , group = group_common ) maxDemandZones = input.int ( 1 , “Zones de demande maximale” , minval = 1 , group = group_common ) //────────────────────────────── // FONCTIONS //────────────────────────────── f_zoneSizePct ( haut , bas ) => ( haut – bot ) / (( haut + bot ) / 2 ) * 100 f_drawBox ( leftTime , top , bot , fillCol , borderCol , borderW ) => boîte.nouvelle ( gauche = tempsgauche , droit = ​​temps , haut = haut , bas = bot , xloc = xloc.bar_time , couleur_fond = remplirColonne , couleur_bordure = couleur_bordure , largeur_bordure = largeur_bordure ) f_updateBoxes ( arr , zoneType ) => si array.size ( arr ) > 0 b = tableau.last ( arr ) boîte.set_right ( b , temps ) si ( zoneType == SUPPLY et close > box.get_top ( b )) ou ( zoneType == DEMANDE et close [ ph , phTime ] = requête.sécurité ( syminfo.tickerid , tf , [ ta.pivothigh ( haut , barres de gauche , barres de droite ) , temps [ barres de droite ]] ) [ pl , plTime ] = requête.sécurité ( syminfo.tickerid , tf , [ ta.pivotlow ( low , leftBars , rightBars ) , heure [ rightBars ] ) si showS et non na ( ph ) haut = ph bot = math.max ( requête.sécurité ( syminfo.tickerid , tf , ouvrir [ rightBars ]) , requête.sécurité ( syminfo.tickerid , tf , fermer [ rightBars ]) ) si f_zoneSizePct ( haut , bas ) >= minZoneSize b = f_drawBox ( phTime , top , bot , sFill , sBorder , bw ) tableau.push ( sArr , b ) tant que la taille du tableau ( sArr ) > maxSupplyZones boîte.supprimer ( tableau.décalage ( sArr )) si showD et non sur ( pl ) bot = pl haut = math.min ( requête.sécurité ( syminfo.tickerid , tf , ouvrir [ rightBars ]) , requête.sécurité ( syminfo.tickerid , tf , fermer [ rightBars ]) ) si f_zoneSizePct ( haut , bas ) >= minZoneSize b = f_drawBox ( plTime , top , bot , dFill , dBorder , bw ) tableau.push ( dArr , b ) tant que la taille du tableau ( dArr ) > maxDemandZones boîte.supprimer ( tableau.décalage ( dArr )) f_updateBoxes ( sArr , SUPPLY ) f_updateBoxes ( dArr , DEMANDE ) //────────────────────────────── // EXÉCUTION //────────────────────────────── f_processTF ( tf1 , showS1 , showD1 , sFill1 , sBorder1 , dFill1 , dBorder1 , bw1 , supply1 , demand1 ) f_processTF ( tf2 , showS2 , showD2 , sFill2 , sBorder2 , dFill2 , dBorder2 , bw2 , supply2 , demand2 ) f_processTF ( tf3 , showS3 , showD3 , sFill3 , sBorder3 , dFill3 , dBorder3 , bw3 , supply3 , demand3 )
    robertogozzi thanked this post
    #255344 quote
    Ciccarelli FrancoCiccarelli Franco
    Participant
    Senior
    Grazie, allora si può tradurre.
    #255345 quote
    JSJS
    Participant
    Master
    Forse dovresti ringraziare prima le persone per le precedenti 106 conversioni…
    #257588 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Ecco l’indicatore:

    // ---------------------------------------------------------
    // PRC_Supply & Demand MTF x3
    // version = 1
    // 06.02.2025
    // Iván González @ www.prorealcode.com
    // Sharing ProRealTime knowledge
    // ---------------------------------------------------------
    // TF0 = Base timeframe of the chart (the one you have open)
    // TF1 = 1 hour (to change: modify TIMEFRAME(1 hour))
    // TF2 = 4 hours (to change: modify TIMEFRAME(4 hours))
    // IMPORTANT: Apply the indicator on a timeframe lower than TF1.
    // Example: if TF1=1H and TF2=4H, use on charts from 1min to 30min.
    // ---------------------------------------------------------
    // TIMEFRAME RATIOS (adjust according to base TF):
    //   Base TF 1min:  ratioTF1=60,  ratioTF2=240
    //   Base TF 5min:  ratioTF1=12,  ratioTF2=48
    //   Base TF 15min: ratioTF1=4,   ratioTF2=16
    //   Base TF 30min: ratioTF1=2,   ratioTF2=8
    // NOTE: Ratios are approximate. For assets with gaps (stocks),
    // rectangles may not align perfectly with pivot candles.
    // ---------------------------------------------------------
    defparam drawonlastbaronly = true
    // ---------------------------------------------------------
    // --- PARAMETERS (editable) ---
    // ---------------------------------------------------------
    leftBars = 9
    rightBars = 9
    minZonePct = 0.01 // Minimum zone size in %
    rightExt = 10     // Visual extension to the right (future bars)
    
    // Ratios to calculate barindex offset for higher TFs
    ratioTF1 = 12  // Ratio TF1/TFbase (e.g.: 1H/5min = 12)
    ratioTF2 = 48  // Ratio TF2/TFbase (e.g.: 4H/5min = 48)
    
    // ---------------------------------------------------------
    // INITIALIZATION
    // ---------------------------------------------------------
    // TF0 (base) - Supply
    ONCE sTopTF0 = 0
    ONCE sBotTF0 = 0
    ONCE sLocTF0 = 0
    ONCE sOnTF0 = 0
    // TF0 (base) - Demand
    ONCE dTopTF0 = 0
    ONCE dBotTF0 = 0
    ONCE dLocTF0 = 0
    ONCE dOnTF0 = 0
    // TF0 - Previous detection flags
    ONCE phPrevTF0 = 0
    ONCE plPrevTF0 = 0
    
    // TF1 (1 hour) - Supply
    ONCE sTopTF1 = 0
    ONCE sBotTF1 = 0
    ONCE sLocTF1 = 0
    ONCE sOnTF1 = 0
    // TF1 (1 hour) - Demand
    ONCE dTopTF1 = 0
    ONCE dBotTF1 = 0
    ONCE dLocTF1 = 0
    ONCE dOnTF1 = 0
    // TF1 - Previous detection flags
    ONCE phPrevTF1 = 0
    ONCE plPrevTF1 = 0
    
    // TF2 (4 hours) - Supply
    ONCE sTopTF2 = 0
    ONCE sBotTF2 = 0
    ONCE sLocTF2 = 0
    ONCE sOnTF2 = 0
    // TF2 (4 hours) - Demand
    ONCE dTopTF2 = 0
    ONCE dBotTF2 = 0
    ONCE dLocTF2 = 0
    ONCE dOnTF2 = 0
    // TF2 - Previous detection flags
    ONCE phPrevTF2 = 0
    ONCE plPrevTF2 = 0
    
    // ---------------------------------------------------------
    // TF0: BASE TIMEFRAME
    // ---------------------------------------------------------
    
    // --- Pivot High (3 conditions) ---
    phDetTF0 = 0
    IF barindex >= leftBars + rightBars THEN
       IF highest[rightBars](high)  highest[leftBars](high)[rightBars + 1] THEN
          phDetTF0 = 1
       ENDIF
    ENDIF
    
    // --- New Supply zone TF0 (only on 0->1 transition) ---
    IF phDetTF0 = 1 AND phPrevTF0 = 0 THEN
       zTop = high[rightBars]
       zBot = max(open[rightBars], close[rightBars])
       IF zTop > zBot AND zTop > 0 THEN
          zPct = (zTop - zBot) / ((zTop + zBot) / 2) * 100
          IF zPct >= minZonePct THEN
             sTopTF0 = zTop
             sBotTF0 = zBot
             sLocTF0 = barindex - rightBars
             sOnTF0 = 1
          ENDIF
       ENDIF
    ENDIF
    phPrevTF0 = phDetTF0
    
    // --- Pivot Low (3 conditions) ---
    plDetTF0 = 0
    IF barindex >= leftBars + rightBars THEN
       IF lowest[rightBars](low) > low[rightBars] AND low[rightBars] 1 transition) ---
    IF plDetTF0 = 1 AND plPrevTF0 = 0 THEN
       zTop = min(open[rightBars], close[rightBars])
       zBot = low[rightBars]
       IF zTop > zBot AND zBot > 0 THEN
          zPct = (zTop - zBot) / ((zTop + zBot) / 2) * 100
          IF zPct >= minZonePct THEN
             dTopTF0 = zTop
             dBotTF0 = zBot
             dLocTF0 = barindex - rightBars
             dOnTF0 = 1
          ENDIF
       ENDIF
    ENDIF
    plPrevTF0 = plDetTF0
    
    // --- Invalidation TF0 ---
    IF sOnTF0 = 1 AND close > sTopTF0 THEN
       sOnTF0 = 0
    ENDIF
    IF dOnTF0 = 1 AND close < dBotTF0 THEN
       dOnTF0 = 0
    ENDIF
    
    // ---------------------------------------------------------
    // TF1: 1 HOUR
    // ---------------------------------------------------------
    
    TIMEFRAME(1 hour)
    
    // --- Pivot High TF1 ---
    phDetTF1 = 0
    IF highest[rightBars](high)  highest[leftBars](high)[rightBars + 1] THEN
       phDetTF1 = 1
       phHighTF1 = high[rightBars]
       phBodyTF1 = max(open[rightBars], close[rightBars])
    ENDIF
    
    // --- Pivot Low TF1 ---
    plDetTF1 = 0
    IF lowest[rightBars](low) > low[rightBars] AND low[rightBars]  zBot AND zTop > 0 THEN
          zPct = (zTop - zBot) / ((zTop + zBot) / 2) * 100
          IF zPct >= minZonePct THEN
             sTopTF1 = zTop
             sBotTF1 = zBot
             sLocTF1 = barindex - (rightBars * ratioTF1)
             sOnTF1 = 1
          ENDIF
       ENDIF
    ENDIF
    phPrevTF1 = phDetTF1
    
    // --- New Demand zone TF1 ---
    IF plDetTF1 = 1 AND plPrevTF1 = 0 THEN
       zTop = plBodyTF1
       zBot = plLowTF1
       IF zTop > zBot AND zBot > 0 THEN
          zPct = (zTop - zBot) / ((zTop + zBot) / 2) * 100
          IF zPct >= minZonePct THEN
             dTopTF1 = zTop
             dBotTF1 = zBot
             dLocTF1 = barindex - (rightBars * ratioTF1)
             dOnTF1 = 1
          ENDIF
       ENDIF
    ENDIF
    plPrevTF1 = plDetTF1
    
    // --- Invalidation TF1 ---
    IF sOnTF1 = 1 AND close > sTopTF1 THEN
       sOnTF1 = 0
    ENDIF
    IF dOnTF1 = 1 AND close < dBotTF1 THEN
       dOnTF1 = 0
    ENDIF
    
    // ---------------------------------------------------------
    // TF2: 4 HOURS
    // ---------------------------------------------------------
    
    TIMEFRAME(4 hours)
    
    // --- Pivot High TF2 ---
    phDetTF2 = 0
    IF highest[rightBars](high)  highest[leftBars](high)[rightBars + 1] THEN
       phDetTF2 = 1
       phHighTF2 = high[rightBars]
       phBodyTF2 = max(open[rightBars], close[rightBars])
    ENDIF
    
    // --- Pivot Low TF2 ---
    plDetTF2 = 0
    IF lowest[rightBars](low) > low[rightBars] AND low[rightBars]  zBot AND zTop > 0 THEN
          zPct = (zTop - zBot) / ((zTop + zBot) / 2) * 100
          IF zPct >= minZonePct THEN
             sTopTF2 = zTop
             sBotTF2 = zBot
             sLocTF2 = barindex - (rightBars * ratioTF2)
             sOnTF2 = 1
          ENDIF
       ENDIF
    ENDIF
    phPrevTF2 = phDetTF2
    
    // --- New Demand zone TF2 ---
    IF plDetTF2 = 1 AND plPrevTF2 = 0 THEN
       zTop = plBodyTF2
       zBot = plLowTF2
       IF zTop > zBot AND zBot > 0 THEN
          zPct = (zTop - zBot) / ((zTop + zBot) / 2) * 100
          IF zPct >= minZonePct THEN
             dTopTF2 = zTop
             dBotTF2 = zBot
             dLocTF2 = barindex - (rightBars * ratioTF2)
             dOnTF2 = 1
          ENDIF
       ENDIF
    ENDIF
    plPrevTF2 = plDetTF2
    
    // --- Invalidation TF2 ---
    IF sOnTF2 = 1 AND close > sTopTF2 THEN
       sOnTF2 = 0
    ENDIF
    IF dOnTF2 = 1 AND close < dBotTF2 THEN
       dOnTF2 = 0
    ENDIF
    
    // ---------------------------------------------------------
    // DRAWING
    // ---------------------------------------------------------
    
    IF islastbarupdate THEN
       
       rEdge = barindex + rightExt
       
       // --- TF0: Supply (red) / Demand (blue) ---
       IF sOnTF0 = 1 THEN
          drawrectangle(sLocTF0, sBotTF0, rEdge, sTopTF0) coloured(255, 0, 0) fillcolor(255, 0, 0, 40)
          drawtext("S-TF", sLocTF0, sTopTF0) coloured(255, 0, 0)
       ENDIF
       IF dOnTF0 = 1 THEN
          drawrectangle(dLocTF0, dBotTF0, rEdge, dTopTF0) coloured(33, 87, 243) fillcolor(33, 87, 243, 40)
          drawtext("D-TF", dLocTF0, dBotTF0) coloured(33, 87, 243)
       ENDIF
       
       // --- TF1: Supply (orange) / Demand (cyan) ---
       IF sOnTF1 = 1 THEN
          drawrectangle(sLocTF1, sBotTF1, rEdge, sTopTF1) coloured(255, 140, 0) fillcolor(255, 140, 0, 40)
          drawtext("S-1H", sLocTF1, sTopTF1) coloured(255, 140, 0)
       ENDIF
       IF dOnTF1 = 1 THEN
          drawrectangle(dLocTF1, dBotTF1, rEdge, dTopTF1) coloured(0, 195, 255) fillcolor(0, 195, 255, 40)
          drawtext("D-1H", dLocTF1, dBotTF1) coloured(0, 195, 255)
       ENDIF
       
       // --- TF2: Supply (dark red) / Demand (dark blue) ---
       IF sOnTF2 = 1 THEN
          drawrectangle(sLocTF2, sBotTF2, rEdge, sTopTF2) coloured(180, 0, 0) fillcolor(180, 0, 0, 40)
          drawtext("S-4H", sLocTF2, sTopTF2) coloured(180, 0, 0)
       ENDIF
       IF dOnTF2 = 1 THEN
          drawrectangle(dLocTF2, dBotTF2, rEdge, dTopTF2) coloured(0, 0, 180) fillcolor(0, 0, 180, 40)
          drawtext("D-4H", dLocTF2, dBotTF2) coloured(0, 0, 180)
       ENDIF
       
    ENDIF
    
    RETURN
    


Viewing 6 posts - 1 through 6 (of 6 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

TradingView to ProRealTime Translation Center

New Reply
Summary

This topic contains 5 replies,
has 1 voice, and was last updated by Iván GonzálezIván González
7 months, 3 weeks ago.

Topic Details
Forum: TradingView to ProRealTime Translation Center Forum
Started: 01/10/2026
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...