Announcement

Collapse
No announcement yet.

Need help with an MA of Oscillator EFS

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

  • Need help with an MA of Oscillator EFS

    Hi all,

    First, let me thank the genious, Alex, for all the help getting me this far. Thank you very much Alex.

    I'm trying to figure our how to create a 10-period MA to the oscillator specified below, and have that plotted in the study, instead of the oscillator itself.

    -------------------------------------------------------------------

    function preMain() {

    setPriceStudy(false);
    setStudyTitle("Vix Oscillator");
    setCursorLabelName("Vix Oscillator", 0);
    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarThickness(1, 0);
    setPlotType(PLOTTYPE_LINE, 0);

    }

    function main() {

    return close(sym("$VIX")) / sma(10,close(sym("$VIX")));

    }

    function postMain() {


    }

  • #2
    george65202
    In your case the simplest solution to create a moving average of your oscillator is to use the efsExternal() function. Create a new efs and in main add the following lines

    PHP Code:
    var myOsc efsExternal("path/name_of_file.efs");//this calls the external efs and creates the required series
    var myMA  sma(10myOsc);//this creates a moving average of the series declared in the line above 
    If the new efs is in the same folder as the one that is being called then all you need to insert in place of "path/name_of_file.efs" is just the file name of the efs.
    If instead it is located in a different folder you will need to add the path to the folder in which the called efs is located followed by the file name of the efs. For example if the efs you are calling is in the Library subfolder of Formulas you would write "/Library/name_of_file.efs"
    Once you have done all the above then add the following to complete your efs

    PHP Code:
    return myMA
    For a description of the efsExternal() function complete with examples on how to use it see this thread. See also this article in the EFS KnowledgeBase for the syntax required by the function.
    Alex

    Comment


    • #3
      Still need help

      Alex, thanks for all the help.

      Unfortunately, I tried doing this exactly and I get an error message in the formula output window saying:

      ReferenceError: efsExternal is not defined

      I don't get what it could be. The external efs file is in the same folder, but even so I tried different efs files just to test it as well as trying to type the whole path, but the message remains the same.

      Here's the code.... this file is called vixosc2.efs and the external file is called visxosc.efs :

      function main() {
      var myOsc = efsExternal ( "vixosc.efs" );
      var myMA = sma(10, myOsc);
      return myMA;
      }

      Comment


      • #4
        george65202
        As far as I can see it is working fine at my end
        What version (including build) of eSignal are you running?
        Alex

        Comment


        • #5
          version

          version: eSignal 7.9 (Build 719)

          Comment


          • #6
            george65202
            You need to upgrade to version 7.9.1
            Alex

            Comment


            • #7
              thanks

              Yes, that did it. Thanks for all your help, Alex!!

              Comment

              Working...
              X