Announcement

Collapse
No announcement yet.

Cursor Window Values

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

  • Cursor Window Values

    Hi,
    Can anyone explain why the values in Cursor Window [sometimes] show zero [0] while the study is around +/-1?

    Please use ar reference the following example:

    var vCCI3 = cci(3, "close");

    return vCCI3.getValue(0)/100;



    Thank you
    Mihai Buta

  • #2
    Mihai
    FWIW the syntax in the example you provided is incorrect for both the efs1 and the efs2 CCI functions.
    Alex

    Comment


    • #3
      Alex,
      I saw that, but it is not the issue here.
      Has anyone tried?
      Does anyone has an explaination?
      Thank you.
      Mihai Buta

      Comment


      • #4
        Mihai
        Please post an image [of the Cursor Window and Formula Output Window] showing the discrepancy or provide a specific example (symbol, interval , study settings, etc) in which it occurrs so that others can try to replicate the same conditions.
        Alex

        Comment


        • #5
          Ok,

          Here it is:

          var stCCI3=cci(3);
          return stCCI3.getValue(0)/100;
          Mihai Buta

          Comment


          • #6
            Hello Mihai,

            The zeros that are appearing in the cursor window appear to be a rounding bug. The number is actually 0.9999999999999964 on the chart, the cursor window is just not displaying it correctly. I will report this to our development team. Thank you for posting.



            PHP Code:
            function preMain() {
                
            //setPriceStudy(true);
                
            setStudyTitle("test");
                
            //setShowCursorLabel(false);
                
            setCursorLabelName("data"0);
                
            setCursorLabelName("string"1);
                
            //setCursorLabelName("L", 1);
                //addBand(1.8500, PS_SOLID, 1, Color.blue, "tag");
            }

            var 
            stCCI3 null;

            function 
            main() {
                if (
            stCCI3 == nullstCCI3 cci(3);
                var 
            stCCI3.getValue(0);
                var 
            ret 100;
                
                return new Array(
            retret+"");

            Jason K.
            Project Manager
            eSignal - an Interactive Data company

            EFS KnowledgeBase
            JavaScript for EFS Video Series
            EFS Beginner Tutorial Series
            EFS Glossary
            Custom EFS Development Policy

            New User Orientation

            Comment


            • #7
              Hello Mihai,

              In the mean time, here is a work-around for the problem. Round the .getValue() result before dividing by 100. I think the source of the problem is related to floating point representation of numbers in javascript. The following code will fix the display in the cursor window.

              PHP Code:
              function preMain() {
                  
              //setPriceStudy(true);
                  
              setStudyTitle("test");
                  
              //setShowCursorLabel(false);
                  
              setCursorLabelName("data"0);
                  
              setCursorLabelName("string"1);
                  
              //setCursorLabelName("L", 1);
                  //addBand(1.8500, PS_SOLID, 1, Color.blue, "tag");
              }

              var 
              stCCI3 null;

              function 
              main() {
                  if (
              stCCI3 == nullstCCI3 cci(3);
                  var 
              stCCI3.getValue(0);
                  if (
              == null) return;
                  
                  var 
              ret = (n.toFixed(6)*1) / 100;
                  
                  if (
              getCurrentBarIndex() == -35) {
                      
              debugPrintln(n);
                  }
                  
                  return new Array(
              retret+"");

              Jason K.
              Project Manager
              eSignal - an Interactive Data company

              EFS KnowledgeBase
              JavaScript for EFS Video Series
              EFS Beginner Tutorial Series
              EFS Glossary
              Custom EFS Development Policy

              New User Orientation

              Comment


              • #8
                Hi Jason,

                Thank you and sorry for the late reply.
                I did something similar: I divided by 99.995.

                Thank you again.
                Mihai Buta

                Comment


                • #9
                  Hello Mihai,

                  You're most welcome and thank you for the update.
                  Jason K.
                  Project Manager
                  eSignal - an Interactive Data company

                  EFS KnowledgeBase
                  JavaScript for EFS Video Series
                  EFS Beginner Tutorial Series
                  EFS Glossary
                  Custom EFS Development Policy

                  New User Orientation

                  Comment

                  Working...
                  X