Announcement

Collapse
No announcement yet.

Problem with study?

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

  • Problem with study?

    Jason,

    I am getting wierd plots for the Wilson RPC study totally unlike the one you have. I have tried it on different timeframe with the same result. Can you please tell me if I am doing something wrong? I have attached a picture of what I am getting FYI. I have not changed any of the default settings. Thanks in advance.

    Sesh
    Attached Files

  • #2
    I think it is to do with the scaling of the chart, I will find my copy that I edited and post it.

    Paul Murray

    Comment


    • #3
      Here are the changes I made to the code.

      PHP Code:
      function calcRPC(nPeriodsnSmoothingnOBnOSnUpperNZnLowerNZ) {
          var 
      nC close(0);
          var 
      OB ema(nSmoothingefsInternal("calcCord"nPeriodsnOB),      0);
          var 
      UN ema(nSmoothingefsInternal("calcCord"nPeriodsnUpperNZ), 0);
          var 
      LN ema(nSmoothingefsInternal("calcCord"nPeriodsnLowerNZ), 0);
          var 
      OS ema(nSmoothingefsInternal("calcCord"nPeriodsnOS),      0);
          
          
      OB nC - (nC * (OB/10000));
          
      UN nC - (nC * (UN/10000));
          
      LN nC - (nC * (LN/10000));
          
      OS nC - (nC * (OS/10000));
          
          return new Array(
      OBUNLNOS);

      It is just a matter of changing the denominator to the calculation shown.

      If I get time I will make a version with a denominator parameter, so it can be used on Forex, stocks, indices etc.

      If anybody wants to beat me to it they are welcome, but am going to watch some cricket later this morning (note my location).

      Paul Murray

      Comment


      • #4
        Wilson RPC efs

        Hi Paul,

        Thanks for taking a look at the code. Hi Buzz, please find attached the efs that Jason put out based on the Stocks & Commodities magazine article. Hope you guys ca fix it. Thanks.

        Sesh
        Attached Files

        Comment


        • #5
          See if this helps.

          I added button, colors and decimals with rounding.

          PHP Code:
          /***************************************
          Provided By : eSignal (c) Copyright 2006
          Description:  The Wilson Relative Price Channel
                        by Leon Wilson

          Version 1.0  05/05/2006

          Notes:
          * July 2006 Issue of Stocks and Commodities Magazine
          * Study requires version 7.9.1 or higher.


          Formula Parameters:                 Defaults:
          Channel Periods                     34
          Smoothing Periods                   1
          Over Bought                         70
          Over Sold                           30
          Upper Neutral Zone                  55
          Lower Neutral Zone                  45



          *************************************

          TRO_wilson_rpc 20060730  ADDED BUTTON, ROUNDING INPUT,  COLOR INPUT

          ***************************************/


          function preMain() {
              
          setPriceStudy(true);
              
          setStudyTitle("The Wilson Relative Price Channel ");
              
          setCursorLabelName("Over Bought"0);
              
          setCursorLabelName("Neutral Upper"1);
              
          setCursorLabelName("Neutral Lower"2);
              
          setCursorLabelName("Over Sold"3);
              
          setShowTitleParameters(false);
              
          setDefaultBarFgColor(Color.black0);
              
          setDefaultBarFgColor(Color.black1);
              
          setDefaultBarFgColor(Color.black2);
              
          setDefaultBarFgColor(Color.black3);
              
          setPlotType(PLOTTYPE_SQUAREWAVE0);
              
          setPlotType(PLOTTYPE_SQUAREWAVE1);
              
          setPlotType(PLOTTYPE_SQUAREWAVE2);
              
          setPlotType(PLOTTYPE_SQUAREWAVE3);
              


              var 
          iDecimals = new FunctionParameter("iDecimals"FunctionParameter.NUMBER);
              
          iDecimals.setName("Round to X decimals");
                  
          iDecimals.setDefault); 



              var 
          iColorTop = new FunctionParameter("iColorTop"FunctionParameter.COLOR);
                  
          iColorTop.setDefaultColor.lightgrey );
           
              var 
          iColorBottom = new FunctionParameter("iColorBottom"FunctionParameter.COLOR);
                  
          iColorBottom.setDefaultColor.darkgrey );

              var 
          iButtonX = new FunctionParameter("iButtonX"FunctionParameter.NUMBER);
              
          iButtonX.setDefault); 

              var 
          iButtonY = new FunctionParameter("iButtonY"FunctionParameter.NUMBER);
              
          iButtonY.setDefault15 ); 


              var 
          fp1 = new FunctionParameter("nPeriods"FunctionParameter.NUMBER);
                  
          fp1.setName("Channel Periods");
                  
          fp1.setLowerLimit(1);
                  
          fp1.setUpperLimit(250);
                  
          fp1.setDefault(34);
              var 
          fp2 = new FunctionParameter("nSmoothing"FunctionParameter.NUMBER);
                  
          fp2.setName("Smoothing Periods");
                  
          fp2.setLowerLimit(1);
                  
          fp2.setUpperLimit(55);
                  
          fp2.setDefault(1);
              var 
          fp3 = new FunctionParameter("nOB"FunctionParameter.NUMBER);
                  
          fp3.setName("Over Bought");
                  
          fp3.setLowerLimit(50);
                  
          fp3.setUpperLimit(99);
                  
          fp3.setDefault(70);
              var 
          fp4 = new FunctionParameter("nOS"FunctionParameter.NUMBER);
                  
          fp4.setName("Over Sold");
                  
          fp4.setLowerLimit(1);
                  
          fp4.setUpperLimit(50);
                  
          fp4.setDefault(30);
              var 
          fp5 = new FunctionParameter("nUpperNZ"FunctionParameter.NUMBER);
                  
          fp5.setName("Upper Neutral Zone");
                  
          fp5.setLowerLimit(50);
                  
          fp5.setUpperLimit(99);
                  
          fp5.setDefault(55);
              var 
          fp6 = new FunctionParameter("nLowerNZ"FunctionParameter.NUMBER);
                  
          fp6.setName("Lower Neutral Zone");
                  
          fp6.setLowerLimit(1);
                  
          fp6.setUpperLimit(50);
                  
          fp6.setDefault(45);
          }



          var 
          bVersion null;
          var 
          bInit false;

          var 
          xRPC null;

          function 
          mainiDecimalsiColorTopiColorBottomiButtonXiButtonY,
                         
          nPeriodsnSmoothingnOBnOSnUpperNZnLowerNZ ) {    

              if (
          bVersion == nullbVersion verify();
              if (
          bVersion == false) return;    

            
          // initialize upon first loading formula
              
          if(getBarState() == BARSTATE_ALLBARS) {
                  
          drawTextPixel(575" TRO_wilson_rpc @URL=EFS:editParameters"Color.whiteColor.green
                      
          Text.RELATIVETOLEFT|Text.RELATIVETOBOTTOM|Text.ONTOP|Text.BOLD|Text.BUTTON
                      
          "Comic Sans MS"13"UpExp"); 
                  
          vDate = new Date();
                  
          vInterval getInterval();
                  
          vSymbol getSymbol().toUpperCase();
              
                  
          // for RTH, eg, to convert, ES Z2 to ES Z2=2
                  
          var rootSymbol vSymbol.substring(0,3);
                  if (
          rootSymbol == "ES " || rootSymbol == "NQ "
                      if ( 
          vSymbol.indexOf("=2") == -vSymbol += "=2";
              
                  
          vSymbol += ",D";
                  return 
          null;
              }




              if (
          bInit == false) {
                  
          xRPC efsInternal("calcRPC"nPeriodsnSmoothingnOBnOSnUpperNZnLowerNZiDecimals);
                  
          bInit true;
              }
              
              var 
          nRPC_OB getSeries(xRPC0);  // Over Bought
              
          nRPC_OB rndnRPC_OB iDecimals ) ;

              var 
          nRPC_UN getSeries(xRPC1);  // Upper Neutral
              
          nRPC_UN rndnRPC_UN iDecimals ) ;

              var 
          nRPC_LN getSeries(xRPC2);  // Lower Neutral
              
          nRPC_LN rndnRPC_LN iDecimals ) ;

              var 
          nRPC_OS getSeries(xRPC3);  // Over Sold
              
          nRPC_OS rndnRPC_OS iDecimals ) ;



              
          setBarBgColoriColorTop0nRPC_UNnRPC_OB);
              
          setBarBgColoriColorBottom2nRPC_LNnRPC_OS);

              return new Array(
          nRPC_OBnRPC_UNnRPC_LNnRPC_OS);
          }

          function 
          calcRPC(nPeriodsnSmoothingnOBnOSnUpperNZnLowerNZiDecimals ) {
              var 
          nC close(0);
              var 
          OB ema(nSmoothingefsInternal("calcCord"nPeriodsnOB),      0);
              var 
          UN ema(nSmoothingefsInternal("calcCord"nPeriodsnUpperNZ), 0);
              var 
          LN ema(nSmoothingefsInternal("calcCord"nPeriodsnLowerNZ), 0);
              var 
          OS ema(nSmoothingefsInternal("calcCord"nPeriodsnOS),      0);
           

          denom Math.pow(10iDecimals);


              
          OB nC - (nC * (OB/denom));
              
          UN nC - (nC * (UN/denom));
              
          LN nC - (nC * (LN/denom));
              
          OS nC - (nC * (OS/denom));
              
              return new Array(
          OBUNLNOS);
          }


          function 
          calcCord(nPeriodsnCord) {
              return (
          rsi(nPeriods0) - nCord);
          }


          function 
          verify() {
              var 
          false;
              if (
          getBuildNumber() < 730) {
                  
          drawTextAbsolute(535"This study requires version 7.9.1 or later."
                      
          Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                      
          null13"error");
                  
          drawTextAbsolute(520"Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp"
                      
          Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                      
          null13"upgrade");
                  return 
          b;
              } else {
                  
          true;
              }
              
              return 
          b;
          }

          // ADDED FUNCTIONS

          function editParameters() {
              
          askForInput("TRO_wilson_rpc");
              return;
          }


          // rnd function - round to iDecimals places
          function rnd(valueiDecimals ) {  

          value =  value Math.pow(10iDecimals);

              return 
          Math.round(valueiDecimals) / Math.pow(10iDecimals);

          Attached Files

          Comment


          • #6
            Buzz,

            I thought you might take up the challenge, like the colours as well.

            My team won the cricket and I got a little sun as well, must get out of my dungeon more often.

            Paul.

            Comment


            • #7
              This is a similar peice of code from BB but just does the one line for the value of RSI you select.

              Interesting fact: the reverse engineering of a 50 value of a 14 period RSI is eqivalent to a 28 period ema (just tested that out to make sure I'm not talking rubbish).

              This is maybe why Buzz's combination of a 2 period RSI and a 5 (could go to a 4 ema if above followed) period ema works well together.

              Paul.
              Attached Files

              Comment


              • #8
                I can't get it to plot!

                Comment


                • #9
                  Hi Buzz,

                  just realised, all my chart backgrounds are grey and this is a white line - I guess your backgrounds are white.

                  Sorry about that.

                  Paul.

                  Comment

                  Working...
                  X