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.
Sorry about all the screenshot duplicates!
JSParticipant
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?
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!!
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 🙂
JSParticipant
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.
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
No worries
@robertogozzi, thanks for getting rid of those for me!
T