Show or not show indicator value

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #113943 quote
    snow_onar
    Participant
    Senior

    Hello

    What is best practice to show or not to show an indicator value with return?

    I would like to have a check box, where I can chose to show the 26 week line or not to show the 26 week line in the following indicator:

    //
    // Highest High 20 days or 26 week according to Larry Williams
    //
    hh20 = highest[20](high)
    hl20 = lowest[20](low)
    //hh26w = highest[128](high)
    //hl26w = lowest[128](low)
    
    if show26 = 1 then
    hh26w = highest[128](high)
    hl26w = lowest[128](low)
    endif
    
    
    
    return hh20 coloured (0,128,255) as "Hishest High 20 Days", hl20 coloured (0,128,255) as "Hishest Low 20 Days",hh26w coloured (0,255,255) as "Hishest High 26 Week", hl26w coloured (0,255,255) as "Hishest Low 26 Week"
    #113945 quote
    robertogozzi
    Moderator
    Master

    Add a 4th (optional) parameter with colour, it’s called Transparency or Fade and has a rang from 0 (invisible) to 255 (max visibility):

    coloured (0,128,255,255)

    you can use a variable and set it to 0 when you don’t want that line to be visible or any greater number to make it more or less visible:

    t = 255
    IF DontShow = 1 THEN
       t = 0
    ENDIF
    RETURN xyz coloured (0,128,255,t) AS "xyz"
    #113947 quote
    Vonasi
    Moderator
    Master

    Or set it as UNDEFINED. The trouble with setting it as zero is that even when transparent a zero value line is drawn and the scaling of the chart is messed up.

    //
    // Highest High 20 days or 26 week according to Larry Williams
    //
    
    hh20 = highest[20](high)
    hl20 = lowest[20](low)
    
    if show26 then
    hh26w = highest[128](high)
    hl26w = lowest[128](low)
    else
    hh26w = undefined
    hl26w = undefined
    endif
    
    
    
    return hh20 coloured (0,128,255) as "Hishest High 20 Days", hl20 coloured (0,128,255) as "Hishest Low 20 Days",hh26w coloured (0,255,255) as "Hishest High 26 Week", hl26w coloured (0,255,255) as "Hishest Low 26 Week"
    robertogozzi and snow_onar thanked this post
    #113953 quote
    Nicolas
    Keymaster
    Master

    Useful tip: the scaling is not messed up if you define your price option to adapt the scale to price only (setting available in the price menu).

    Vonasi, robertogozzi and snow_onar thanked this post
    #114156 quote
    snow_onar
    Participant
    Senior

    Thanks for your effort. This solution is working very good.

    #114208 quote
    JC_Bywan
    Moderator
    Master

    Or go to the indicator window top left corner, then click on the spanner to open its properties window, and there on the left side click on your 26 week line and on the right side you can set its “style” where the last option after the type of line, or point etc… is: “invisible”

    #114216 quote
    Vonasi
    Moderator
    Master

    invisible

    This works fine if you supply an ITF file and have fixed the settings before exporting it but if someone cuts and pastes code then the UNDEFINED option is a little more idiot proof.

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

Show or not show indicator value


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
snow_onar @snow_onar Participant
Summary

This topic contains 6 replies,
has 5 voices, and was last updated by Vonasi
6 years, 2 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/30/2019
Status: Active
Attachments: No files
Logo Logo
Loading...