Announcement

Collapse
No announcement yet.

Bug in ARSI.efs?

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

  • Bug in ARSI.efs?

    One of my favorite indicators is the ARSI -- the Asymmetrical RSI that Sylvain Vervoort wrote about in the October 2008 issue of Stocks & Commodities Magazine and that eSignal made available in an EFS script, which I've attached.

    I find it useful on all time frames. However, on the daily chart, whenever the markets are closed, it returns an error, and I haven't been able to figure out why.

    Can anyone tell me what the problem is? I don't know if the readings it gives on the daily chart are valid.

    Steven Miller
    Attached Files

  • #2
    Re: Bug in ARSI.efs?

    Steven

    I find it useful on all time frames. However, on the daily chart, whenever the markets are closed, it returns an error, and I haven't been able to figure out why.
    FWIW at my end it appears to be working on the daily interval of all the symbols I tried [even when these are closed]
    Alex


    Originally posted by Steven Miller
    One of my favorite indicators is the ARSI -- the Asymmetrical RSI that Sylvain Vervoort wrote about in the October 2008 issue of Stocks & Commodities Magazine and that eSignal made available in an EFS script, which I've attached.

    I find it useful on all time frames. However, on the daily chart, whenever the markets are closed, it returns an error, and I haven't been able to figure out why.

    Can anyone tell me what the problem is? I don't know if the readings it gives on the daily chart are valid.

    Steven Miller

    Comment


    • #3
      Then the force is with you Alex because ...

      I also get an error message when I try to run Veroot’s ARSI study (Link ) in real-time. The message says: “Line 118; Parameter Number 1 of Function ema [Length] is invalid.”

      Mike

      Comment


      • #4
        Re: Then the force is with you Alex because ...

        Mike
        As I indicated in my previous reply the formula referenced by the original poster is working at my end (see enclosed screenshot).
        Also, based on what I am seeing that formula is not calling the ema() function in line 118
        Alex




        Originally posted by mikejhelms
        I also get an error message when I try to run Veroot’s ARSI study (Link ) in real-time. The message says: “Line 118; Parameter Number 1 of Function ema [Length] is invalid.”

        Mike

        Comment


        • #5
          It is on my end

          The following is the study I just downloaded from the eSignal forum at the aforementioned link. When it's opened in a formula editor line 118 reads:

          var xDnMoveAvg = ema((xSum2.getValue(0)*2)-1,xSum4);

          But it’s no big deal because I now see the error evaporates if the default number of periods is changed from 14 to 21. Insufficient data loaded I suppose.

          Mike

          /*********************************
          Provided By:
          eSignal (Copyright c eSignal), a division of Interactive Data
          Corporation. 2008. All rights reserved. This sample eSignal
          Formula Script (EFS) is for educational purposes only and may be
          modified and saved under a new file name. eSignal is not responsible
          for the functionality once modified. eSignal reserves the right
          to modify and overwrite this EFS file with each new release.


          Description:
          ARSI, The Asymmetrical RSI by Sylvain Vervoort

          Version: 1.0 08/07/2008

          Notes:
          October 2008 issue of Stocks & Commodities Magazine

          Formula Parameters: Default:
          Period 14
          Upper Band 70
          Lower Band 30
          ARSI Color Blue
          RSI Color Red
          Show Parameters False
          **********************************/

          var fpArray = new Array();

          function preMain() {
          setPriceStudy(false);
          setStudyTitle("ARSI ");
          setCursorLabelName("ARSI", 0);
          setCursorLabelName("RSI", 1);

          setDefaultBarFgColor(Color.blue, 0);
          setDefaultBarFgColor(Color.red, 1);

          setPlotType(PLOTTYPE_LINE, 0);
          setPlotType(PLOTTYPE_LINE, 1);

          setDefaultBarThickness(1, 0);
          setDefaultBarThickness(1, 1);

          askForInput();

          var x=0;
          fpArray[x] = new FunctionParameter("Period", FunctionParameter.NUMBER);
          with(fpArray[x++]){
          setName("Period");
          setLowerLimit(1);
          setUpperLimit(100);
          setDefault(14);
          }

          fpArray[x] = new FunctionParameter("Color1", FunctionParameter.COLOR);
          with(fpArray[x++]){
          setName("ARSI Color");
          setDefault(Color.blue);
          }

          fpArray[x] = new FunctionParameter("Color2", FunctionParameter.COLOR);
          with(fpArray[x++]){
          setName("RSI Color");
          setDefault(Color.red);
          }

          fpArray[x] = new FunctionParameter("Upper", FunctionParameter.NUMBER);
          with(fpArray[x++]){
          setName("Upper Band");
          setLowerLimit(0);
          setDefault(70);
          }

          fpArray[x] = new FunctionParameter("Lower", FunctionParameter.NUMBER);
          with(fpArray[x++]){
          setName("Lower Band");
          setLowerLimit(0);
          setDefault(30);
          }

          fpArray[x] = new FunctionParameter("ShowParam", FunctionParameter.BOOLEAN);
          with(fpArray[x++]){
          setName("Show Parameters");
          setDefault(false);
          }

          }

          var xSum1 = null
          var xSum2 = null;
          var xSum3 = null;
          var xSum4 = null;
          var xRSI = null;
          var bInit = false;
          var bVersion = null;


          function main(Period, Upper, Lower, Color1, Color2, ShowParam){

          if (bVersion == null) bVersion = verify();
          if (bVersion == false) return;
          if(getCurrentBarCount()<Period) return;

          if(bInit==false){
          xSum1 = efsInternal("Sum",Period);
          xSum2 = getSeries(xSum1,1);
          xSum3 = getSeries(xSum1,2);
          xSum4 = getSeries(xSum1,3);
          xRSI = rsi(Period);
          addBand(Upper,PS_SOLID,1,Color.grey,"UpperBand");
          addBand(Lower,PS_SOLID,1,Color.grey,"LowerBand");
          setShowTitleParameters( ShowParam );
          bInit=true;
          }

          var xUpMoveAvg = ema((xSum1.getValue(0)*2)-1,xSum3);
          var xDnMoveAvg = ema((xSum2.getValue(0)*2)-1,xSum4);

          if(xUpMoveAvg==null||xDnMoveAvg==null) return;

          var RS = xUpMoveAvg.getValue(0)/xDnMoveAvg.getValue(0);
          var nRSI = xRSI.getValue(0);
          if(nRSI==null) return;

          return new Array (100-(100/(1+RS)),nRSI)
          }

          var xMom = null;
          var xInit = false;

          function Sum(Period){

          if(xInit==false){
          xMom = mom(1);
          xInit = true;
          }

          var nSum = 0;
          for(var i = 0; i < Period; i++){
          if(xMom.getValue(-i) >= 0) {
          nSum += 1;
          }
          }

          var UpCount = nSum;
          var DnCount = Period-UpCount;
          var UpMove = xMom.getValue(0)>=0?xMom.getValue(0):0;
          var DnMove = xMom.getValue(0)<0?Math.abs(xMom.getValue(0)):0;

          return new Array(UpCount,DnCount,UpMove,DnMove);
          }


          function verify() {
          var b = false;
          if (getBuildNumber() < 779) {
          drawTextAbsolute(5, 35, "This study requires version 8.0 or later.",
          Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOL D|Text.LEFT,
          null, 13, "error");
          drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp",
          Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOL D|Text.LEFT,
          null, 13, "upgrade");
          return b;
          } else {
          b = true;
          }
          return b;
          }

          Comment


          • #6
            Re: It is on my end

            Mike
            FWIW also the formula you posted appears to be working fine at my end using 14 as the length of the ema()
            Alex




            Originally posted by mikejhelms
            The following is the study I just downloaded from the eSignal forum at the aforementioned link. When it's opened in a formula editor line 118 reads:

            var xDnMoveAvg = ema((xSum2.getValue(0)*2)-1,xSum4);

            But it’s no big deal because I now see the error evaporates if the default number of periods is changed from 14 to 21. Insufficient data loaded I suppose.

            Mike

            /*********************************
            Provided By:
            eSignal (Copyright c eSignal), a division of Interactive Data
            Corporation. 2008. All rights reserved. This sample eSignal
            Formula Script (EFS) is for educational purposes only and may be
            modified and saved under a new file name. eSignal is not responsible
            for the functionality once modified. eSignal reserves the right
            to modify and overwrite this EFS file with each new release.


            Description:
            ARSI, The Asymmetrical RSI by Sylvain Vervoort

            Version: 1.0 08/07/2008

            Notes:
            October 2008 issue of Stocks & Commodities Magazine

            Formula Parameters: Default:
            Period 14
            Upper Band 70
            Lower Band 30
            ARSI Color Blue
            RSI Color Red
            Show Parameters False
            **********************************/

            var fpArray = new Array();

            function preMain() {
            setPriceStudy(false);
            setStudyTitle("ARSI ");
            setCursorLabelName("ARSI", 0);
            setCursorLabelName("RSI", 1);

            setDefaultBarFgColor(Color.blue, 0);
            setDefaultBarFgColor(Color.red, 1);

            setPlotType(PLOTTYPE_LINE, 0);
            setPlotType(PLOTTYPE_LINE, 1);

            setDefaultBarThickness(1, 0);
            setDefaultBarThickness(1, 1);

            askForInput();

            var x=0;
            fpArray[x] = new FunctionParameter("Period", FunctionParameter.NUMBER);
            with(fpArray[x++]){
            setName("Period");
            setLowerLimit(1);
            setUpperLimit(100);
            setDefault(14);
            }

            fpArray[x] = new FunctionParameter("Color1", FunctionParameter.COLOR);
            with(fpArray[x++]){
            setName("ARSI Color");
            setDefault(Color.blue);
            }

            fpArray[x] = new FunctionParameter("Color2", FunctionParameter.COLOR);
            with(fpArray[x++]){
            setName("RSI Color");
            setDefault(Color.red);
            }

            fpArray[x] = new FunctionParameter("Upper", FunctionParameter.NUMBER);
            with(fpArray[x++]){
            setName("Upper Band");
            setLowerLimit(0);
            setDefault(70);
            }

            fpArray[x] = new FunctionParameter("Lower", FunctionParameter.NUMBER);
            with(fpArray[x++]){
            setName("Lower Band");
            setLowerLimit(0);
            setDefault(30);
            }

            fpArray[x] = new FunctionParameter("ShowParam", FunctionParameter.BOOLEAN);
            with(fpArray[x++]){
            setName("Show Parameters");
            setDefault(false);
            }

            }

            var xSum1 = null
            var xSum2 = null;
            var xSum3 = null;
            var xSum4 = null;
            var xRSI = null;
            var bInit = false;
            var bVersion = null;


            function main(Period, Upper, Lower, Color1, Color2, ShowParam){

            if (bVersion == null) bVersion = verify();
            if (bVersion == false) return;
            if(getCurrentBarCount()<Period) return;

            if(bInit==false){
            xSum1 = efsInternal("Sum",Period);
            xSum2 = getSeries(xSum1,1);
            xSum3 = getSeries(xSum1,2);
            xSum4 = getSeries(xSum1,3);
            xRSI = rsi(Period);
            addBand(Upper,PS_SOLID,1,Color.grey,"UpperBand");
            addBand(Lower,PS_SOLID,1,Color.grey,"LowerBand");
            setShowTitleParameters( ShowParam );
            bInit=true;
            }

            var xUpMoveAvg = ema((xSum1.getValue(0)*2)-1,xSum3);
            var xDnMoveAvg = ema((xSum2.getValue(0)*2)-1,xSum4);

            if(xUpMoveAvg==null||xDnMoveAvg==null) return;

            var RS = xUpMoveAvg.getValue(0)/xDnMoveAvg.getValue(0);
            var nRSI = xRSI.getValue(0);
            if(nRSI==null) return;

            return new Array (100-(100/(1+RS)),nRSI)
            }

            var xMom = null;
            var xInit = false;

            function Sum(Period){

            if(xInit==false){
            xMom = mom(1);
            xInit = true;
            }

            var nSum = 0;
            for(var i = 0; i < Period; i++){
            if(xMom.getValue(-i) >= 0) {
            nSum += 1;
            }
            }

            var UpCount = nSum;
            var DnCount = Period-UpCount;
            var UpMove = xMom.getValue(0)>=0?xMom.getValue(0):0;
            var DnMove = xMom.getValue(0)<0?Math.abs(xMom.getValue(0)):0;

            return new Array(UpCount,DnCount,UpMove,DnMove);
            }


            function verify() {
            var b = false;
            if (getBuildNumber() < 779) {
            drawTextAbsolute(5, 35, "This study requires version 8.0 or later.",
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOL D|Text.LEFT,
            null, 13, "error");
            drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp",
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOL D|Text.LEFT,
            null, 13, "upgrade");
            return b;
            } else {
            b = true;
            }
            return b;
            }

            Comment


            • #7
              Steven’s inserted comments regarding Wilder’s formulation of the RSI increased the line number from the original 118 to 125 for “var xDnMoveAvg = ema((xSum2.getValue(0)*2)-1,xSum4)”. And although eSignal’s original study defines RS, nRSI, xUpMoveAvg and xDnMoveAvg as local variables Steven defines them globally which was probably, as Martha Stewart says, “A good thing” because I had no problem with his version of the study. Why I had problems with the original remains a mystery.

              Mike

              Comment

              Working...
              X