Highs and lows between two times

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #194239 quote
    robert123robert123
    Participant
    Master

    Hi, Nicolas et al,

    I am probably being a little dim, but I am struggling to get the exactness I require.

    I am trying to get the highs and lows between two times. Could you cast your eyes over this to see where I am going wrong?

    Many thanks,

    Robert

    defparam drawonlastbaronly=false

    ////////////Asia////////////
    once ascount=0
    AsOP=020000
    AsCl=050000
    if time=asop then
    ascount=ascount+1
    $stct[0]=barindex
    $price[0]=open
    elsif time=ascl then
    $endct[0]=(barindex)
    $close[0]=highest[ascount](high)

    endif

    for i=$stct[0] to $endct[0] do
    drawrectangle($stct[0],$price[0],$endct[0],$close[0])
    break
    next

    ////////////London///////////
    //LonOp=020000
    //LonCl=050000

    ////////////NY//////////////
    //NYOp=070000
    //NYCl=100000
    DRAWCANDLE(open, high, low, close)
    return

    #194249 quote
    JC_BywanJC_Bywan
    Moderator
    Master

    Hi Robert, getting highest and lowest between two times has been coded a few times, if you prefer a site “search” solution, keywords like “open range” or “initial balance” or “world sessions” should return several ways of doing it. Most recent one I remember is: https://www.prorealcode.com/topic/condition-range-asiatique/#post-193414

    from which you can adapt lines 3 to 12 with:

    AsOP=020000
    AsCl=050000
    
    if opentime=AsOP then
     hh=high
     ll=low
     baropen=barindex
    endif
    if opentime>AsOP and opentime<AsCl then
     hh=max(hh,high)
     ll=min(ll,low)
    endif
    if time=AsCl then
     barclose=barindex
     drawrectangle(baropen, ll, barclose, hh)
    endif
    
    return
    #194254 quote
    robert123robert123
    Participant
    Master

    Many thanks JC

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

Highs and lows between two times


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
robert123 @robert123 Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 05/31/2022
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...