Announcement

Collapse
No announcement yet.

Too many digits after the dot

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

  • Too many digits after the dot

    Hi,

    The price represent the Envelop indicator on my chart is seven digits after the dot. How can I force it to be two digits only,

    Thanks,

    Amnon
    Amnon

  • #2
    Hello Amnon,

    You'll need to do this with an EFS study. Make a copy of \Formulas\EFS 2 Basic\basicEnvelope.efs and change the return statement to the following. The .toFixed(2)*1 will force the display for the indicator to 2 decimals.

    PHP Code:
    function main() {

        return new Array (  (
    upperEnv(20,0,10)).toFixed(2)*1,
                            (
    middleEnv(20,0,10)).toFixed(2)*1,
                            (
    lowerEnv(20,0,10)).toFixed(2)*1
                         
    );

    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


    • #3
      Thanks JasonK,

      But I have lost the ability to control the data parameters (Or I have done something wrong, only copied from your message to the right place)

      Amnon
      Amnon

      Comment


      • #4
        Hello Amnon,

        To allow you change the parameters for the EFS through Edit Studies you can add the corresponding inputs with the FunctionParameter Object. For a complete code example, see \Formulas\EFS 2 Custom\customEnvelope.efs. You only need to copy the first 3 function parameters from that example for Length, Type and Percent. You can use the same return statement I gave you in the prior reply, just replace the hard coded values of 20, 0, 10 with Length, Type, Percent (i.e. upperEnv(Length,Type,Percent)).toFixed(2)*1 ). If you need to learn more about how to code formula parameters, see Beginner Tutorial 3: Introduction to preMain() and main(), section 4.
        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


        • #5
          Too many digits after the dot

          Hi JasonK,

          I can't change the percent data in the formula itself because every stock have a different percent envelop according to it's behavior, so I have to use the edit studies on the stock chart.

          Thanks,

          Amnon
          Amnon

          Comment

          Working...
          X