Announcement

Collapse
No announcement yet.

Problem calling efs

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

  • Problem calling efs

    I am calling a file (attached below) and attempting to pass the contents of the array to another EFS.

    I have amended Jurik's JMADWMAMACD file to get the MACD for the previous two bars as you will see in the attached file.

    I am calling the values as follows:

    if (getBarState() == BARSTATE_NEWBAR) {

    var myMACD = call("CalledCleanMACD.efs");
    vMACD = myMACD[3];
    vMACDminus = myMACD[4];
    vMACDminustwo = myMACD[5];
    }

    In the calling EFS I am getting an error when I try to load it which is saying "TypeError: myMACD has no properties".

    Anyone got any idea where I am going wrong?

    Thanks.

    Deax.
    Attached Files

  • #2
    Deax
    Elements in the array are numbered starting from [0] so you need to change the variables to myMACD[2], [3] and [4]. Then run a null check on each of those variables.
    For some examples see this thread
    Alex

    Comment


    • #3
      Hi Alex,

      I have amended the called formula and attached it below. I have also done as you suggest by amending the bracketed figures and running a null check in the calling formula, but I still get the same error, i.e. "TypeError: myMACD has no properties". My calling formula now looks like this:

      if (getBarState() == BARSTATE_NEWBAR) {

      var myMACD = Call("LastCalledJMADWMAMACD.efs");
      vMACD = myMACD[0];
      vMACDminus = myMACD[1];
      vMACDminustwo = myMACD[2];

      if (vMACD == null || vMACDminus == null || vMACDminustwo == null) return;
      }

      The error is occuring on the line

      vMACD = myMACD[0];

      I cannot see why this is not working. Am I missing something very obvious? Many thanks Alex for your help.

      I can load the called formula (attached) and it is giving me exactly the output I want, but I cannot call that output from the calling formula.

      BTW in the calling formula, I have set the above three variables as global variables (before PreMain) and made them equal to null, as below.

      var myMACD = null;
      var vMACD = null;
      var vMACDminus = null;
      var vMACDminustwo = null;

      Any help greatly appreciated.

      Deax.
      Attached Files

      Comment


      • #4
        Folks,

        I have solved the problem.

        Deax.

        Comment

        Working...
        X