Screener quarter bar

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #63899 quote
    mmichaelmmichael
    Participant
    Average

    Hello,

    I am trying to do a screener to compare the quarter high / low with the previous quarter.

    I saw I can use this code for the previous quarter

    trimH=max(trimH,high)
    trimL=min(trimL,low)
    If openMonth<>openMonth[1] then
    if openmonth=4 or openmonth=7 or openmonth=10 or openmonth=1 then
    trimestrialH=trimH
    trimestrialL=trimL
    trimL=close*100
    trimH=0
    endif
    Endif

    1/ How can I do to get current quarter H/L?

    2/ How to get the preceding quarter H/L? (the one N-2)

    I believe this could be easier if we have a quarterly timeframe. Is there a solution?

    Many thx

    #130685 quote
    efex77efex77
    Participant
    New

    Hello,

     

    Did you get a workaround for this?

    I am need to calculate quarterly pivot points and also don’t know how to get previus quarter high, low and close.

    Any thoughts?

     

    Regards

    #130692 quote
    VonasiVonasi
    Moderator
    Master

    Simply store the last value in a different set of variables before storing the latest values. You can also reset the trimL to the high rather than to close*100 which is more guaranteed to work on every instrument.

    trimH=max(trimH,high)
    trimL=min(trimL,low)
    If openMonth<>openMonth[1] then
    if openmonth=4 or openmonth=7 or openmonth=10 or openmonth=1 then
    trimestrialH2=trimestrialH
    trimestrialL2=trimestrialL
    trimestrialH=trimH
    trimestrialL=trimL
    trimL=high
    trimH=0
    endif
    Endif
    mmichael thanked this post
    #130823 quote
    mmichaelmmichael
    Participant
    Average

    Hello Vonaci,

    Thank you for  reactivating this topic.

    As reminder, The idea is to build a screener for quarter bars, starting with the instruction “timeframe (Monthly) as workaround.

    Previous code allows to retrieve current high and past high only.

    Is there a way to use instructions like

    • trimestrialH[i], trimestrialL[i], trimestrialC[i], trimestrialO[i]

    to retrieve the high, low, close and open of the bar number i in the past?

    Many thanks in advance.

    #130860 quote
    VonasiVonasi
    Moderator
    Master

    You could use something like this code that I’ve stolen from my OHLC MTF indicator.

    lookback = 2 //How many quarters back to get results from
    
    if openmonth <> openmonth[1] and (openmonth = 1 or openmonth = 4 or openmonth = 7 or openmonth = 10) then
    quarterindex = quarterindex + 1
    quarterhigh = 0
    quarterlow = close
    quarteropen = open
    quarterclose = close
     
    if quarterindex > lookback then
    for j = 1 to barindex
    if quarterindex[j] = quarterindex - lookback then
    myquarterhigh = quarterhigh[j]
    myquarterlow = quarterlow[j]
    myquarteropen = quarteropen[j]
    myquarterclose = quarterclose[j]
    break
    endif
    next
    endif
    endif
     
    quarterhigh = max(quarterhigh,high)
    quarterlow = min(quarterlow,low)
    quarterclose = close
    
    return myquarterhigh, myquarterlow, myquarterclose, myquarteropen
    mmichael thanked this post
Viewing 5 posts - 1 through 5 (of 5 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 quarter bar


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
mmichael @mmichael Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by VonasiVonasi
6 years, 5 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 02/25/2018
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...