Announcement

Collapse
No announcement yet.

problem w/passing values in efsExternal

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

  • problem w/passing values in efsExternal

    Hi Alexis,

    In the enclosed script, I am trying to pass different values to an efsExternal reference which is giving me an error reading. If I call this: efsExternal("/Library/SchirdingStoch.efs") all is well. But if I try this : efsExternal("/Library/SchirdingStoch.efs",7,3,3), it is looking for two more parameters, one of which gives an error reading of: "Parameter #1 setDefaultBarThickness is invalid", and if I add that parameter to the efsExternal call (("/Library/SchirdingStoch.efs",7,3,3,1), I get the error reading of : "Parameter #1 of Function setDefaultBarColor is invalid". It seems I can't pass this last parameter. I tried null and "", but I still get the error message.

    Can I not change the parameter values this way by adding the new parameters such as: (("/Library/SchirdingStoch.efs",7,3,3)??

    I'm still learning the ins and outs of the call functions. Any help would be appreciated.!!!!

    angelo
    Attached Files
    ang.

  • #2
    Alex,

    here is the Harry Schirding Stochastic file.
    Attached Files
    ang.

    Comment


    • #3
      angelo
      If you look at line 72 of schirdingstoch.efs you will see listed in its main definition all the parameters that the efs expects to receive if any parameter is being passed to it.
      PHP Code:
      function main(nLengthnKnDnThickKnThickDcColorKcColorD) { 
      Therefore if you include any one parameter in your efsExternal() call to that efs you also need to pass all the other parameters that the called efs is expecting. In your case you would need to modify your efsExternal() call to the following
      PHP Code:
      var myvar efsExternal("/Library/SchirdingStoch.efs",7,3,3,2,2,Color.red,Color.blue); 
      Note that the values I selected for the added parameters are the defaults used in the shirdingstoch.efs script.
      If you want to avoid having to pass all those parameters and would like to include only those specific to the stochastic then you will need to modify the schirdingstoch.efs and remove them from that script's main definition. In doing so you will also need to comment out lines 79-82 of that efs else you will get an error.
      Alex

      Comment


      • #4
        angelo
        Adding to my prior reply with some comments on the _blau ds_stoch[14,3,3]trial.efs
        1) If you are initalizing the variables inside a bInit statement as in lines 57-61 you don't need to also check for null as that is redundant. You can write that section of code as either
        PHP Code:
        if (bInit == false){
            
        DS_Stoch = (amLib.amDSStoch(q,r,s));
            
        DS_Sig = eval(Type)(u,DS_Stoch);
            
        bInit true;

        or leave them as they were in the original script ie without the bInit statement
        PHP Code:
        if(DS_Stoch==nullDS_Stoch = (amLib.amDSStoch(q,r,s));
        if(
        DS_Sig==nullDS_Sig = eval(Type)(u,DS_Stoch); 
        The result is the same as the studies will be initialized only once in either case.
        2) To make the script more efficient you may want to include in the bInit statement also the efsExternal() call to the schirdingstoch.efs. Before you do that you will need to declare the variable myvar as a global variable (ie outside of function main) and set it initially to null. Then move the efsExternal() call inside the bInit statement as follows
        PHP Code:
        if (bInit == false){
            
        DS_Stoch = (amLib.amDSStoch(q,r,s));
            
        DS_Sig = eval(Type)(u,DS_Stoch);
            
        myvar efsExternal("/Library/SchirdingStoch.efs",7,3,3,1,1,Color.red,Color.blue);
            
        bInit true;

        3) Once you have completed writing the efs comment out all the debugPrinln() commands as they will slow down the efs considerably.
        Alex

        Comment


        • #5
          Thanks Alex,

          Thanks for the quick response..... I didn't know you moved my original question...... and now I know how to find them also!

          Once again, you have helped clarify and define the errors that I've been making in writing scripts.

          Also , thanks for pointing out and suggesting the correct ways to "bInit " the script. Now I see the many redundant errors and mistakes that I have generally been making in calling efs.

          One more question, can setComputeOnClose() be called in main(),
          or is it a premain function only. How does one make the use of turning it on and off within a formula, without doing it manually?

          Also, if I call a script that computes mov avg's and want the values to compute only on a close basis, can I have another script running and computing intrabar basis at the same time???
          Is there a way to accomplish this??


          Again, thanks for your help...your knowledge is immeasurable!

          angelo
          ang.

          Comment


          • #6
            angelo
            Thank you for the kind words.

            can setComputeOnClose() be called in main()
            Yes it can.

            How does one make the use of turning it on and off within a formula, without doing it manually?
            In the main() function enclose the setComputeOnClose() command in a conditional statement that checks for a parameter that you set with a FunctionParameter.
            Having said this I would not recommend using setComputeOnClose() for various reasons amongst which is the fact that it is not compatible with the efsInternal() and efsExternal() functions and/or when calling external intervals.
            Alex

            Comment

            Working...
            X