Horizontal Line Candle Open and Time

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #63308 quote
    JTulley
    Participant
    New

    Hello Forum Members,

    I would like to draw a horizontal line at the open of the 08:00 candle from the previous day, using an M5 timeframe.

    I can see that this might be done by counting back bars from the current time, but I suspect that there’s probably a more elegant solution.

    Can anyone suggest how this can be done?

    Thank You

    #63310 quote
    Nicolas
    Keymaster
    Master

    Could you test this code? I think it should works.

    defparam drawonlastbaronly=true
    
    if opentime=080000 then 
     value=close
    endif
    
    if intradaybarindex=0 then 
     drawhline(value)
    endif
    
    return
    #63311 quote
    JTulley
    Participant
    New

    Thanks for the quick reply.

    Unfortunately this code doesn’t draw a line for me.

    #63312 quote
    robertogozzi
    Moderator
    Master

    Change line 7 as follows

    if intradaybarindex>=0 then
    #63314 quote
    robertogozzi
    Moderator
    Master

    Actually you can remove both line 7 and 9.

    #63316 quote
    JTulley
    Participant
    New

    That’s an improvement.

    I get a line now, but at Today’s 08:00, rather than yesterdays.

    #63318 quote
    robertogozzi
    Moderator
    Master

    Write line 4 as

    value=close[288]

    because there are 24 * 12 5-minute bars in a day your are going to get yesterday’s value.

    #63319 quote
    JTulley
    Participant
    New

    Perfect,

    Thank you Nicolas and Roberto.

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

Horizontal Line Candle Open and Time


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
JTulley @jtulley Participant
Summary

This topic contains 7 replies,
has 3 voices, and was last updated by JTulley
7 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/20/2018
Status: Active
Attachments: No files
Logo Logo
Loading...