Announcement

Collapse
No announcement yet.

Bar length - how to hide the graph?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bar length - how to hide the graph?

    I have coded this to display length of each bar as I move cursor onto the bar.
    I don't want to see the values plot on the chart but would like to see the value on the data window.

    How do I hide the graph/plot to save space and at the same time display the value on data window?

    Thank You
    Steven



    function main() {

    setStudyTitle("Bar Length");
    setCursorLabelName("BL");

    return(high(0)-low(0));

    }
    Attached Files

  • #2
    Steven
    First set the study as a price study (rather than a non-price study). Then return the values of your equation as a string rather than a number. An EFS will not plot strings although it will report the values in the Data Window.
    If you search the forum you will find several examples on how to do this as the topic has been covered at length before
    Alex


    Originally posted by stevents View Post
    I have coded this to display length of each bar as I move cursor onto the bar.
    I don't want to see the values plot on the chart but would like to see the value on the data window.

    How do I hide the graph/plot to save space and at the same time display the value on data window?

    Thank You
    Steven



    function main() {

    setStudyTitle("Bar Length");
    setCursorLabelName("BL");

    return(high(0)-low(0));

    }

    Comment


    • #3
      Thanks Alex.

      I found a few examples searching on "plot string" or "string". The best one I think is using formatPriceNumber() to convert to string and returns the symbol's price value by default.
      It does not print the values on the price chart and bar length is displayed on data window.

      However, it shows the blank inner window. It shouldn't if I set setPriceStudy(true) as it can't display string and should be on the price chart.
      Why is a blank inner window created?
      Is this due to return()?
      Have I missed something?


      function main() {

      //displays on price chart, but wont due to formatPriceNumber
      //convert to string
      setPriceStudy(true);
      setStudyTitle("Bar Length");
      setCursorLabelName("BL");

      return(formatPriceNumber(high(0)-low(0)));

      }
      Attached Files

      Comment


      • #4
        stevents

        However, it shows the blank inner window. It shouldn't if I set setPriceStudy(true)
        That is because the setPriceStudy() statement needs to be in the preMain() function (see enclosed image)
        Alex




        Originally posted by stevents View Post
        Thanks Alex.

        I found a few examples searching on "plot string" or "string". The best one I think is using formatPriceNumber() to convert to string and returns the symbol's price value by default.
        It does not print the values on the price chart and bar length is displayed on data window.

        However, it shows the blank inner window. It shouldn't if I set setPriceStudy(true) as it can't display string and should be on the price chart.
        Why is a blank inner window created?
        Is this due to return()?
        Have I missed something?


        function main() {

        //displays on price chart, but wont due to formatPriceNumber
        //convert to string
        setPriceStudy(true);
        setStudyTitle("Bar Length");
        setCursorLabelName("BL");

        return(formatPriceNumber(high(0)-low(0)));

        }

        Comment


        • #5
          Hi Alex, Thank You so much for your help on this.
          Works like a gem!

          Always wonder why you need premain() as main() works. Well much more reading on my part.

          Steven

          Comment


          • #6
            Steven
            You are welcome
            I would suggest that you read through the Beginner Tutorials 1 through 4 [and specifically 3 that relates to preMain and main] which you can find in the Help Guides and Tutorials folder of the EFS KnowledgeBase
            Alex


            Originally posted by stevents View Post
            Hi Alex, Thank You so much for your help on this.
            Works like a gem!

            Always wonder why you need premain() as main() works. Well much more reading on my part.

            Steven

            Comment


            • #7
              Will do!
              Much appreciated as I spent a lot of time trying to figure out what was wrong.

              Comment


              • #8
                Steven
                Again you are welcome
                Alex


                Originally posted by stevents View Post
                Will do!
                Much appreciated as I spent a lot of time trying to figure out what was wrong.

                Comment

                Working...
                X