Screener da indicatore Order Block presente nel forum

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #218339 quote
    alb3rt1
    Participant
    New

    Buongiorno

    vorrei chiedere se è possibile realizzare uno screener per azioni, partendo da questo indicatore presente nel forum:

    Supply & Demand – Order Blocks

    In particolare sarebbe bello se lo screener trovasse i titoli che ritestano le aree (verdi e rosse) evidenziate dal plugin nelle ultime sessioni (magari impostabili).

     

    Grazie

    #218375 quote
    robertogozzi
    Moderator
    Master

    Dovrebbe essere possibile, ci studio un pò.

    #218465 quote
    alb3rt1
    Participant
    New

    Grazie Roberto son sicuro che potrebbe essere utile a molti.

    #218952 quote
    robertogozzi
    Moderator
    Master

    Ho fatto delle prove, ma occorre un pò di tempo per capirne bene il funzionamento.

    Abbi ancora un pò di pazienza 🙂

    #218957 quote
    alb3rt1
    Participant
    New

    Grazie Roberto, gentilissimo, aspetterò pazientemente visto anche il periodo.

    Se può aiutarti (ma immagino che non ce ne fosse bisogno)

    Le aree verdi sono considerate dei supporti che si creano quando il prezzo è salito (di solito velocemente)

    Sono aree da tenere monitorate in cui il prezzo dovrebbe poi rientrare nelle aree verdi (dall’alto verso il basso) per poi ripartire al rialzo velocemente.

    Viceversa le aree rosse.

    #220628 quote
    alb3rt1
    Participant
    New

    Ciao Roberto, non è venuto fuori niente di buono dai test effettuati? Grazie e buon weekend

    #220655 quote
    robertogozzi
    Moderator
    Master

    No, è che è un pò complicato capire come xono costruite quelle zone e non ho avuto il tempo necessatio per provare a capirlo.

    Ti prometto che cercherò di farlo entro pochi giorni.

    #220664 quote
    alb3rt1
    Participant
    New

    Grazie, gentilissimo, ovviamente prenditi pure tutto il tempo che ti serve ci mancherebbe.

    #221735 quote
    robertogozzi
    Moderator
    Master

    Non mi sono dimenticato, solo che sono stato molto impegnato.

    Abbi ancora qualcghe giorno di pazienza.

    #222978 quote
    robertogozzi
    Moderator
    Master

    Ciao, scusami per l’enorme ritardo, ma è stato un pò lungo studiare l’indicatore e cercare di tuirare fuori uno screener.

    Ancora non sono sicuro vada bene al 100%, poerò provalo e fammi sapere se ci sono inesattezze.

    Ecco il codice:

    // Sonarlabs - Order Block Finder
    // converted from TradingView
    // Lower the sensitivity to show more order blocks. A higher sensitivity will show less order blocks
    
    //defparam drawonlastbaronly=true
    
    //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
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    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)    // RED rectangle
    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)  // GREEN rectangle
    endif
    next
    endif
    //GreenSignal = 0
    //RedSignal   = 0
    for i = 0 TO plot
    IF (high >= $bottom[i]) AND (high <= $top[i]) AND (close < $bottom[i]) THEN
    //RedSignal   = -1
    break
    ENDIF
    next
    for i = 0 TO plot
    IF (low <= $topbull[i]) AND (low >= $bottombull[i]) AND (close > $topbull[i]) THEN
    //GreenSignal = 1
    break
    ENDIF
    next
    endif
    //////////////////////////////////////////////////////////////
    LookBack     = 1               //ultime 5 sessioni
    TopIndex     = lastset($top)
    TopBullIndex = lastset($topbull)
    TopFlag      = 0
    TopBullFlag  = 0
    //
    IF TopIndex >= LookBack THEN
    for k = max(0,TopIndex) DOWNTO max(0,(TopIndex - (LookBack - 1)))
    IF $bottom[k] AND ((low <= $bottom[k] AND high >= $bottom[k]) OR (high >= $top[k] AND low <= $top[k])) THEN
    TopFlag = 1
    break
    endif
    next
    ENDIF
    //
    IF TopBullIndex >= LookBack THEN
    for k = max(0,TopBullIndex) DOWNTO max(0,(TopBullIndex - (LookBack - 1)))
    IF $bottombull[k] AND ((low <= $bottombull[k] AND high >= $bottombull[k]) OR (high >= $topbull[k] AND low <= $topbull[k])) THEN
    TopBullFlag = 1
    break
    endif
    next
    ENDIF
    //
    Segnale = 0
    IF TopFlag AND TopBullFlag THEN
    Segnale = 3
    ELSIF TopFlag THEN
    Segnale = 2
    ELSIF TopBullFlag THEN
    Segnale = 1
    ENDIF
    //////////////////////////////////////////////////////////////
    SCREENER[Segnale](Segnale AS "1=Bull,2=Bear,3=entrambi")
    #222995 quote
    alb3rt1
    Participant
    New

    Complimenti sei stato di parola! Gli do subito un’occhiata e nel weekend lo testo per bene.

    Nel frattempo, grazie, gentilissimo.

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

Screener da indicatore Order Block presente nel forum


ProScreener: Scansione Mercati & Screener

New Reply
Author
author-avatar
alb3rt1 @alb3rt1 Participant
Summary

This topic contains 10 replies,
has 2 voices, and was last updated by alb3rt1
2 years, 4 months ago.

Topic Details
Forum: ProScreener: Scansione Mercati & Screener
Language: Italian
Started: 07/30/2023
Status: Active
Attachments: No files
Logo Logo
Loading...