"Display Line Name" code
Forums › ProRealTime English forum › ProBuilder support › "Display Line Name" code
- This topic has 10 replies, 2 voices, and was last updated 7 years ago by Bullan.
-
-
12/16/2016 at 8:49 AM #18631
Hi there
I was after the code that allows you to add a line name option to various lines that are produced by an indicator, very similar to the “Pivot Points” indicator, which allows you to toggle on/off the line name of the various pivots i.e. R1, R2,R3 etc etc. Unfortunately I haven’t been able to access the code for that particular indicator.
Thanks a lot in advance.
12/16/2016 at 2:42 PM #18663Add text on chart is only possible with the new instructions of the PRT 10.3 version. What version are you using?
I remember have made something similar, as an example in the documentation, you can find the code right here (first example): draw text on chart
Please tell us if you have any other trouble or questions. Thank you.
12/16/2016 at 4:18 PM #1867612/16/2016 at 6:42 PM #18683Hi Nicolas,
I think it may be a bit tricky for me to try and work out, I am not much of a coder I am afraid and it could be, as you say, that the labelling isn’t an option on v10.2 (although I was using one of PRT’s standard indicators and they had labels attached so there must be a way to do it). Not sure if you are able to assist nay further but I have added below the indicator code as it may assist:
MP = UNDEFINED
CBOL = UNDEFINED
CBOS = UNDEFINED
CSHT = UNDEFINED
CLNG = UNDEFINED
MR3 = UNDEFINED
MR2 = UNDEFINED
MR1 = UNDEFINED
MS1 = UNDEFINED
MS2 = UNDEFINED
MS3 = UNDEFINED
MMLO = UNDEFINED
MMHI = UNDEFINED
MGAP = UNDEFINED
MPDH = UNDEFINED
MPDL = UNDEFINEDSHOW = (TodayOnly and DATE[0] > Yesterday)
IF SHOW or NOT TodayOnly THEN
MP = ( (MClose + MHi + MLo ) / 3)
CBOL = MClose + ( ( (MHi – MLo) * 1.1) / 2)
CSHT = MClose + ( ( (MHi – MLo ) * 1.1) / 4)
CBOS = MClose – ( ( (MHi – MLo ) * 1.1) / 2)
CLNG = MClose – ( ( (MHi – MLo ) * 1.1) / 4)
MR3 = MHi + ( 2 * (MP – MLo) )
MR2 = MP + (MHi – MLo)
MR1 = (2 * MP) – MLo
MS1 = (2 * MP) – MHi
MS2 = MP – (MHi – MLo)
MS3 = MLo – ( 2 * (MHi – MP) )
MMLO = MLO
MMHI = MHI
MPDH = PDH
MPDL = PDL
MGAP = MCLOSE
ENDIF
RETURN MP COLOURED(95,95,100) as “Pivot”, CBOL COLOURED(30,235,5) as “CBOL”, CLNG COLOURED(30,235,5) as “CLNG”, CSHT COLOURED(30,235,5) as “CSHT”, CBOS COLOURED(30,235,5) as “CBOS”, MR3 COLOURED(45,75,240) as “R3”, MR2 COLOURED(45,75,240) as “R2”, MR1 COLOURED(45,75,240) as “R1”, MS1 COLOURED(45,75,240) as “S1”, MS2 COLOURED(45,75,240) as “S2”, MS3 COLOURED(45,75,240) as “S3”, MGAP COLOURED(235,5,30) as “Close”, MMHi COLOURED (235,5,30) as “Hi”, MMLo COLOURED (235,5,30) as “Lo”, MPDH COLOURED (230,90,10) as “PDH”, MPDL COLOURED (230,90,10) as “PDL”Thanks a lot
Andrew
12/16/2016 at 8:32 PM #18690> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<
Well, as I told you, labeling is not possible with the code in PRT version before 10.3 I’m sorry. The best you could do is to add a different color for each of the returned lines of your indicator.
12/16/2016 at 10:13 PM #18693Thanks Nicolas, will stick with the coloured lines for the time being. Only reason I think it is possible is that on v10.2, there are pro real time indicators that have line labels on them by default so you would think that there is a way of doing it. I have emailed them directly so will see how I get on. Noted re attaching code, makes sense. Cheers
03/21/2017 at 6:24 PM #29339Hi Nicolas,
I have now managed to upgrade to V10.3 – I have attached the PRT code. Any chance you could help me by just including the formula (and any other initial code that is required) for one of the pivots into the existing code and I can then go ahead and replicate for the remaining ones. Basically just looking to have the labels on the righthand side above the lines
Thanks a lot
Andrew
12345678910111213141516171819202122232425262728293031323334353637383940MP = UNDEFINEDCBOL = UNDEFINEDCBOS = UNDEFINEDMR3 = UNDEFINEDMR2 = UNDEFINEDMR1 = UNDEFINEDMS1 = UNDEFINEDMS2 = UNDEFINEDMS3 = UNDEFINEDMPOM = UNDEFINEDMMLO = UNDEFINEDMMHI = UNDEFINEDMGAP = UNDEFINEDMPDH = UNDEFINEDMPDL = UNDEFINEDM50PDR = UNDEFINEDSHOW = (TodayOnly and DATE[0]>Yesterday)IF SHOW or NOT TodayOnly THENMP = ( (MClose + MHi + MLo ) / 3)CBOL = MClose + ( ( (MHi - MLo) * 1.1) / 2)CBOS = MClose - ( ( (MHi - MLo ) * 1.1) / 2)MR3 = MHi + ( 2 * (MP - MLo) )MR2 = MP + (MHi - MLo)MR1 = (2 * MP) - MLoMS1 = (2 * MP) - MHiMS2 = MP - (MHi - MLo)MS3 = MLo - ( 2 * (MHi - MP) )MPOM = POMMMLO = MLOMMHI = MHIMPDH = PDHMPDL = PDLMGAP = MCLOSEM50PDR = (((MHI - MLO)) * (0.5)) + MLOENDIFRETURN MP COLOURED (153,153,153,255) as "Pivot", CBOL COLOURED (8,178,45,255) as "CBOL", CBOS as "CBOS", MR3 COLOURED (255,153,0,255) as "R3", MR2 COLOURED (255,153,0,255) as "R2", MR1 COLOURED (255,153,0,255) as "R1", MS1 COLOURED (0,153,153,255) as "S1", MS2 COLOURED (0,153,153,255) as "S2", MS3 COLOURED (0,153,153,255) as "S3", MGAP as "Gap", MMHi COLOURED (102,204,0,255) as "Previous Days High", MMLo COLOURED (255,51,0,255) as "Previous Days Low", MPOM as "Pom", MPDH COLOURED (5,255,25,255) as "2 Day High", MPDL COLOURED (255,0,204,255) as "2 Day Low", M50PDR COLOURED (204,204,0,255) as "50% of Previous Days Range"REM RETURN MP as "Pivot", CBOL as "CBOL", CBOS as "CBOS", MR3 as "R3", MR2 as "R2", MR1 as "R1", MS1 "S1", MS2 as "S2", MS3 as "S3", MGAP as "Gap", MMHi as "Previous Days High", MMLo as "Previous Days Low", MPOM as "Pom", MPDH as "2 Day High", MPDL as "2 Day Low", M50PDR as "50% Previous Days Range"03/27/2017 at 2:44 PM #2999503/28/2017 at 11:02 AM #30102Thanks Nicolas, appreciate it, I tried putting just part of the formula in for the pivot to see if could get it working just for one line before adding the rest and it came up with an error with the voffset element – I am sure there is an easy fix but have zero programming skills so doesn’t stand out for me. Any help would be great. I have attached a link for a screen shot of the formula
Thanks
03/30/2017 at 9:34 AM #3027803/30/2017 at 10:46 AM #30295 -
AuthorPosts
Find exclusive trading pro-tools on