Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calling OnRender Error

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

    Calling OnRender Error

    Having just installed beta 8.0.0.11, from 8.0.0.10, a previously functioning custom indicator is giving the following error:

    Error on calling 'OnRender' method on bar 0.

    What changed between beta versions?

    I should point out that the indicator was causing NT to crash (after a while) in 8.0.0.10 (it is a work in progress), but is was displaying and updating values.
    Now it won't even show up.
    Last edited by FatCanary; 05-16-2016, 03:48 PM.

    #2
    Hello,

    It is hard to say without debugging the code to address what specifically is failing, but based on the error and versions here I could say it may be the first item in Implementation changes


    I would suggest reading the pages linked under the first note to see if this applies in your error, if so likely you will need to modify the OnRender to utilize the syntax noted.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse

      That was my first thought.

      I changed some barsAgo to Bars.GetClose(barIndex).
      Unfortunately I missed some that were buried

      Found and fixed.
      Thanks.

      Comment


        #4
        Hello,

        I got error on calling OnRender method on bar 0:

        Strange is that the script generating this issue has on class member OnRender.

        It is only using Plot.Brushes etc. Plots look following:

        AddPlot(new Stroke(Brushes.Gray, 2), PlotStyle.Block, "LR");//8
        AddPlot(new Stroke(Brushes.Gray, 6), PlotStyle.Hash, "Level1");//9
        AddPlot(new Stroke(Brushes.Gray, 6), PlotStyle.Hash, "- Level 1");//10

        Can be the error source following section of the code?

        private static SolidColorBrush BrushFromArgb(int argb)
        {
        return new SolidColorBrush(Color.FromArgb(
        (byte)(argb >> 24),
        (byte)(argb >> 16),
        (byte)(argb >> 8),
        (byte)(argb)));
        }

        private static SolidColorBrush BrushFromArgb(int alpha, Brush baseBrush)
        {
        var brush = (SolidColorBrush)baseBrush;

        return new SolidColorBrush(Color.FromArgb(
        (byte)alpha,
        brush.Color.R,
        brush.Color.G,
        brush.Color.B));
        }

        Thank you for your feedback

        Miroslav

        Comment


          #5
          Hello,

          Thank you for the question.

          If the error is showing OnRender specifically,this would indicate something that is rendering is having a problem on bar 0. Are you using the OnRender override at all?

          The most simple way to find the problem would be to comment out code in the script until you no longer see this. Once you locate the line that controls the error it would be more apparent what the solution is.

          The code provided potentially could control the error, but outside of the script I would not know if this is the case. I would suggest to comment code out and locate what specifically is causing the error and provide that if is is still a question on why that is happening.

          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment


            #6
            Hello Jessie,
            no, I am not using override method OnRender in the script even in the related scripts. I was also checking if there was not some error on DirectX and not. This error showed suddenly and it was first occurance.I was reading threads to find if others have such issues and it was only when using override OnRender.

            I can send you log and trace file if you want but I have not find something special expect error OnRender on bar 0.....

            Miroslav

            Comment


              #7
              Hello here is the full error message I got without indicating even where to look for it and marking 500-800 lines by log catch is not feasible

              2016-11-01 09:29:09:443|3|4|Indicator 'XXXX': 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


                #8
                Hello,

                Thank you for the reply.

                In this case because you are not directly using OnRender, likely something you are using in your syntax is the cause. I could only suggest to reduce the code in this script until this no longer happens to find the specific cause.

                The log/trace would not be helpful in this case are you are presenting the full extent of the error, this would require you to reduce the script and further locate the reason.

                Generally this error is caused for the exact reason it states, that some series is being used and is requesting a bar that does not yet exist. An example would be on bar 0 two bars ago is requested which does not yet exist. This could be something you are calling such as an indicator or drawing tool.

                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Hello Jessie,

                  can it be caused by draw.region()? Can I use log() syntax even OnRender is not used will it catch this error as well?


                  Miroslav

                  Comment


                    #10
                    Hello,

                    Without knowing the general syntax at fault, at this point we could safely say it is something that Renders which could be most everything related to the chart. Without further debugging the script to find the general syntax anything I could suggest would only be a guess.

                    The log and Print syntax would likely not help in this. The most simple way to locate the problem would be to reduce the code until the problem stops. You could then work forward again un commenting code until it starts again to know what controls the error.

                    If you are using Drawing objects or other Indicators these would likely be good places to start looking.

                    I look forward to being of further assistance.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      hello Jessie,

                      can following error to have some interaction to OnRender error I got?

                      2016-10-14 13:27:16:031|3|4|A direct X error has occured while rendering the chart: HRESULT: [0x88990015], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_RESOURCE_DOMAIN/WrongResourceDomain], Message: Unknown
                      2016-10-14 13:27:16:031|3|16|Chart rendering failed. There is likely a problem with a chart object's OnRender method. D2D error = 'HRESULT: [0x88990015], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_RESOURCE_DOMAIN/WrongResourceDomain], Message: Unknown'
                      2016-10-14 13:27:16:137|3|16|Chart rendering failed. There is likely a problem with a chart object's OnRender method. D2D error = 'Index was out of range. Must be non-negative and less than the size of the collection.
                      Parameter name: index'

                      Comment


                        #12
                        Hello,

                        This would likely be related as it is a SharpDX error which is essentially what OnRender is used for.

                        Unfortunately these errors are not very helpful in explaining the actual problem without knowing what specific syntax is being used.

                        If the indicator mentioned in the error is the indicator you are creating, and this error only occurs while using your indicator the best solution would be to reduce the code of that indicator. Once you are able to find the source of the error in the code, we could explore further into why that is happening based on the code used.


                        I look forward to being of further assistance.
                        JesseNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Rapine Heihei, Today, 07:51 PM
                        0 responses
                        3 views
                        0 likes
                        Last Post Rapine Heihei  
                        Started by frslvr, 04-11-2024, 07:26 AM
                        5 responses
                        96 views
                        1 like
                        Last Post caryc123  
                        Started by algospoke, 04-17-2024, 06:40 PM
                        6 responses
                        49 views
                        0 likes
                        Last Post algospoke  
                        Started by arvidvanstaey, Today, 02:19 PM
                        4 responses
                        11 views
                        0 likes
                        Last Post arvidvanstaey  
                        Started by samish18, 04-17-2024, 08:57 AM
                        16 responses
                        61 views
                        0 likes
                        Last Post samish18  
                        Working...
                        X