Close Yesterday 17:00h

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #28049 quote
    superborstig
    Participant
    Junior

    Hello guys I have a problem.

    I want to show the close of the 1 minute candlestick  yesterday at 17:00h  in Probuilder.

    My idea:

    If yesterday and Time = 170000 Then
    myclose = close
    Endif
    
    Return myclose

     

     

    But “yesterday” or something like this dosn´t work.

    Does somebody has any idea

    #28062 quote
    JC_Bywan
    Moderator
    Master

    It depends “from when” you want to display the 17h close of previous day…

    If you want to display it from beginning of current day until close of current day, then this should do:

    if time=170000 then
       tempclose=close
    endif
    if openday<>openday[1] then
       myclose=tempclose
    endif
    
    return myclose

    If you want to display it from 17h previous day until 17h current day, then this other version should do it:

    if time=170000 then
       myclose=close
    endif
    
    return myclose
    #28077 quote
    superborstig
    Participant
    Junior

    Thank you!

    #110396 quote
    BC
    Participant
    Master

    Hi PRT Master

     

    How to display 3 days back of 17:00 Close?

     

    Thanks

    #110398 quote
    Vonasi
    Moderator
    Master

    Here you go:

    if time=170000 then
    myclose2 = myclose1
    myclose1 = myclose
    myclose=close
    endif
     
    return myclose2
    
    #110437 quote
    BC
    Participant
    Master

    Thanks Vonasi.

     

    But what if need display at day begin?

     

    Thanks.

    #110440 quote
    robertogozzi
    Moderator
    Master

    Change the time to 000000 or anything else.

    #110441 quote
    Vonasi
    Moderator
    Master

    Or do you mean as in the example from before where the 1700 close is not shown until the start of a new day? If so this should do it:

    if time = 170000 then
    myclose2 = myclose1
    myclose1 = myclose
    myclose = close
    endif
    
    if openday <> openday[1] then
       myclosex = myclose2
    endif
     
    return myclosex
    #110442 quote
    BC
    Participant
    Master

    Thanks Robert

     

    Is there any simple syntax if optimize a range (eg: from yesterday to 29 days ago) at Proorder?

    #110448 quote
    BC
    Participant
    Master

    That will be little bulky if I code like this:-

     

    Once EndTime = 170000
    Once LookBackDay = 5  // Range: 1-7 
    
    
    If Time = EndTime then
    
    If LookBackDay = 1 then
    TempClose1 = Close
    EndIf
    
    If LookBackDay = 2 then
    TempClose2 = TempClose1
    TempClose1 = Close
    EndIf
    
    If LookBackDay = 3 then
    TempClose3 = TempClose2
    TempClose2 = TempClose1
    TempClose1 = Close
    EndIf
    
    If LookBackDay = 4 then
    TempClose4 = TempClose3
    TempClose3 = TempClose2
    TempClose2 = TempClose1
    TempClose1 = Close
    EndIf
    
    If LookBackDay = 5 then
    TempClose5 = TempClose4
    TempClose4 = TempClose3
    TempClose3 = TempClose2
    TempClose2 = TempClose1
    TempClose1 = Close
    EndIf
    
    If LookBackDay = 6 then
    TempClose6 = TempClose5
    TempClose5 = TempClose4
    TempClose4 = TempClose3
    TempClose3 = TempClose2
    TempClose2 = TempClose1
    TempClose1 = Close
    EndIf
    
    If LookBackDay = 7 then
    TempClose7 = TempClose6
    TempClose6 = TempClose5
    TempClose5 = TempClose4
    TempClose4 = TempClose3
    TempClose3 = TempClose2
    TempClose2 = TempClose1
    TempClose1 = Close
    EndIf
    
    Endif
    
    
    
    If Openday <> Openday[1] then
    
    If LookBackDay = 1 then
    CloseDX = TempClose1
    EndIf
    
    If LookBackDay = 2 then
    CloseDX = TempClose2
    EndIf
    
    If LookBackDay = 3 then
    CloseDX = TempClose3
    EndIf
    
    If LookBackDay = 4 then
    CloseDX = TempClose4
    EndIf
    
    If LookBackDay = 5 then
    CloseDX = TempClose5
    EndIf
    
    If LookBackDay = 6 then
    CloseDX = TempClose6
    EndIf
    
    If LookBackDay = 7 then
    CloseDX = TempClose7
    EndIf
    
    EndIf
    
    return CloseDX
    #110463 quote
    Nicolas
    Keymaster
    Master

    TODAY instruction has changed with v11, so now the only solution is to make a loop … Previously a simple solution would be to make simple substract: TODAY-DATE<=29 (it should still work in v10.3 though), you can test it with:

    once x = 29
    if today-date<=x then 
     if time=100000 then  
      drawhline(close)
     endif
    endif
    
    return

    Not tested, please do.

    BC thanked this post
    #110464 quote
    Vonasi
    Moderator
    Master

    I came up with this:

    p = 29                 //how many days ago you are looking for the close of
    closetime = 170000     //the close time that you are looking for p days ago
    displaytime = 000000   //the time that you want to start displaying that close time from
    
    a = time
    
    if barindex >= p and time = displaytime then
    timecount = 0
    for j = 0 to barindex
    if a[j] = closetime then
    timecount = timecount + 1
    if timecount = p then
    myclose = close[j]
    break
    endif
    endif
    next
    endif
    
    return myclose
    BC thanked this post
    #110503 quote
    BC
    Participant
    Master

    Thanks Nicolas, I tested but no luck.

     

    Thanks Vonasi, it work.

    #110506 quote
    Nicolas
    Keymaster
    Master

    Mine is working too!!! 😥

    #110507 quote
    Vonasi
    Moderator
    Master

    Mine is working too!!! 😥

    Perhaps BC did not apply it to the price chart. It is very messy compared to mine so I think mine still wins!

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

Close Yesterday 17:00h


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 15 replies,
has 6 voices, and was last updated by Nicolas
6 years, 3 months ago.

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