Horizontal Line Candle Open and Time

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #63308 quote
    JTulleyJTulley
    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
    NicolasNicolas
    Keymaster
    Legend

    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
    JTulleyJTulley
    Participant
    New

    Thanks for the quick reply.

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

    #63312 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Change line 7 as follows

    if intradaybarindex>=0 then
    #63314 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Actually you can remove both line 7 and 9.

    #63316 quote
    JTulleyJTulley
    Participant
    New

    That’s an improvement.

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

    #63318 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    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
    JTulleyJTulley
    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.
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

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 JTulleyJTulley
8 years, 7 months ago.

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