Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Faster W%R

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

    Faster W%R

    I am trying to experiment with a faster W%R indicator. I want the period to be 8 versus the default. That is easy to do with the NT provided indicator, but I want to try to make these modifications. First, I wanted to see -20/-50/-80 horizontal lines versus the -30/-70 default in the existing indicator. Second, I want a 5 period SMA of the indicator itself. Can you offer any suggestions. Thank you!

    #2
    Hello AlphaOptions,

    Thank you for your post.

    You will need to edit the WiliamsR to achieve these items. To edit the WiliamsR go to the NinjaTrader Control Center > Tools > Edit NinjaScript > Indicator > WilliamsR > OK > then right click in the NinjaScript Editor for the WilliamsR > select Save As > give the indicator a name > then OK.

    Now you can edit the indicator and this will leave the original WilliamsR untouched.

    To add a line into the WilliamsR go to the Initialize() section and change the first two lines to the desired values and add the line you wish:
    Code:
    protected override void Initialize()
    {
    Add(new Line(Color.DarkGray, -20, "Lower"));
    Add(new Line(Color.DarkGray, -50, "Middle"));
    Add(new Line(Color.DarkGray, -80, "Upper"));
    In the Variables section change the Period to 8:
    Code:
    #region Variables
    private int period = 8;
    #endregion
    Once complete press F5 to compile.

    Then on your chart select your new WiliamsR, and then select an SMA and change the SMA's Input Series to the new WilliamsR you created.

    For information on working with indicators please visit the following link: http://www.ninjatrader.com/support/h...indicators.htm

    Please let me know if I may be of further assistance.

    Comment


      #3
      Patrick - thanks for the help. I think I almost got it. I received error (no context help) - line 24, column 15 in namespace? Also is it possible to add the MA to the script directly versus having to add another indicator to this script. like you have done in the RSI?

      Comment


        #4
        Hello,

        Thank you for your response.

        Please take a screenshot of the error and attach the screenshot to your response with the error message clearly visible.

        For the SMA you would need to create a new plot for the SMA. Below is an example of what you code would look like:
        Code:
        namespace NinjaTrader.Indicator
        {
        	/// <summary>
        	/// The Williams %R is a momentum indicator that is designed to identify overbought and oversold areas in a nontrending market.
        	/// </summary>
        	[Description("The Williams %R is a momentum indicator that is designed to identify overbought and oversold areas in a nontrending market.")]
        	public class WRTest : Indicator
        	{
        		#region Variables
        		private int		period	= 8;
        		#endregion
        
        		/// <summary>
        		/// This method is used to configure the indicator and is called once before any bar data is loaded.
        		/// </summary>
        		protected override void Initialize()
        		{			
        			Add(new Plot(Color.Orange, "Williams %R"));
        			Add(new Plot(Color.Blue, "SMA"));
        			Add(new Line(Color.DarkGray, -25, "Upper"));
        			Add(new Line(Color.DarkGray, -75, "Lower"));
        		}
        
        		/// <summary>
        		/// Called on each bar update event (incoming tick)
        		/// </summary>
        		protected override void OnBarUpdate()
        		{
        			Williams.Set(-100 * (MAX(High, Period)[0] - Close[0]) / (MAX(High, Period)[0] - MIN(Low, Period)[0] == 0 ? 1 : MAX(High, Period)[0] - MIN(Low, Period)[0]));
        			SMAW.Set(SMA(WilliamsR(Period), Period)[0]);
        		}
        
        		#region Properties
        		[Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                public DataSeries Williams
                {
                    get { return Values[0]; }
                }
        
                [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                public DataSeries SMAW
                {
                    get { return Values[1]; }
                }
        		/// <summary>
        		/// </summary>
        		[Description("Numbers of bars used for calculations")]
        		[GridCategory("Parameters")]
        		public int Period
        		{
        			get { return period; }
        			set { period = Math.Max(1, value); }
        		}
        		#endregion
        	}
        }

        Comment


          #5
          I went back and simply tried to save without any modification and here is what i see when I press F5. http://screencast.com/t/GxVAD5kq

          Comment


            #6
            Hello,

            Thank you for your response.

            Please attach the indicator to your response or send the indicator to support[at]ninjatrader[dot]com with 'ATTN: Patrick - 809060' in the subject line.

            You will find your indicator in the following directory on your PC: (My) Documents\NinjaTrader 7\bin\Custom\Indicator

            I look forward to your response.

            Comment


              #7
              Patrick - thank you for trying to help me. It is not going to help for me to send you the indicator because it will not compile nor save from the original WPR. Each time I open it, it reverts to the original even though it has a new name. It will not save the changes as I make them so I would just be sending you the original. I think this is the core problem but I am not an expert. Thanks for trying anyway - I do appreciate the effort.

              Comment


                #8
                Hello,

                Thank you for your response.

                I would like to schedule a support call with you today.

                Please send the following information to support[at]ninjatrader[dot]com:
                • A phone number where you can be reached
                • A time window where I can call you (please include a time zone)
                • Launch our remote support application from the following link, http://www.ninjatrader.com/remotesupport. Once launched, the application will provide you with an ID# and password. I will need these from you once I have you on the phone.

                I look forward to our support call.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Noerclou, Today, 04:55 AM
                0 responses
                2 views
                0 likes
                Last Post Noerclou  
                Started by llanqui, Yesterday, 09:59 AM
                2 responses
                17 views
                0 likes
                Last Post llanqui
                by llanqui
                 
                Started by ThoriSten, Today, 03:56 AM
                0 responses
                6 views
                0 likes
                Last Post ThoriSten  
                Started by PhillT, 04-19-2024, 02:16 PM
                3 responses
                23 views
                0 likes
                Last Post mangel2000  
                Started by TraderBCL, Today, 02:37 AM
                0 responses
                4 views
                0 likes
                Last Post TraderBCL  
                Working...
                X