DRAWHLINE on daily and display on lower timeframes?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #102262 quote
    robdav
    Participant
    Veteran

    Hi

    I suspect it’s not possible but I thought I’d check.

    If you have an indicator that uses DRAWHLINE and you add it to a daily chart, is it possible to automatically display the lines drawn on lower time frames automatically?

    Many thanks

    Rob

    #102282 quote
    Nicolas
    Keymaster
    Master

    No, the objects plotted by codes are only visible on the chart/timeframe they are applied to.

    robdav thanked this post
    #230319 quote
    inverse
    Participant
    New

    Hello everyone,

    Is this still a thing in 2024 and can not be done or is it doable in V12?

    I’d like to have fib calcs (plotted by code) on a 1hr or 5min chart appear on lower TF, 1min or 10s for example.

    Cheers,

    inv

    #230325 quote
    robertogozzi
    Moderator
    Master

    No, it’s still not doable.

    #230339 quote
    inverse
    Participant
    New

    ah okay, thanks for the heads-up Roberto.

    #230351 quote
    druby
    Participant
    New

    Hi…

    Depending on complexity of what your trying to do,  the following could be an alternate option is some cases.

    Basically, add a custom indicator, call it ‘MAIN’, that only contains  a ‘CALL’ to another custom indicator let’s say ‘DATA’.

    Add ‘MAIN’ to all desired charts.

    Now the code in ‘DATA’ will run in all charts (price or stand alone) that contain ‘MAIN’.

    Therefore the  code in ‘DATA’ runs on all MAIN’s and if you modify ‘DATA’ and update it via the ‘ADD to indicator’ button, the changes are replicated onto all the charts. On the next tick event I think.

    Since, number of bars,barindex,intradaybarindex values are going to be different on different timeframes, using the x an y scale value of time and price, which appear the same on all charts, allows certain drawn objects to appear on all charts.

    Below are some simple examples of what could be achieved.

    Things to note, IMO, are:

    PRT appears to be an EVENT driven system, and the events are ‘ticks’

    For a bar to exist it needs a ‘tick’

    Code runs at the end of each bar.

    NO tick/bar, no bar, no run code, no update.

    regards druby

    DATA

    // 'CALL' this file from multiple charts and
    // replicate objects over all the charts from this file
    
    // object related to the 'x' and 'y' scale's of the chart
    // time, price.
    
    
    if islastbarupdate then // only draw objects on last bar
    
    
    //------------------------------------------------- V Line
    dt = 20240322// options ->   YYYYMMDD//yesterday//today
    tm = 123500  // hhmmss
    x1 = (dt * 1000000) + tm
    
    drawVline(datetoBarindex(x1)) coloured("violet",150)style(dottedline,1)
    
    
    //------------------------------------------------- line segment
    x1 = 20240319000000
    y1 = 60.6
    x2 = 20240323140000
    y2 = 73.1
    drawsegment(datetobarindex(x1),y1,datetobarindex(x2),y2)coloured("pink",150)
    x1 = 20240319080000
    y1 = 56
    x2 = 20240324163000
    y2 = 70
    drawsegment(datetobarindex(x1),y1,datetobarindex(x2),y2)coloured("pink",150)
    //------------------------------------------------- H Line
    level = 64
    drawHline(level) coloured("violet",150)style(dottedline,1)
    
    //------------------------------------------------- anchored text
    drawtext("Hello World!",0,0)anchor(middle,xshift,yshift)
    
    //------------------------------------------------- rectangle
    //   YYYYMMDDhhmmss
    x1 = 20240323080000
    y1 = 60
    x2 = 20240323163000
    y2 = 65
    drawrectangle(datetobarindex(x1),y1,datetobarindex(x2),y2)coloured("aqua",55)bordercolor("aqua",255)
    
    
    //------------------------------------------------- arrow
    drawArrowUp(datetobarindex(x1),66  )coloured("lime")
    
    
    
    endif // islastbarupdate
    //------------------------------------------------- backgroundcolor
    // trade session
    if opentime < 80000 or opentime > 163000 then
    
    if opendayofweek < 5 then
    backgroundcolor("grey",20)
    endif
    endif
    return

    MAIN

    CALL "DATA"
    return
    robertogozzi and inverse thanked this post
    #230357 quote
    robertogozzi
    Moderator
    Master

    Nice idea druby 🙂

    druby thanked this post
    #230361 quote
    druby
    Participant
    New

    Learn’t from the best!

    Regard druby

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

DRAWHLINE on daily and display on lower timeframes?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
robdav @robdav Participant
Summary

This topic contains 7 replies,
has 3 voices, and was last updated by druby
1 year, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/09/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...