• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 B11 OnRender not plotting anything

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

    NT8 B11 OnRender not plotting anything

    My indicators that use OnRender to draw in the indicator panel no longer plot anything.

    Here is one indicator that shows this problem, please let me know if you can duplicate, or if I messed something up when doing the version update.

    This indicator should be placed in a subfolder named SampleCode.
    Attached Files
    Last edited by Ricam; 05-14-2016, 09:31 PM.

    #2
    Ichimoku indicator stopped working with following error in log file:

    Indicator 'MyIchimoku': Error on calling 'OnRender' method on bar 0: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

    Comment


      #3
      Reverting to B10 for now

      The indicator that I attached in my last post does not seem to work at all, even in B10, but all other indicators that use OnRemder resumed working normally after I rolled back from B11 to B10.

      I think you need to uninstall B11 before going back to B10. The B11 SQL databases are different but the B10 installer does not replace them with the B10 databases. (The .sdf files, not the data files. The ones in MyDocuments and in ProgramFiles.)
      Last edited by Ricam; 05-15-2016, 06:42 AM.

      Comment


        #4
        Originally posted by Ricam View Post
        The indicator that I attached in my last post does not seem to work at all, even in B10,
        I also see the same. The one you posted only prints to the output window, nothing happens on the chart.

        Comment


          #5
          Originally posted by Ricam View Post
          The indicator that I attached in my last post does not seem to work at all, even in B10, but all other indicators that use OnRemder resumed working normally after I rolled back from B11 to B10.
          I use OnRender rather extensively and have not had any problems in B11... (other than making some modification to use absolute index lookups as mentioned in the code breaking changes)

          http://ninjatrader.com/support/helpG.../?8_0_0_11.htm

          I didn't analyze your logic to figure out exactly what it was suppose to do, and didn't try using it in the subfolder, but removing the SampleCode from your namespace, and sticking it in the normal indy folder seems to render fine.. Maybe that is where there is a problem...


          -=Edge=-
          NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

          Comment


            #6
            Clarification

            I have several other indicators besides the buggy OnRender example that worked fine on B10 and don't plot anything on B11, where the OnRender method throws out of range errors on every bar.

            For now i have rolled back to B10, pending clarification from Ninjatrader..

            Comment


              #7
              Hello Ricam,

              Thank you for your post.

              Using your indicator in Beta 10 and Beta 11 I see no rendering until I apply the indicator to the Input Series' panel. Do I need to add something specific to see this work on the indicator panel?
              Last edited by NinjaTrader_PatrickH; 05-16-2016, 01:44 PM.
              Patrick H.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_PatrickH View Post
                Hello Ricam,

                Thank you for your post.

                Using your indicator in Beta 10 and Beta 11 I see no rendering until I apply the indicator to the Input Series' panel. Do I need add something specific to see this work on the indicator panel?
                Could you try Ichimoku indicator from following thread?
                http://ninjatrader.com/support/forum...light=Ichimoku

                And indicator is :http://ninjatrader.com/support/forum...3&d=1452570032

                Or same one is attached here.

                It used to work on all Betas until B11.

                In B11 I tried "Range" bar on EURUSD and got an error in log:
                5/16/2016 2:48:57 PM Default Indicator 'phIchimokuCloud_R1': Error on calling 'OnBarUpdate' method on bar 10792: Index was outside the bounds of the array.


                Or on minute chart I got following:
                Time Category Message
                5/16/2016 2:52:53 PM Default Indicator 'phIchimokuCloud_R1': Error on calling 'OnRender' method on bar 0: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

                Thanks
                Attached Files

                Comment


                  #9
                  GetValueAt() fixed it

                  I don't see anything in the code of the sample indicator that explains why it only works in the price panel. Strange....

                  I think it was a Ninjatrader reference sample.

                  In any event, the problems with my custom indicators in B11 went away when I used GetValueAt(Bar Index) to get the values of the series, instead of just using [bars back] in brackets.
                  Last edited by Ricam; 05-17-2016, 09:49 AM.

                  Comment


                    #10
                    There have been changes to OnRender in Beta 11. Specifically the following in relation to Ricam's case:
                    In some scenarios, the OnRender() method no longer guarantees the bars indexer to be up to date before it is called. Due to the multi-threaded nature of NinjaTrader, attempting to access a series barsAgo value could return seemingly unexpected results (E.g., Close[0], SMA(20)[0], etc). This change does NOT impact data driven events, such as OnBarUpdate(), OnMarketData(), OnOrderUpdate(), etc. For all OnRender() purposes, you should consider using an absolute index lockup through Bars.GetClose(barIndex), or <series>.GetValueAt(barIndex) which are generally more reliable in non-data driven events. Please also see the new IsValidDataPointAt() which was added to help with absolute index look up.
                    Taken from the following link: http://ninjatrader.com/support/helpG...s/8_0_0_11.htm
                    Last edited by NinjaTrader_PatrickH; 05-18-2016, 11:46 AM.
                    Patrick H.NinjaTrader Customer Service

                    Comment


                      #11
                      Code in the FormatPriceMarker method also needed to be updated.
                      As the release notes state, this change applies to all methods other than the most used Update ones.

                      You shouldn't just consider making this change... it is mandatory.

                      Remember that GetValueAt needs the bar INDEX, not the number of bars back from the Current Bar that you would use to get the value of a series in an expression like Values[0][BarsBack]. Bar INDEX is the CurrentBar bar number, which increases from left to right.

                      There seems to be an improvement in backfill speed in B11, but for now I can't be sure. It performed very well today.
                      Last edited by Ricam; 05-17-2016, 01:26 PM.

                      Comment


                        #12
                        OnRender went to heck

                        For the last several weeks we have (temporarily) suspended testing NT8 pending another beta....
                        Today I installed b11 today and all of the OnRender's freaked out. Some give a 'out of range' error...others just don't show anything.

                        Have not spent much time looking at it, but got one indicator working by removing the following piece of code...
                        Yval = chartScale.GetYByValue(Closes[0][myvalue]);


                        perhaps I resumed beta testing a bit too quickly.
                        Last edited by photog53; 05-17-2016, 08:13 PM.

                        Comment


                          #13
                          Just change lines like this

                          Yval = chartScale.GetYByValue(Closes[0][0]);
                          to
                          Yval = chartScale.GetYByValue(Closes[0].GetValueAt(CurrentBar));

                          or
                          Yval = chartScale.GetYByValue(Closes[0][1]);
                          to
                          Yval = chartScale.GetYByValue(Closes[0].GetValueAt(CurrentBar-1));


                          Bear in mind that the second subscript in the first expression counts back from the current bar, but that the argument of GetValueAt is the BAR INDEX of the bar that has the data you want.

                          If you are iterating an index starting from ChartBars.FromIndex and going ++ from there in an OnRender loop, use the value of the index as the argument for GetValueAt (instead of CurrrentBar)

                          Code:
                          for(int idx = ChartBars.FromIndex; idx<=ChartBars.ToIndex; idx++)
                          {
                          yHi= chartScale.GetYByValue(Highs[0].GetValueAt(idx)); yLo= chartScale.GetYByValue(Lows[0].GetValueAt(idx)); .. etc
                          }
                          NT8 capabilities and performance are easily an order of magnitude greater than those of NT7, making an emphasis on continuing to develop for NT7 ultimately self defeating.
                          Last edited by Ricam; 05-18-2016, 02:23 PM.

                          Comment


                            #14
                            Originally posted by Ricam View Post
                            Just change lines like this

                            Code:
                             Yval = chartScale.GetYByValue(Closes[0][0]);
                             to
                            Yval = chartScale.GetYByValue(Closes[0].GetValueAt(CurrentBar));
                            
                            or
                            Yval = chartScale.GetYByValue(Closes[0][1]);
                            to
                            Yval = chartScale.GetYByValue(Closes[0].GetValueAt(CurrentBar-1));

                            I do not believe that is correct.. Please correct me if I'm wrong..

                            In some scenarios, the OnRender() method no longer guarantees the bars indexer to be up to date before it is called. Due to the multi-threaded nature of NinjaTrader, attempting to access a series barsAgo value could return seemingly unexpected results (E.g., Close[0], SMA(20)[0], etc).
                            Code:
                            Close[0]  becomes  Bars.GetClose(barindex) 
                            Closes[0][0]  becomes  BarsArray[0].GetClose(barindex) 
                            Closes[1][0]  becomes  BarsArray[1].GetClose(barindex)
                            Where barindex is the absolute index of the bar, not bars back..


                            -=Edge=-
                            NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                            Comment


                              #15
                              I do not believe that is correct.. Please correct me if I'm wrong..
                              I don't see how that is constructive.

                              I am not responsible for providing sample code or engaging in debates with other members.
                              Nevertheless, I will consider evaluating and correcting problem code affected by this issue.

                              My indicators that use OnRender work correctly.

                              Two of them are in panels 2 and 3 of the attached chart.

                              Please let me know if I may be of further assistance.
                              Attached Files
                              Last edited by Ricam; 05-19-2016, 09:54 AM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by ttodua, Today, 12:03 PM
                              1 response
                              4 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by tomtr27, Today, 11:35 AM
                              1 response
                              8 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by Uregon, Today, 07:30 AM
                              2 responses
                              7 views
                              0 likes
                              Last Post bltdavid  
                              Started by Induna, 02-20-2020, 05:38 AM
                              3 responses
                              21 views
                              0 likes
                              Last Post forrestang  
                              Started by Marklhc1988, Today, 09:53 AM
                              3 responses
                              10 views
                              0 likes
                              Last Post NinjaTrader_Heath  
                              Working...
                              X