Announcement

Collapse
No announcement yet.

Question regarding efsInternal and the inv() function

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

  • Question regarding efsInternal and the inv() function

    Hi I have a question regarding using the inv() function inside an efsInternal call function. Say I want my indicator to do calculations based on a 5 min chart when I'm using a 1 min chart. Something like this:

    function main(){

    var myStudy0 = ema(10,efsInternal("myFunc", 1,close(inv(5)),open(inv(5)));

    }

    function myFunc(y, closeP, openP){
    var x = closeP.getValue(0)...openP.getValue(0);
    return x;
    }

    Now it seems to work, but the values I'm getting from the indicator is different on a 1 min chart than a 5 min chart. From my understanding the code should work efsInternal passes a series of objects based on 5 min data and the efsInternal function does calculations based on the 5 min data.

    Any help would be greatly appreciated. Thanks!
    Last edited by goodsz; 01-28-2007, 09:39 PM.

  • #2
    hi please read my post below first.

    i have attached a picture showing two charts the top one a 5 min charts and the bottom one a 1 min chart. At exactly 10 am on the cursor window you can see the two values the indicator "test2" is giving is totally different.
    Attached Files
    Last edited by goodsz; 01-28-2007, 09:55 PM.

    Comment


    • #3
      Hello Goodsz,

      When you want a series created by efsInternal() to be based on an external interval, pass the interval as the last parameter with inv(). The other series that are being passed as parameters do not need to reference inv().

      Try something like the following.

      PHP Code:
      var bInit false;
      var 
      myStudy0 null;
      var 
      myStudy1 null;

      function 
      main(){

          if (
      bInit == false) {
              
      myStudy1 efsInternal("myFunc"1close(), open(), inv(5));
              
      myStudy0 ema(10myStudy1);
              
      bInit true;
          }
          
          
          return 
      getSeries(myStudy0);
      }

      function 
      myFunc(yclosePopenPsyminv){
          var 
      closeP.getValue(0) - openP.getValue(0);
          return 
      x;

      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