PRC TSR DailyRange

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #229016 quote
    mathiasKN
    Participant
    New

    Hi,

    Can someone please help me out how I import a code for setting specific hours (RTH/ETH f.ex) on this indicator?

    //PRC_TSR_DailyRange_display | indicator
    //11.12.2018
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //translated from MT4 version
    
    defparam drawonlastbaronly=true
    
    if day<>day[1] then 
     startbar=barindex
     FIVE=0
     TEN=0
     TWENTY=0
     for i = 1 to 20 do
      if i<6 then
       FIVE=FIVE+(dhigh(i)-dlow(i))
      endif
      if i<11 then
       TEN=TEN+(dhigh(i)-dlow(i))
      endif
      TWENTY=TWENTY+(dhigh(i)-dlow(i))
     next
     FIVE = FIVE/10
     TEN = TEN/20
     TWENTY = TWENTY/40
     AV = (FIVE+TEN+TWENTY)/3
    endif
    
    HIDaily = dhigh(0)-(AV)
    LOWDaily = dlow(0)+(AV)
    HIDaily1 = dhigh(0)
    LOWDaily1 =dlow(0)
    HIDaily2 = dhigh(0)-(AV)*2
    LOWDaily2 =dlow(0)+(AV)*2
    
    drawrectangle(startbar,HiDaily,barindex,LOWDaily) coloured(128,0,0)
    drawrectangle(startbar,HiDaily1,barindex,LOWDaily1) coloured(0,100,0)
    drawrectangle(startbar,HiDaily2,barindex,LOWDaily2) coloured(0,44,9)
    center=max(startbar+(barindex-startbar)/2,1)
    drawtext("Top Daily Range",center,LowDaily2,Dialog,Bold,16) coloured(244,164,96)
    drawtext("Bottom Daily Range",center,HiDaily2,Dialog,Bold,16) coloured(244,164,96)
    drawtext("             High",barindex,dhigh(0),Dialog,Bold,16) coloured(154,205,50)
    drawtext("             Low",barindex,dlow(0),Dialog,Bold,16) coloured(154,205,50)
    drawtext("             Open",barindex,dopen(0),Dialog,Bold,16) coloured(244,164,96)
    RETURN
    #229018 quote
    robertogozzi
    Moderator
    Master

    This one will only work within the time range FromTime to ToTime:

    //PRC_TSR_DailyRange_display | indicator
    //11.12.2018
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //translated from MT4 version
    
    defparam drawonlastbaronly=true
    
    FromTime = 100000
    ToTime   = 160000
    if day<>day[1] then
    startbar=barindex
    FIVE=0
    TEN=0
    TWENTY=0
    for i = 1 to 20 do
    if i<6 then
    FIVE=FIVE+(dhigh(i)-dlow(i))
    endif
    if i<11 then
    TEN=TEN+(dhigh(i)-dlow(i))
    endif
    TWENTY=TWENTY+(dhigh(i)-dlow(i))
    next
    FIVE = FIVE/10
    TEN = TEN/20
    TWENTY = TWENTY/40
    AV = (FIVE+TEN+TWENTY)/3
    endif
    
    IF Time >= FroMtime AND Time <= ToTime THEN
    HIDaily = dhigh(0)-(AV)
    LOWDaily = dlow(0)+(AV)
    HIDaily1 = dhigh(0)
    LOWDaily1 =dlow(0)
    HIDaily2 = dhigh(0)-(AV)*2
    LOWDaily2 =dlow(0)+(AV)*2
    ENDIF
    drawrectangle(startbar,HiDaily,barindex,LOWDaily) coloured(128,0,0)
    drawrectangle(startbar,HiDaily1,barindex,LOWDaily1) coloured(0,100,0)
    drawrectangle(startbar,HiDaily2,barindex,LOWDaily2) coloured(0,44,9)
    center=max(startbar+(barindex-startbar)/2,1)
    drawtext("Top Daily Range",center,LowDaily2,Dialog,Bold,16) coloured(244,164,96)
    drawtext("Bottom Daily Range",center,HiDaily2,Dialog,Bold,16) coloured(244,164,96)
    drawtext("             High",barindex,dhigh(0),Dialog,Bold,16) coloured(154,205,50)
    drawtext("             Low",barindex,dlow(0),Dialog,Bold,16) coloured(154,205,50)
    drawtext("             Open",barindex,dopen(0),Dialog,Bold,16) coloured(244,164,96)
    RETURN
    mathiasKN thanked this post
    #229020 quote
    mathiasKN
    Participant
    New

    Thanks Robert!

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

PRC TSR DailyRange


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
mathiasKN @mathiaskn Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by mathiasKN
1 year, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/01/2024
Status: Active
Attachments: No files
Logo Logo
Loading...