Announcement

Collapse
No announcement yet.

Finding Min, Max stochastic values

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

  • Finding Min, Max stochastic values

    I want to use the minimum stochastic value in the last 20 bars in an efs. Is there such a function as
    Min(stochK(14,6,3), 20) or an equivalent?

    After a search I found a highest() function, and a Math.max() function, but they seem to apply to price bars. I'm hoping there may be an existing efs with a Min(Study) function I could use as a guideline.

    Thanks
    shaeffer

  • #2
    Hello shaeffer,

    There isn't a single function that will retrieve this value for you. Alexis posted a function library solution for a similar request that you could use to accomplish your task in this post. You would just pass in 20 for the length and your Stochastic series for the source instead of 50 and high() as in the example. Duplicate the highestBarNdx() library function to retrieve the lowest value. The only difference would be to replace the Math.max with Math.min.
    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
      Hello shaeffer,

      After reviewing my reply I realized that I completely misinterpreted what you were asking for. My apologies. You were on the right track with the highest() function. You just need to pass the stochK series as the source to the function. Please try the following.

      PHP Code:
      var bInit false;
      var 
      xStochK null;
      var 
      xHighStochK null;

      function 
      main() {
          if (
      bInit == false) {
              
      xStochK stochK(1413);
              
      xHighStochK highest(20xStochK);
              
      bInit true;
          }

          return 
      xHighStochK.getValue(0);

      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


      • #4
        Hi Jason,

        Thanks for the reply. I didn't get to this efs yet.... I spent a huge part of the weekend trying to understand the high-low.efs.

        In that efs there were the same bInit true/false lines. Why are they needed? Referring to your reply, why not just include, after main()

        PHP Code:
        var xStochK stochK(1413
        Thanks
        shaeffer

        Comment


        • #5
          Hello shaeffer,

          The bInit routine is not required actually. Its just a more efficient way to use a series. You certainly can just initialize the series inside main() as in your example. The code gets executed on every execution of main(), which isn't necessary. The EFS2 engine doesn't actually reinitialize the series on every execution, however. It recognizes that a series with the same parameters has already been established and will just reference the existing series. Prior to EFS2 and version 7.9 we could not do it this way because the EFS1 engine would continue to make duplicate instances of the series on each execution of main(), which put a drain on memory. This behavior of the EFS2 engine is one of the major enhancements to the formula environment. Using a bInit routine is just a recommended practice to further enhance programming efficiency.
          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