Screener sur order block

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #204690 quote
    Sofitech
    Participant
    Master

    Bonjour à tous, Bonjour Nicolas,

    J’utilise l’indicateur qui a été publié dans la librairie :

    Supply & Demand – Order Blocks

    J’aimerais savoir s’il est possible de créer un screener permettant de détecter :
    – La couleur de la zone : Bearish ou Bullish order block,
    – Le présence du prix à l’intérieur dans la zone,

    Un ou deux screener, j’ignore ce qui est possible…

    #219346 quote
    alb3rt1
    Participant
    New

    UP

    #223779 quote
    Jean FX
    Moderator
    Junior
    Voici un exemple de code screener:

    Si block=1 ,alors on a un bearish boxes
    SI block=-1, alors on a un bullish boxes.
    Si inside=1, alors on a le close a l’intérieur de la zone

    // Sonarlabs – Order Block Finder
    // converted from TradingView
    // Lower the sensitivity to show more order blocks. A higher sensitivity will show less order blocks

    //Transparency = 80

    sens = 28

    once obcreatedbear = 0
    once obcreatedbull = 0
    once crossindexbear = 0
    once crossindexbull = 0

    // Custom Rate of Change (ROC) calculation. This is to calculate high momentum moves in the market.
    pc = ((open – open[4]) / open[4]) * 100

    // —————–
    sens = sens/100 //ExponentialAverage[8](pc) //sens/100
    OBBullMitigation = close[1]
    OBBearMitigation = close[1]

    // If the ROC crossover our Sensitivty input – Then create a Bearish Order Block
    // Sensitivty is negative as this is a Bearish OB
    if pc crosses under -sens then
    obcreatedbear = 1
    crossindexbear = barindex
    endif

    // If the ROC crossover our Sensitivty input – Then create a Bullish Order Block
    if pc crosses over sens then
    obcreatedbull = 1
    crossindexbull = barindex
    endif

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Calculation
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // ——————————-
    // Bearish OB Creation
    // ——————————-
    // Check if we should create a OB. Also check if we haven’t created an OB in the last 5 candles.
    if obcreatedbear and (crossindexbear – crossindexbear[1]) > 5 then
    lastgreen = 0
    //hhighest = 0
    // Loop through the most recent candles and find the first GREEN (Bullish) candle. We will place our OB here.
    for i = 4 to 15
    if close[i] > open[i] then
    lastgreen = i
    //populate the arrays of order block to draw them later
    $left[plot]= barindex[lastgreen]
    $top[plot]=high[lastgreen]
    $bottom[plot]=low[lastgreen]
    $right[plot]=barindex[lastgreen]
    plot=plot+1 //increase the array column for next data
    break
    endif
    next
    endif

    // ——————————-
    // Bullish OB Creation
    // ——————————-
    // Check if we should create a OB, Also check if we haven’t created an OB in the last 5 candles.
    if obcreatedbull and (crossindexbull – crossindexbull[1]) > 5 then
    lastred = 0
    //hhighest = 0
    // Loop through the most recent candles and find the first RED (Beaarish) candle. We will place our OB here.
    for ibull = 4 to 15
    if close[ibull] < open[ibull] then
    lastred = ibull
    //populate the arrays of order block to draw them later
    $leftbull[plotbull]= barindex[lastred]
    $topbull[plotbull]=high[lastred]
    $bottombull[plotbull]=low[lastred]
    $rightbull[plotbull]=barindex[lastred]
    plotbull=plotbull+1 //increase the array column for next data
    break
    endif
    next
    endif

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Cleanup
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // Clean up Bearish OB boxes
    if plot>0 then
    for j = plot-1 downto 0 //0 to plot-1
    // If the two last closes are above the high of the bearish OB – Remove the OB
    if $left[j]>0 then //check if the zone still exist
    itop = $top[j]
    breakout = summation[max(1,barindex-$left[j])](OBBearMitigation>itop)>=1 //2
    if breakout then
    $left[j]=0
    endif
    endif
    next
    endif

    // Clean up Bullish OB boxes
    if plotbull>0 then
    for jbull = plotbull-1 downto 0 //0 to plotbull-1
    // If the two last closes are below the low of the bullish OB – Remove the OB
    if $leftbull[jbull]>0 then //check if the zone still exist
    ibot = $bottombull[jbull]
    breakoutbull = summation[max(1,barindex-$leftbull[jbull])](OBBullMitigation<ibot)>=1
    if breakoutbull then
    $leftbull[jbull]=0
    endif
    endif
    next
    endif

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Drawing
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    zone=0
    inside=0
    if islastbarupdate then
    //plot the Bearish boxes
    if plot>0 then //islastbarupdate and
    for j = plot-1 downto 0 //0 to plot-1
    if $left[j]>0 then
    //drawrectangle($left[j],$top[j],barindex,$bottom[j]) coloured(“red”,Transparency)bordercolor(“red”,Transparency)
    zone=1
    if close > min($top[j],$bottom[j]) and close < max($top[j],$bottom[j]) then
    inside=1
    endif
    endif
    next
    endif
    //plot the Bullish boxes
    if plotbull>0 then //islastbarupdate and
    for jbull = plotbull-1 downto 0 //0 to plotbull-1
    if $leftbull[jbull]>0 then
    //drawrectangle($leftbull[jbull],$bottombull[jbull],barindex,$topbull[jbull]) coloured(“green”,Transparency)bordercolor(“green”,Transparency)
    zone=-1
    if close > min($bottombull[jbull],$topbull[jbull]) and close < max($bottombull[jbull],$topbull[jbull]) then
    inside=1
    endif
    endif
    next
    endif
    endif

    screener[Zone <> 0](Zone as “Block”,inside as “inside”)

    #224214 quote
    alb3rt1
    Participant
    New

    Comment puis-je résoudre cette erreur ? (voir image ci-jointe)

    Schermata-2023-11-23-alle-04.01.49.png Schermata-2023-11-23-alle-04.01.49.png
    #224216 quote
    fifi743
    Participant
    Master

    comme ceci

     

    
    //Si block=1 ,alors on a un bearish boxes
    //SI block=-1, alors on a un bullish boxes.
    //Si inside=1, alors on a le close a l’intérieur de la zone
    
    alb3rt1 thanked this post
    #230347 quote
    ARLEQUIN49
    Participant
    Veteran

    ne pas intégrer les 3 premières lignes dans le code. J’ai fait un essai et ça fonctionne

    alb3rt1 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

Screener sur order block


ProScreener : Scanners de Marché & Détection

New Reply
Author
author-avatar
Sofitech @sofitech Participant
Summary

This topic contains 5 replies,
has 5 voices, and was last updated by ARLEQUIN49
2 years, 5 months ago.

Topic Details
Forum: ProScreener : Scanners de Marché & Détection
Language: French
Started: 11/23/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...