Block Order Multi Time Frame

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

    Buona sera ,

    ho visto questo indicatore su Tradingview e sono curioso di provarlo, quindi chiedo gentilmente la traduzione.

    Grazie

     

    /@version=6
    indicator(title=’Order Blocks-[B.Balaei]’, shorttitle=’Order Blocks-[B.Balaei]’, overlay=true, max_boxes_count=20)
    mtf = input.timeframe(“5″, title=”Multi-Timeframe”, group=”Multi-Timeframe Settings”)
    mtf_open = request.security(syminfo.tickerid, mtf, open)
    mtf_close = request.security(syminfo.tickerid, mtf, close)
    mtf_high = request.security(syminfo.tickerid, mtf, high)
    mtf_low = request.security(syminfo.tickerid, mtf, low)
    _v = input.string(“1.0.2″, title=”Version”, options=[“1.0.2″], group=”Version”)
    sens = input.int(28, minval=1, title=’Sensitivity’, group=’Order Block’, tooltip=’Lower the sensitivity to show more order blocks. A higher sensitivity will show less order blocks.’)
    sens /= 100
    OBMitigationType = input.string(“Close”, title=”OB Mitigation Type”, options=[“Close”, “Wick”], group=”Order Block”, tooltip=”Choose how Order Blocks are mitigated”)
    OBBullMitigation = OBMitigationType==”Close” ? mtf_close[1] : mtf_low
    OBBearMitigation = OBMitigationType==”Close” ? mtf_close[1] : mtf_high
    col_bullish = input.color(#5db49e, title=”Bullish OB Border”, inline=”a”, group=”Order Block”)
    col_bullish_ob = input.color(color.new(#64C4AC, 85), title=”Background”, inline=”a”, group=”Order Block”)
    col_bearish = input.color(#4760bb, title=”Bearish OB Border”, inline=”b”, group=”Order Block”)
    col_bearish_ob = input.color(color.new(#506CD3, 85), title=”Background”, inline=”b”, group=”Order Block”)
    buy_alert = input.bool(title=’Buy Signal’, defval=true, group=’Alerts’, tooltip=’An alert will be sent when price goes below the top of a bullish order block.’)
    sell_alert = input.bool(title=’Sell Signal’, defval=true, group=’Alerts’, tooltip=’An alert will be sent when price goes above the bottom of a bearish order block.’)
    bool ob_created = false
    bool ob_created_bull = false
    var int cross_index = na
    var box drawlongBox = na
    var longBoxes = array.new_box()
    var box drawShortBox = na
    var shortBoxes = array.new_box()
    pc_mtf = (mtf_open – mtf_open[4]) / mtf_open[4] * 100
    if ta.crossunder(pc_mtf, -sens)
        ob_created := true
        cross_index := bar_index
        cross_index
    if ta.crossover(pc_mtf, sens)
        ob_created_bull := true
        cross_index := bar_index
        cross_index
    if ob_created and cross_index – cross_index[1] > 5
        float last_green = 0
        float highest = 0
        for i = 4 to 15 by 1
            if mtf_close[i] > mtf_open[i]
                last_green := i
                break
        drawShortBox := box.new(left=bar_index[last_green], top=mtf_high[last_green], bottom=mtf_low[last_green], right=bar_index[last_green], bgcolor=col_bearish_ob, border_color=col_bearish, extend=extend.right)
        array.push(shortBoxes, drawShortBox)
    if ob_created_bull and cross_index – cross_index[1] > 5
        float last_red = 0
        float highest = 0
        for i = 4 to 15 by 1
            if mtf_close[i] < mtf_open[i]
                last_red := i
                break
        drawlongBox := box.new(left=bar_index[last_red], top=mtf_high[last_red], bottom=mtf_low[last_red], right=bar_index[last_red], bgcolor=col_bullish_ob, border_color=col_bullish, extend=extend.right)
        array.push(longBoxes, drawlongBox)
    if array.size(shortBoxes) > 0
        for i = array.size(shortBoxes) – 1 to 0 by 1
            sbox = array.get(shortBoxes, i)
            top = box.get_top(sbox)
            bot = box.get_bottom(sbox)
            if OBBearMitigation > top
                array.remove(shortBoxes, i)
                box.delete(sbox)
            if mtf_high > bot and sell_alert
                alert(‘Price inside Bearish OB (MTF)’, alert.freq_once_per_bar)
    if array.size(longBoxes) > 0
        for i = array.size(longBoxes) – 1 to 0 by 1
            sbox = array.get(longBoxes, i)
            bot = box.get_bottom(sbox)
            top = box.get_top(sbox)
            if OBBullMitigation < bot
                array.remove(longBoxes, i)
                box.delete(sbox)
            if mtf_low < top and buy_alert
                alert(‘Price inside Bullish OB (MTF)’, alert.freq_once_per_bar)
    #246007 quote
    Iván GonzálezIván González
    Moderator
    Legend
    //--------------------------------------------//
    //PRC_Order Blocks
    //version = 0
    //17.04.25
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //--------------------------------------------//
    // Inputs
    //--------------------------------------------//
    defparam drawonlastbaronly=true
    sens=28
    sens=sens/100
    OBMigrationtype=1
    //--------------------------------------------//
    // Order Block Mitigation Type
    //--------------------------------------------//
    if OBMigrationtype=1 then
       OBBullmitigation=close[1]
       OBBearmitigation=close[1]
    else
       OBBullmitigation=low
       OBBearmitigation=high
    endif
    //--------------------------------------------//
    // Check for Order Block
    //--------------------------------------------//
    pc=(open-open[4])/open[4]*100
    
    if pc crosses under -sens then
       obcreated=1
       crossindex=barindex
    else
       obcreated=0
    endif
    
    if pc crosses over sens then
       obcreatedbull=1
       crossindex=barindex
    else
       obcreatedbull=0
    endif
    //--------------------------------------------//
    // Order Block Bear
    //--------------------------------------------//
    if obcreated and crossindex-crossindex[1]>5 then
       
       lastgreen=0
       for i=4 to 15 do
          if close[i]>open[i] then
             lastgreen=i
             break
          endif
       next
       
       $boxleft[n+1]=barindex[lastgreen]
       $boxtop[n+1]=high[lastgreen]
       $boxbot[n+1]=low[lastgreen]
       $obcreated[n+1]=1
       n=n+1
       
    endif
    //--------------------------------------------//
    // Order Block Bull
    //--------------------------------------------//
    if obcreatedbull and crossindex-crossindex[1]>5 then
       
       lastred=0
       for i=4 to 15 do
          if close[i]<open[i] then
             lastred=i
             break
          endif
       next
       
       $boxleftbull[m+1]=barindex[lastred]
       $boxtopbull[m+1]=high[lastred]
       $boxbotbull[m+1]=low[lastred]
       $obcreatedbull[m+1]=1
       m=m+1
       
    endif
    //--------------------------------------------//
    // Plot
    //--------------------------------------------//
    if islastbarupdate then
       
       for i=n downto 0 do
          bar=barindex-$boxleft[i]
          for j=bar-1 downto 0 do
             if high[j] > $boxtop[i] then
                $obcreated[i]=0
                break
             endif
          next
          if $obcreated[i]=1 then
             drawrectangle($boxleft[i], $boxtop[i],barindex,$boxbot[i])coloured("blue",100)fillcolor("blue",30)
          endif
       next
       //--------------------------------------------//
       for i=m downto 0 do
          barbull=barindex-$boxleftbull[i]
          for j=barbull-1 downto 0 do
             if low[j] < $boxbotbull[i] then
                $obcreatedbull[i]=0
                break
             endif
          next
          if $obcreatedbull[i]=1 then
             drawrectangle($boxleftbull[i], $boxtopbull[i],barindex,$boxbotbull[i])coloured("green",100)fillcolor("green",30)
          endif
       next
       
    endif
    //--------------------------------------------//
    return
    
    #246015 quote
    jacquesgermainjacquesgermain
    Participant
    Veteran

    Bonjour Ivan

    problème avec ligne 11 et 12 ça ne peut pas fonctionner  !

    sens=28

    sens=sens/100
    #246020 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Non lo so… scrivi sens=0.28

    #246022 quote
    jacquesgermainjacquesgermain
    Participant
    Veteran

    non ce que je constate c’est que tu utilise sens=28 et sens =sens/100 je pense que tu dois changer sens=sens/100 par sensa=sens/100 puis dans la suite du code remplacer sens par sensa  ?

    #246053 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Il codice che ti ho passato è completamente funzionante…
    Prova a fare quello che ti ho detto.
    Se continui ad avere problemi, potrebbe essere che la tua versione non supporti qualche funzione integrata. Probabilmente fillcolor()

    jacquesgermain thanked this post
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

Block Order Multi Time Frame


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Summary

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

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 04/12/2025
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...