Announcement

Collapse
No announcement yet.

Curved channel lines around Linear Regression Curve

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

  • Curved channel lines around Linear Regression Curve

    I’ve searched the existing posts and I have seen some other ESignal users looking for help on this, but there was no final solution to this simple for experienced ESignal coders problem:

    1. Need to be able to plot channel curved lines at 1 and 2 std deviations from Linear Regression Curve. This would be similar to Bollinger Bands, except using Linear Regression as middle line. I’ve found multiple .efs files plotting Linear Regression Curve itself: Mel Raiman’s is here: http://forum.esignalcentral.com/atta...=&postid=87421 and at least 2 others are posted on this forum as well, but none have std dev bands around them. Mel Raiman’s actually plots std dev lines, so std dev level is shown for the most current bar, which is great, but bands would be sooooo helpful, to review past.
    2. Also, I need to be able to output these very Linear Reg and std dev values into MS Excel and I’ve found this thread, explaining how to set up DDE output: http://forum.esignalcentral.com/show...&postid=44465, however I am unable to modify it correctly, being very new here.

    This takes me about 30 seconds to code in Tradestation, but too new to Esignal. Please help.

    Alex.

  • #2
    Re: Curved channel lines around Linear Regression Curve

    Hello Alex,

    Originally posted by balancing1
    I’ve searched the existing posts and I have seen some other ESignal users looking for help on this, but there was no final solution to this simple for experienced ESignal coders problem:

    1. Need to be able to plot channel curved lines at 1 and 2 std deviations from Linear Regression Curve. This would be similar to Bollinger Bands, except using Linear Regression as middle line. I’ve found multiple .efs files plotting Linear Regression Curve itself: Mel Raiman’s is here: http://forum.esignalcentral.com/atta...=&postid=87421 and at least 2 others are posted on this forum as well, but none have std dev bands around them. Mel Raiman’s actually plots std dev lines, so std dev level is shown for the most current bar, which is great, but bands would be sooooo helpful, to review past.
    The formula that you have linked to isn't actually plotting any series. The regression lines that appear on the chart are being drawn with the drawLineRelative() function. See lines 160-173. The end point for these lines is determined by the first two parameters in the drawLineRelative() calls, where the second parameter is the y-axis value. To plot the moving regression lines, or the historical values, you can return those values from the return statement in main(). Try replacing the current return statement in main() with the following.



    2. Also, I need to be able to output these very Linear Reg and std dev values into MS Excel and I’ve found this thread, explaining how to set up DDE output: http://forum.esignalcentral.com/show...&postid=44465, however I am unable to modify it correctly, being very new here.

    This takes me about 30 seconds to code in Tradestation, but too new to Esignal. Please help.

    Alex.
    The DDE Object will only output the current real-time values. It cannot be used to export the historical values. After adding the return statement above, apply the formula to the chart and then use the Data Export tool (Tools-->Data Export). You can create a CSV file that can be imported to Excel or copy the data to your clipboard and paste it into Excel.

    If you want to start learning more about EFS so that you can take advantage of this feature, please visit the resources listed below my signature.
    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
      Thanks, Jason.

      I don't need historical Linear regression values and std dev values updated into an Excel spreadsheet - only real time ones, so DDE is perfect for that. I can't get my head around how to do it just yet though... Could you post code?

      Thank you.

      Comment


      • #4
        Hello Alex,

        Please try following the DDE code example that you linked to in your prior reply. It is an excellent code example to follow. Keep in mind that you will need to create a separate DDE object for each of the five values you want to link to Excel. In Alex's example, the global variable, ddeCCI, is being assigned to the DDE Object. You could use, ddeLR2upper, ddeLR1upper, ddeLRbasis, ddeLR1lower and ddeLR2lower for your global variable names. Follow the same process Alex used for ddeCCI.

        If you run into something specific that you have trouble with or don't understand, please post the code that you are working with and I'll provide additional guidance.
        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


        • #5
          Curved channel lines around Linear Regression Curve

          Jason, followed your directions, getting an error: "vSTDev is not defined" when loading the formula into the chart, even though vSTDev is defined in the code.

          Thank you.


          Originally posted by JasonK
          Hello Alex,



          The formula that you have linked to isn't actually plotting any series. The regression lines that appear on the chart are being drawn with the drawLineRelative() function. See lines 160-173. The end point for these lines is determined by the first two parameters in the drawLineRelative() calls, where the second parameter is the y-axis value. To plot the moving regression lines, or the historical values, you can return those values from the return statement in main(). Try replacing the current return statement in main() with the following.





          The DDE Object will only output the current real-time values. It cannot be used to export the historical values. After adding the return statement above, apply the formula to the chart and then use the Data Export tool (Tools-->Data Export). You can create a CSV file that can be imported to Excel or copy the data to your clipboard and paste it into Excel.

          If you want to start learning more about EFS so that you can take advantage of this feature, please visit the resources listed below my signature.

          Comment


          • #6
            Hi balancing1,
            Try making the t in StDev a small t. See if that helps.
            Diane

            Comment


            • #7
              I did that... and I still missed one!! Your note made me recheck! Thank you, Diane.

              Comment


              • #8
                You're welcome.
                Diane

                Comment


                • #9
                  DDE BASIC STUDIES LINEAR REGRESSION

                  How do I get the LR Upper Mid and Lower values (Esignal Basic Studies Version) transferred via DDE into Excel ?

                  Comment


                  • #10
                    Hello merchant,

                    The Basic studies are not available to DDE. You have to create the studies using EFS and create the DDE links using the DDEOutput() object.

                    Please also review this thread which discusses this process in great detail.
                    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


                    • #11
                      Hi Jason,

                      i followed the instructions and have got the upper,middle and lower LR values into excel using the built in functions in EFS, however the values returned are Standard Deviation values

                      1. How do I get the Standard Error Values ?

                      2. In my code: study = UpperlinearReg (21, 2); Is it possible for me
                      to pass the standard deviation input (2) externly i.e from excel directly into the EFS script ? (not in realtime)

                      thankyou

                      Comment


                      • #12
                        Hello merchant,

                        1. You will need to code them into your formula. Please see this for a code example.

                        2. EFS cannot receive inputs from Excel. You may add a function parameter to your formula to allow you to change that value through the Edit Studies option in the Advanced Chart.
                        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