Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Programming the WilliamsR

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

    Programming the WilliamsR

    Hi

    Using the function for WilliamsR always produces a significantly different result than displayed on the chart. For example, using AUDUSD from the forex.com feed, the last bar of last week (25/09/2009 17:00 EST) the chart value is -60.00
    but the function returns -.36.73.

    The code is:

    double a = WilliamsR(this.Input, 21)[0];
    double b = WilliamsR(21)[1];

    Print(string.Format("{0}:Current: {1}, Previous: {2}", Time[0], a, b));

    Thanks

    #2
    Hello,

    Why are you using this.Input? Use Input, Close, Open, etc. See if that makes and difference. If not please reply.
    DenNinjaTrader Customer Service

    Comment


      #3
      Hi Ben

      I've already tried all those, as well as the overload with just the period; they all give the identical results.

      Comment


        #4
        Hello,

        I'll have someone look at this on Monday.
        DenNinjaTrader Customer Service

        Comment


          #5
          For sure they will return different values because you are accessing different bars. [0] is the last bar. [1] is the previous bar.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Thanks Josh.

            However value of the last bar of the chart and the value returned by the 0 bar are different. The function is returning values different than reported on the charts (for the same bar).

            Thanks

            Comment


              #7
              You likely aren't comparing the same bars. Make sure you are using the same parameters and the same CalculateOnBarClose settings.
              Attached Files
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Thanks Josh. You must be right because it's ok now.

                Sorry for wasting your time.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                637 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                366 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                107 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                569 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                571 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X