Announcement

Collapse
No announcement yet.

linear regression breakout.efs

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

  • linear regression breakout.efs

    is there any way to modify this efs so that it will alert if the price goes above a standard deviation line above or below the actual regression?

    thanks

  • #2
    Hello dirtypoolman2,

    Please post a copy of the formula and I'll take a look.
    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
      efs for Jason

      Jason:

      It's a copy of the code found in the program itself, listed below. Repeating, I'm looking for the routine to alert me when the price trades above a standard deviation line above or below the regression line.

      Thanks

      //{{EFSWizard_Description
      //
      // Fires an alert when the price moves below or higher the lower or upper Linear Regression lines.
      //
      //}}EFSWizard_Description 7532


      //{{EFSWizard_Declarations

      var vLinReg20 = new LinearRegressionStudy("Close", 20, 1);
      var vLastAlert = -1;

      //}}EFSWizard_Declarations 10369


      /**
      * This function is called only once, before any of the bars are loaded.
      * Place any study or EFS configuration commands here.
      */
      function preMain() {
      //{{EFSWizard_PreMain
      setPriceStudy(true);
      setStudyTitle("Linear Regression Breakout");
      //}}EFSWizard_PreMain 8010
      }

      /**
      * The main() function is called once per bar on all previous bars, once per
      * each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
      * in your preMain(), it is also called on every tick.
      */
      function main() {

      //{{EFSWizard_Expressions
      //{{EFSWizard_Expression_1
      if (
      close() < vLinReg20.getValue(LinearRegressionStudy.LOWER)
      ) onAction1()
      //}}EFSWizard_Expression_1 10497

      //{{EFSWizard_Expression_2
      else if (
      close() > vLinReg20.getValue(LinearRegressionStudy.UPPER)
      ) onAction2();
      //}}EFSWizard_Expression_2 13076

      //}}EFSWizard_Expressions 48125

      //{{EFSWizard_Return
      return null;
      //}}EFSWizard_Return 2256
      }

      //{{EFSWizard_Actions
      //{{EFSWizard_Action_1
      function onAction1() {
      if (vLastAlert != 1) Alert.addToList(getSymbol(), "Price below lower Linear Regression line", Color.RGB(0,0,0), Color.RGB(195,0,0));
      vLastAlert = 1;
      }
      //}}EFSWizard_Action_1 19787

      //{{EFSWizard_Action_2
      function onAction2() {
      if (vLastAlert != 2) Alert.addToList(getSymbol(), "Price above upper Linear Regression line.", Color.RGB(0,0,0), Color.RGB(0,0,255));
      vLastAlert = 2;
      }
      //}}EFSWizard_Action_2 18830

      //}}EFSWizard_Actions 59627

      Comment


      • #4
        Sorry I can't be more help, but perhaps this thread has some ideas for you.

        http://forum.esignalcentral.com/show...dard+deviation

        Comment


        • #5
          Hello dirtypoolman2,

          Did you find what you needed in the post David pointed you to?
          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


          • #6
            Jason,

            Yes I did, and thanks to both you and David for your assistance. You have a great resource here.

            Comment

            Working...
            X