Announcement

Collapse
No announcement yet.

Smoothing of RSI

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

  • Smoothing of RSI

    I would be greatly appreciative if someone could please assist me. I am thinking about switching from my old trading platform to eSignal but I would only do this if I can set my indicators up the same. In my old program I had a RSI of 14 periods smoothed with a 3 period simple moving average. I then overlaid a RSI of 14 periods smoothed with a 52 simple moving average. I have tried the efs wizard and searched the forums without any luck. Unfortunately I have no experience in programming and the training on this website was completely over my head.

    Thanks,
    Travis

  • #2
    Travis
    With regards to programming a moving average of an RSI with the Formula Wizard there is a complete and illustrated guide specifically for that study in the Formula Wizard Guide which is in the EFS KnowledgeBase.
    Scroll down to the very end of the Formula Wizard Guide and you will find a link to Study on Study (MA of RSI).
    Also try running a search in this BB for "rsi AND moving AND average" (without the quotes) and you should find a thread in which is a ready made MA of RSI study.
    Alex

    Comment


    • #3
      Thanks for the quick and very helpful reply Alex. I was searching under "smoothing AND RSI", I thought the MA of RSI was a different indicator.

      Anyway I have managed to find a formula by conducting a search and changed it to actually reproduce the RSI 14 period with a smoothing of a 3 simple moving average. However when I attempted to change it for the smoothing of 52 simple moving average it looks completely different to my old trading platform. I have attached a screen print of my old trading platform and how I want the indicator to look (hopefully you can see it properly). Below are a copy of the formula for smoothing of 3 SMA and 52SMA.

      3 SMA:


      //{{EFSWizard_Description
      //
      // This formula was generated by the Alert Wizard
      //
      //}}EFSWizard_Description 7532


      //{{EFSWizard_Declarations

      var vEMA10 = new MAStudy(10, 0, "Close", MAStudy.EXPONENTIAL);
      var vRSI14_of_vEMA10 = new RSIStudy(14, vEMA10, MAStudy.MA);
      var vLastAlert = -1;

      //}}EFSWizard_Declarations 17493


      function preMain() {
      /**
      * This function is called only once, before any of the bars are loaded.
      * Place any study or EFS configuration commands here.
      */
      //{{EFSWizard_PreMain
      setPriceStudy(false);
      setStudyTitle("Moving Avg Rsi");
      setCursorLabelName("MArsi", 0);
      setDefaultBarStyle(PS_SOLID, 0);
      setDefaultBarFgColor(Color.red, 0);
      setDefaultBarThickness(2, 0);
      setPlotType(PLOTTYPE_LINE, 0);
      addBand(25,PS_SOLID,1,Color.black);
      addBand(75,PS_SOLID,1,Color.black);
      //}}EFSWizard_PreMain 29123

      }

      function main() {
      /**
      * 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.
      */

      //{{EFSWizard_Expressions
      //{{EFSWizard_Expression_1
      //}}EFSWizard_Expression_1 0

      //}}EFSWizard_Expressions 9063


      //{{EFSWizard_Return
      return vRSI14_of_vEMA10.getValue(RSIStudy.RSI);
      //}}EFSWizard_Return 6068

      }

      function postMain() {
      /**
      * The postMain() function is called only once, when the EFS is no longer used for
      * the current symbol (ie, symbol change, chart closing, or application shutdown).
      */
      }

      //{{EFSWizard_Actions
      //{{EFSWizard_Action_1
      function onAction1() {
      vLastAlert = 1;
      }
      //}}EFSWizard_Action_1 5589

      //}}EFSWizard_Actions 15622



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

      52SMA:

      //{{EFSWizard_Description
      //
      // This formula was generated by the Alert Wizard
      //
      //}}EFSWizard_Description 7532


      //{{EFSWizard_Declarations

      var vEMA10 = new MAStudy(10, 0, "Close", MAStudy.EXPONENTIAL);
      var vRSI14_of_vEMA10 = new RSIStudy(14, vEMA10, MAStudy.MA);
      var vLastAlert = -1;

      //}}EFSWizard_Declarations 17493


      function preMain() {
      /**
      * This function is called only once, before any of the bars are loaded.
      * Place any study or EFS configuration commands here.
      */
      //{{EFSWizard_PreMain
      setPriceStudy(false);
      setStudyTitle("Moving Avg Rsi");
      setCursorLabelName("MArsi", 0);
      setDefaultBarStyle(PS_SOLID, 0);
      setDefaultBarFgColor(Color.red, 0);
      setDefaultBarThickness(2, 0);
      setPlotType(PLOTTYPE_LINE, 0);
      addBand(25,PS_SOLID,1,Color.black);
      addBand(75,PS_SOLID,1,Color.black);
      //}}EFSWizard_PreMain 29123

      }

      function main() {
      /**
      * 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.
      */

      //{{EFSWizard_Expressions
      //{{EFSWizard_Expression_1
      //}}EFSWizard_Expression_1 0

      //}}EFSWizard_Expressions 9063


      //{{EFSWizard_Return
      return vRSI14_of_vEMA10.getValue(RSIStudy.RSI);
      //}}EFSWizard_Return 6068

      }

      function postMain() {
      /**
      * The postMain() function is called only once, when the EFS is no longer used for
      * the current symbol (ie, symbol change, chart closing, or application shutdown).
      */
      }

      //{{EFSWizard_Actions
      //{{EFSWizard_Action_1
      function onAction1() {
      vLastAlert = 1;
      }
      //}}EFSWizard_Action_1 5589

      //}}EFSWizard_Actions 15622

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

      Thank you so much for your help its greatly appreciated.

      Travis
      Attached Files

      Comment


      • #4
        Travis
        In both studies you are actually calculating an RSI of a moving average as opposed to a moving average of RSI which is what the Formula Wizard Guide I indicated in my prior reply will show you how to do.
        Also in both cases you have not applied the parameters you want ie. 3ma/14rsi or 52ma/14rsi and are using instead the default parameters of the the individual studies ie 14rsi/10ma.
        Anyhow the attached revision of your first script will show you how it should be done.
        I would suggest that you still visit the link I indicated earlier and try to build the second script following the guide.
        Alex

        Attached Files

        Comment


        • #5
          Travis
          Further to my prior reply. You don't ncessarily need to create two separate EFSs to build the same study you have on your other platform. If you want you can code both studies in the same script.
          Also as you write these first scripts using the Formula Wizard take the opportunity to understand how an efs is constructed ie its various functions like preMain(), main(), etc and the roles they have in a script.
          I am suggesting this because once you get a basic understanding of the structure of an efs you can then switch to using the EFS2 builtin studies (which are not available in the Formula Wizard at this time and require manual coding using the Editor) that are much easier to program. For example creating the actual MA of RSI using the EFS2 syntax would require only this function

          var vSMA3_of_vRSI14 = sma(3,rsi(14))

          instead of what you are currently using ie

          var vRSI14 = new RSIStudy(14, "Close");
          var vSMA3_of_vRSI14 = new MAStudy(3, 0, vRSI14, RSIStudy.RSI, MAStudy.SIMPLE);


          As you can see it is considerably easier and more intuitive
          Alex

          Comment


          • #6
            Alex,

            Thank you for all your help. I have now got it working fine.

            For some reason when I copied and pasted those formulas into my last post the numbers come out as the default numbers. I had actually already changed the numbers as suggested by you. It is now apparent to me that I didn't fully understand what the indicator actual was that I was attempting to create. I didn't realise that I was attempting to create a moving average of the RSI. But once I got my head around that fact I was able to easily work out the formula.

            I spent a large portion of the weekend trying to understand the efs wizard and manual editoring through the Editor. I think I now have a sound grasp of both.

            Thanks again for all your help. Esignal are extremely lucky to have someone like you help people out.

            Travis

            Comment


            • #7
              Travis
              Thank you for the compliment and you are most welcome.
              If you now feel you have a sounder understanding of efs you may want to consider looking at MAofRSI.efs which is available here and which is fully customizable (ie you can modify any of the parameters of the studies through Edit Studies).
              An EFS2 version of the same study with the added option to compute on multiple intervals and/or external symbols is also available here
              Alex

              Comment

              Working...
              X