indicator variable no longer working in v11

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #162308 quote
    emmkay
    Participant
    New

    Hi, since moving to v11 from 10.3 one of the variables in an indicator i use no longer works. basically if the variable is true then it should only display the horizontal lines on bars for “today”.

    i’m not very good with coding so hoping someone can help me out? –  attached a picture of the variables.

    defparam drawonlastbaronly = true
    
    MP = UNDEFINED
    CBOL = UNDEFINED
    CBOS = UNDEFINED
    MR3 = UNDEFINED
    MR2 = UNDEFINED
    MR1 = UNDEFINED
    MS1 = UNDEFINED
    MS2 = UNDEFINED
    MS3 = UNDEFINED
    MMLO = UNDEFINED
    MMHI = UNDEFINED
    MGAP = UNDEFINED
    MPDH = UNDEFINED
    MPDL = UNDEFINED
    
    
    SHOW = (TodayOnly and DATE[0] > Yesterday)
    
    IF SHOW or NOT TodayOnly THEN
    MP = ( (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) - 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(169,169,169) as "Pivot", CBOL COLOURED(30,144,255) as "CBOL", CBOS COLOURED(30,144,255) as "CBOS", MR3 COLOURED(218,165,32) as "R3", MR2 COLOURED(218,165,32) as "R2", MR1 COLOURED(218,165,32) as "R1", MS1 COLOURED(218,165,32) as "S1", MS2 COLOURED(218,165,32) as "S2", MS3 COLOURED(218,165,32) as "S3", MGAP COLOURED(0,0,0) as "Close", MMHi COLOURED (220,20,60) as "Hi", MMLo COLOURED (220,20,60) as "Lo", MPDH COLOURED (220,20,60)style(dottedline,2) as "2DHi", MPDL COLOURED (220,20,60)style(dottedline,2) as "2DLo"
    variables.png variables.png
    #162315 quote
    Vonasi
    Moderator
    Master

    emmkay – Welcome to the forums but….. please follow the forum rules and do not double post. I have deleted your other similar question that you added to another old topic.

    • Do not double post. Ask your question only once and only in one forum. All double posts will be deleted anyway so posting the same question multiple times will just be wasting your own time and will not get you an answer any quicker. Double posting just creates confusion in the forums.
    #162329 quote
    Nicolas
    Keymaster
    Master

    In PRT v11, yesterday is the date from the previous day, even in history, so your condition to show levels only on the current day is not longer working. In fact, there is no “easy” workaround or replacement for this change. A complete rewrite of the indicator is needed in this case.

    #162402 quote
    emmkay
    Participant
    New

    Thank you for your reply Nicolas, in that case would it be possible to show for bars >= yesterday? ultimately I just didn’t want the horizontal lines extending to the left on the chart.

    #162405 quote
    Nicolas
    Keymaster
    Master

    Here is a modified code that plot segments for your pivot points only for the current day. I only recoded 2 segments for example, you’ll have to code the rest the same way as I did 😉

    defparam drawonlastbaronly = true
    
    Mclose=130
    Mhi=135
    Mlo=132.5
    PDH=138
    PDL=131
    
    if intradaybarindex=0 then 
    start = barindex
    endif 
    
    MP = ( (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) - MLo
    MS1 = (2 * MP) - MHi
    MS2 = MP - (MHi - MLo)
    MS3 = MLo - ( 2 * (MHi - MP) )
    MMLO = MLO
    MMHI = MHI
    MPDH = PDH
    MPDL = PDL
    MGAP = MCLOSE
    
    drawsegment(start,MP,barindex,MP) coloured(169,169,169)
    drawsegment(start,CBOL,barindex,CBOL) COLOURED(30,144,255)
    
    return 
    //RETURN MP COLOURED(169,169,169) as "Pivot", CBOL COLOURED(30,144,255) as "CBOL", CBOS COLOURED(30,144,255) as "CBOS", MR3 COLOURED(218,165,32) as "R3", MR2 COLOURED(218,165,32) as "R2", MR1 COLOURED(218,165,32) as "R1", MS1 COLOURED(218,165,32) as "S1", MS2 COLOURED(218,165,32) as "S2", MS3 COLOURED(218,165,32) as "S3", MGAP COLOURED(0,0,0) as "Close", MMHi COLOURED (220,20,60) as "Hi", MMLo COLOURED (220,20,60) as "Lo", MPDH COLOURED (220,20,60)style(dottedline,2) as "2DHi", MPDL COLOURED (220,20,60)style(dottedline,2) as "2DLo"
    pivot-points-asx.png pivot-points-asx.png
    #162596 quote
    emmkay
    Participant
    New

    Thank you Nicolas this has worked perfectly! your help has been greatly appreciated!

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

indicator variable no longer working in v11


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
emmkay @emmkay Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by emmkay
4 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/22/2021
Status: Active
Attachments: 2 files
Logo Logo
Loading...