To build a screener for any time frames using structure breaks

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #229976 quote
    venugopalvenugopal
    Participant
    New

    Hi Nicolas or Anyone,

    Can you please help me build this below logic into a screener for pro real time. I want the screener to give me if triangle appears on current or previous candle for any timeframes. Mostly I will using it on Weekly timeframes. Can anyone please help. Many thanks!

     

    ———————————-

    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © VenugopalAru
    //@version=5
    indicator(“Structural breaks”, overlay = true, max_boxes_count=500, max_lines_count=500)
    pivotLookup  = input.int(defval=1, minval=1, maxval=5,title=’Pivot Lookup’, group=’Pivots’, tooltip=’Minimum = 1, Maximum = 5′)
    plotPPDD = input.bool(defval=true, title=”Plot PPDD OB’s”, group=’Qualitative indicators’, tooltip=’Premium Premium Discount Discount (PPDD) is an OB formed after liquidity sweep. It will show up by default as a triangle (Bull ▲ / Bear ▼). Also PPDD1 (by deafult maked with a x-cross ⨯) which is a weak OB formed after liquidity sweep, that fails to completely engulf the high/low, but closes beyond the trapped candles open price.’)
    ppddBullColor = input.color(defval=color.new(color.green, 0), title=”Bullish PPDD OB’s Color”, group=’Qualitative indicators’, inline=’PPDD Color’)
    ppddBearColor = input.color(defval=color.new(color.red, 0), title=”Bearish PPDD OB’s Color”, group=’Qualitative indicators’, inline=’PPDD Color’)
    //Functions
    isUp(index) =>
        close[index] > open[index]
    isDown(index) =>
        close[index] < open[index]
    isObUp(index) =>
        isDown(index + 1) and isUp(index) and close[index] > high[index + 1]
    isObDown(index) =>
        isUp(index + 1) and isDown(index) and close[index] < low[index + 1]
    //////////////////// Pivots ////////////////////
    hih = ta.pivothigh(high, pivotLookup, pivotLookup)
    lol = ta.pivotlow(low , pivotLookup, pivotLookup)
    top = ta.valuewhen(hih, high[pivotLookup], 0)
    bottom = ta.valuewhen(lol, low [pivotLookup], 0)
    //////////////////// Premium Premium & Discount Discount //////////////////
    brearishTriangle = plotPPDD and isObDown(0) and ((math.max(high, high[1]) > top and close < top) or (math.max(high, high[1]) > top[1] and close < top[1]))
    bullishTriangle = plotPPDD and isObUp(0) and ((math.min(low, low[1]) < bottom and close > bottom) or (math.min(low, low[1]) < bottom[1] and close > bottom[1]))
    plotshape(brearishTriangle, “Bearish PPDD OB”, style=shape.triangledown , location=location.abovebar, color=ppddBearColor, size=size.tiny)
    plotshape(bullishTriangle, “Bullish PPDD OB”, style=shape.triangleup , location=location.belowbar, color=ppddBullColor, size=size.tiny)
    ================================================
    Regards,
    Venu
    #230026 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Here is the code:

    ////////////////////////////////////////////////////////////////
    //PRC_Structural Breaks Screener
    //version = 0
    //19.03.24
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    ////////////////////////////////////////////////////////////////
    //------------Inputs-----------------------------------------//
    prd = 1 //pivot length
    //------------Bullish and bearish conditions-----------------//
    isObUp = close[1]<open[1] and close>open and close > high[1]
    isObDown = close[1]>open[1] and close < open and close < low[1]
    //------------Pivots low-------------------------------------//
    if low > low[prd] and lowest[prd](low) > low[prd] and low[prd] < lowest[prd](low)[prd+1] then
    $pl[z+1] = low[prd]
    $plx[z+1] = barindex[prd]
    z = z + 1
    endif
    //------------Pivots high------------------------------------//
    if high < high[prd] and highest[prd](high)<high[prd] and high[prd]>highest[prd](high)[prd+1] then
    $ph[t+1]=high[prd]
    $phx[t+1]=barindex[prd]
    t=t+1
    endif
    //----------Bearish Signal-----------------------------------//
    bearishTriangle = isObDown and ((max(high, high[1]) > $ph[t] and close < $ph[t]) or (max(high, high[1]) > $ph[t][1] and close < $ph[t][1]))
    //----------Bullish Signal-----------------------------------//
    bullishTriangle = isObUp and ((min(low, low[1]) < $pl[z] and close > $pl[z]) or (min(low, low[1]) < $pl[z][1] and close > $pl[z][1]))
    //----------Screener condition-------------------------------//
    
    screener[bearishTriangle or bullishTriangle]
    
    #230027 quote
    venugopalvenugopal
    Participant
    New

    Here is the code:

    Hi Ivan, thanks for responding. I tried running this screener looks like its not working, it is not returning me any stocks both on weekly or daily. Can you please check it.

    Regards,

    Venu

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

    Hi
    The code works properly.
    You can see in this post https://www.prorealcode.com/prorealtime-market-screeners/structural-breaks-screener/ the results in USA Tech 600.

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

To build a screener for any time frames using structure breaks


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
venugopal @venugopal Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Iván GonzálezIván González
2 years, 6 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 03/18/2024
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...