Announcement

Collapse
No announcement yet.

LRS w/MA

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

  • LRS w/MA

    Alexis

    I have an EFS you authored for LRS and I would really like to add a selectable MA to the plot. Unfortunately, I am a newbie and not versed in EFS. Can you please help me out.

    Thanks
    Doug

  • #2
    Doug
    Some time ago I wrote an efs which will compute the MA, EMA or WMA of any user defined variable. You can find it here. In that same thread you can also find some examples of how it can be used with price and non price studies
    Save it to the same folder in which you have saved the LRS study then open it with the Editor and replace line 52 which is
    vUserVar = close();//(high(0)+low(0)+close(0))/3;
    with
    vUserVar = call("LRS.efs");
    Once you have done that replace the return statement in line 98
    return aMovAvg[MAOffset];
    with
    return new Array (vValue,aMovAvg[MAOffset]);
    At that point you will need to add some statements in preMain if you wish to color the line differently or plot it in a different thickness etc. Look in the same thread mentioned above for the example using the cmf.efs
    Alex

    Comment


    • #3
      OK, great. Thanks much for your help.

      Best Regards
      Doug

      Comment


      • #4
        Alexis

        Are you sure about the EFS you directed me to?? The code doesn't match up with what you said. Look below;

        Line 52 is;
        if (aValue == null) aValue = new Array(MALength);

        and Line 98 is a blank line. Actually, I couldn't find any lines that match up with the code in your post. Am I looking at the correct EFS??? I got it from the link you pushed and it had the right title.

        Thanks
        Doug

        Comment


        • #5
          Doug
          My apologies. The version I had on my system was a later revision that I had not posted.
          I have now added it to the same thread.
          Alex

          Comment


          • #6
            No apologies necessary, you're the best.

            Thanks again!!!

            Comment


            • #7
              Doug
              You are most welcome and thank you for the compliment
              Alex

              Comment


              • #8
                Hate to be such a pain Alexis, but I did everything you said with the new template but it doesn't plot. I'm sure it's something I'm not doing but I have to ask; is the EFS missing a return statement or something similar??

                Comment


                • #9
                  Doug
                  Post what you have done and I will look it over.
                  As far as I can tell the version I posted is not missing anything. Here below is what it should plot if you run it without any modifications
                  Alex

                  Comment


                  • #10
                    I attached the renamed EFS with the mods as per your instructions. Is it possible that renaming the file caused a problem?? The file appears to attach OK but there is no visible plot and I don't get any error messages.
                    Attached Files

                    Comment


                    • #11
                      Doug
                      There was another change that was required and that is setting the efs as a non price study. Also make sure that the script is in the same folder as the LRS.efs. All changes are commented in the attached revision of the script.
                      Here is what the plot of your modified efs looks like
                      Alex

                      Attached Files

                      Comment


                      • #12
                        OK, got it. I should have caught that but I'm still learning. I will try making some adjustments now based on the other script you referenced. Thanks once again for all the help.

                        Doug

                        Comment


                        • #13
                          Doug
                          Again you are very welcome. If you are having any difficulties applying the changes just post whatever you will have done and I will help you fix it
                          Alex

                          Comment

                          Working...
                          X