User defined trendline points

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

    Hello All,

    I am trying to code an indicator that will draw a line between two points on RSI like I have attached in the screen shot.

    I am wondering what is the best way to tell ProBuilder the coordinates if my line?

    Once I have these I thought I might be able to duplicate this line by calculating the slope with rise/run so I can have duplicates of the line on the indicator.

    I hope this will also allow me to get the value of the line at any given point in time.

    Any advice would be greatly appreciated,

    Many thanks,

    Tim.

    #200525 quote
    tabarrington
    Participant
    New

    Sorry about all the screenshot duplicates!

    #200528 quote
    JS
    Participant
    Senior
    Hi @tabarrington

    What are the conditions for these two points?

    Does the RSI have to be at a certain value or are only the dates of these points decisive?

    #200531 quote
    tabarrington
    Participant
    New
    Hi JS, Thankyou very much for the reply! RSI and date have to be at a certain value… Ive played around with a few things like DATETOBARINDEX(2022022117) to stop the X coordinates moving when a new bar is loaded which does work but Ive been unable to define a variable using that… Is there a way that you know of for saving a set point in time, such as DATETOBARINDEX(2022022117), to a variable? Many Thanks!!
    #200540 quote
    robertogozzi
    Moderator
    Master
    Sorry about all the screenshot duplicates!
    I deleted all duplicates. Please, do not embed documents of any type in your posts, as they slow down the loading of pages. Use the Select File button, instead, to attach them. Thank you 🙂
    tabarrington thanked this post
    #200580 quote
    JS
    Participant
    Senior
    defparam drawonlastbaronly=true
    
    MyFirstDate = 20220601
    MySecondDate = 20220902
    
    If Date = MyFirstDate then
    xFirstRSI = RSI[5](Close)
    EndIf
    If Date = MySecondDate then
    xSecondRSI = RSI[5](Close)
    EndIf
    
    drawsegment(datetobarindex(MyFirstDate),xFirstRSI,datetobarindex(MySecondDate),xSecondRSI) Coloured(255,0,0)
    drawtext("#xFirstRSI#",datetobarindex(MyFirstDate),xFirstRSI,dialog,bold,30) coloured(0,255,0)
    drawtext("#xSecondRSI#",datetobarindex(MySecondDate),xSecondRSI,dialog,bold,30) coloured(0,255,0)
    
    return //xFirstRSI as "First", xSecondRSI as "Second"
    Hi @tabarrington

    That’s right, you could use DateToBarIndex to draw your line between two dates and at certain levels.

    You then have to enter two dates, a start date and an end date.

    The indicator then draws the line between these two data and plots the values of the corresponding RSI.

    tabarrington thanked this post
    #200582 quote
    tabarrington
    Participant
    New
    You’re an absolute legend!!! Thank you so much for your help, I really appreciate it. Such a great community here, I wish I had found it years ago. Many thanks and have a great day. Tim
    JS thanked this post
    #200583 quote
    tabarrington
    Participant
    New
    No worries @robertogozzi, thanks for getting rid of those for me! T
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

User defined trendline points


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/11/2022
Status: Active
Attachments: 2 files
Logo Logo
Loading...