Announcement

Collapse
No announcement yet.

%R of EMA using Wizard

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

  • %R of EMA using Wizard

    How can I use Wizard to create a formula which is a %R of an Exponential Moving Average (rather than closing price). Specifically I want a 5,10 and 15 period %R of a 5, 20 and (20-5) period EMA.
    I am able to do this with RSI - but %R doesn't give me that option - is there any way that I can generate that option in Wizard.

  • #2
    Re: %R of EMA using Wizard

    global
    You cannot do it with the Formula Wizard because the legacy PercentRStudy() function is not set up to accept any source.
    You would need to do that using the efs2 percentR() function eg
    var myStudy = percentR(lengthPercentR, ema(lengthEMA))
    For the description and syntax required by the percentR() function see the link to the corresponding article in the EFS KnowledgeBase
    Alex


    Originally posted by global
    How can I use Wizard to create a formula which is a %R of an Exponential Moving Average (rather than closing price). Specifically I want a 5,10 and 15 period %R of a 5, 20 and (20-5) period EMA.
    I am able to do this with RSI - but %R doesn't give me that option - is there any way that I can generate that option in Wizard.

    Comment


    • #3
      Example of Code

      Thanks for your reply. I am very new at this - that's why I was trying to use Wizard. Could you give me an example of the code for one of the formulas - for eg. 5 period %R of 20 period EMA.

      Comment


      • #4
        Re: Example of Code

        global
        In the example I provided earlier ie
        var myStudy = percentR(lengthPercentR, ema(lengthEMA))
        just replace lengthPercentR with 5 and lengthEMA with 20
        If you need a template to write the script see the one I provided in this thread
        If - as you indicate - you are not yet familiar with programming in EFS then you may find it to your benefit to learn to do that as it will enable you to take full advantage of the resources offered by a programmable application such as eSignal. The best way is to start by reviewing the JavaScript for EFS video series and the Core JavaScript Reference Guide. Those will provide you with a thorough introduction to programming in JavaScript which is at the foundation of EFS. Then go through the EFS KnowledgeBase and study the Help Guides and Tutorials which will provide you with the specifics of EFS.
        Alex


        Originally posted by global
        Thanks for your reply. I am very new at this - that's why I was trying to use Wizard. Could you give me an example of the code for one of the formulas - for eg. 5 period %R of 20 period EMA.

        Comment


        • #5
          Links not working

          Thanks ,

          The first two links don't seem to be working at the moment.

          I went to you syntax link and modified the SMA to EMA as follows: (see below)

          I also noted the study on study syntax help.

          The question is - how do I get from the code (below) -- to the code required to complete the formula for %R of EMA.

          I will study the Java and EFS material going forward - but I would like to get this %R of EMA up and running as soon as I can.

          Thanks again for your help.


          function preMain(){
          setPriceStudy(true);
          setStudyTitle("Exponential Moving Average");
          setCursorLabelName("EMA");

          var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);
          fp1.setName("Length of EMA");
          fp1.setLowerLimit(1);
          fp1.setUpperLimit(200);
          fp1.setDefault(20);
          }

          var myAvg = null;

          function main(Length){//add the parameter to the main definition

          if(myAvg==null) myAvg = ema(Length);//replace the value with the parameter variable

          return myAvg.getValue(0);
          }

          At 02:23 AM 27/10/2009, you wrote:
          Hello global,

          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

          Comment


          • #6
            Re: Links not working

            global
            Replace
            if(myAvg==null) myAvg = ema(Length);//replace the value with the parameter variable
            with
            if(myAvg==null) myAvg = percentR(5,ema(Length));//replace the value with the parameter variable
            which as you can see is the same code I suggested in my previous replies and also replace
            setPriceStudy(true);
            with
            setPriceStudy(false);
            so that the indicator will plot in a separate window
            As to the links I just tried them and they seem to be working fine at my end
            Alex


            Originally posted by global
            Thanks ,

            The first two links don't seem to be working at the moment.

            I went to you syntax link and modified the SMA to EMA as follows: (see below)

            I also noted the study on study syntax help.

            The question is - how do I get from the code (below) -- to the code required to complete the formula for %R of EMA.

            I will study the Java and EFS material going forward - but I would like to get this %R of EMA up and running as soon as I can.

            Thanks again for your help.


            function preMain(){
            setPriceStudy(true);
            setStudyTitle("Exponential Moving Average");
            setCursorLabelName("EMA");

            var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);
            fp1.setName("Length of EMA");
            fp1.setLowerLimit(1);
            fp1.setUpperLimit(200);
            fp1.setDefault(20);
            }

            var myAvg = null;

            function main(Length){//add the parameter to the main definition

            if(myAvg==null) myAvg = ema(Length);//replace the value with the parameter variable

            return myAvg.getValue(0);
            }

            At 02:23 AM 27/10/2009, you wrote:
            Hello global,

            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

            Comment


            • #7
              It Works - Thank You

              It works. Thank you for your patience.

              Is it possible to chart a 5 period %R of EMA 20, a 10 period %R of EMA 20, and a 15 period %R of EMA 20 - all in the same window?

              Comment


              • #8
                Re: It Works - Thank You

                global
                Yes it is possible and the easiest way to do that [if you are unfamiliar with how to write the script so that it calculates the three indicators all as one script] is to load three instances of the study each with its own parameters and then overlay the studies in one pane. See the explanation in this thread on how to overlay studies
                Alex


                Originally posted by global
                It works. Thank you for your patience.

                Is it possible to chart a 5 period %R of EMA 20, a 10 period %R of EMA 20, and a 15 period %R of EMA 20 - all in the same window?

                Comment


                • #9
                  Overlay

                  Thanks.
                  I couldn't figure out how to overlay using edit studies - but I was able to overlay using shift key - then drag and drop. This gives me the overlay - but doesn't give me the option of setting both studies to the same scale. Perhaps it isn't necessary given that the studies that I want to merge all should be on the same scale to begin with.

                  Comment


                  • #10
                    Everything is working

                    Everything is working perfectly. I have the %R (5, 10, 15) of EMA 5 and EMA 20. Is it possible to get %R of (EMA 20 - EMA 5)?

                    Comment


                    • #11
                      Re: Overlay

                      global
                      In Edit Studies select each overlayed study and set it to Scale and Display Right (or Left depending on where you have set the scale).
                      Alex


                      Originally posted by global
                      Thanks.
                      I couldn't figure out how to overlay using edit studies - but I was able to overlay using shift key - then drag and drop. This gives me the overlay - but doesn't give me the option of setting both studies to the same scale. Perhaps it isn't necessary given that the studies that I want to merge all should be on the same scale to begin with.

                      Comment


                      • #12
                        Something wrong with code

                        When I do RSI of EMA (5) for example it charts correctly (using formulas discussed earlier. When I do RSI (10) of (EMA 20 - EMA 5) - a chart is generated with no syntax errors - but the chart isn't printing out correctly.
                        I am copying the code below - please tell me why it isn't working right.
                        function preMain(){
                        setPriceStudy(false);
                        setStudyTitle("Fast RSI 5 of Net EMA");
                        setCursorLabelName("Fast RSI 5");

                        var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);
                        fp1.setName("Length of EMA");
                        fp1.setLowerLimit(1);
                        fp1.setUpperLimit(200);
                        fp1.setDefault(20);
                        }

                        var myAvg = null;

                        function main(Length){//add the parameter to the main definition;

                        if(myAvg==null) myAvg = percentR(5,(ema(20)-ema(5)). length);//replace the value with the parameter variable

                        return myAvg.getValue(0);
                        }

                        Comment


                        • #13
                          Re: Something wrong with code

                          global
                          In order to use a built-in study with a custom source this has to be a series which (ema(20)-ema(5)) is not as that equation returns a value.
                          To create a series you need to calculate your equation in a separate function or external efs and then retrieve the result of that calculation using the efsInternal() or efsExternal() functions. This series created by the efsInternal() or efsExternal() functions can then be used as a source for the built-in studies.
                          For the description of the efsInternal() and efsExternal() functions and the required syntax see the links above which will take you to the corresponding articles in the EFS KnowledgeBase.
                          You can also find several detailed examples on how to use efsInternal() and efsExternal() in this and this thread.
                          Also try searching the forum as there are many more examples of studies based on custom variables as this topic has been discussed at length many times before
                          Alex


                          Originally posted by global
                          When I do RSI of EMA (5) for example it charts correctly (using formulas discussed earlier. When I do RSI (10) of (EMA 20 - EMA 5) - a chart is generated with no syntax errors - but the chart isn't printing out correctly.
                          I am copying the code below - please tell me why it isn't working right.
                          function preMain(){
                          setPriceStudy(false);
                          setStudyTitle("Fast RSI 5 of Net EMA");
                          setCursorLabelName("Fast RSI 5");

                          var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);
                          fp1.setName("Length of EMA");
                          fp1.setLowerLimit(1);
                          fp1.setUpperLimit(200);
                          fp1.setDefault(20);
                          }

                          var myAvg = null;

                          function main(Length){//add the parameter to the main definition;

                          if(myAvg==null) myAvg = percentR(5,(ema(20)-ema(5)). length);//replace the value with the parameter variable

                          return myAvg.getValue(0);
                          }

                          Comment


                          • #14
                            Thank You

                            Thank You Very Much for your very well informed help. It is greatly appreciated.

                            Comment


                            • #15
                              Re: Thank You

                              global
                              You are welcome
                              Alex


                              Originally posted by global
                              Thank You Very Much for your very well informed help. It is greatly appreciated.

                              Comment

                              Working...
                              X