Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Failed to call OnRender for 'Text' in an indicator

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

    Failed to call OnRender for 'Text' in an indicator

    Hello, using the following code snippet in an indicator - the indicator plots some lines in the indicator panel and then draws some text as per below with the following Draw.Text call - i checked to see if the font was perhaps the issue but cant see what that would be. This code works in NT7 and error arose out of converting to NT8 - what is happening is the indicator draws the lines in the panel and the markers on the chart but it seems to freeze the chart window for ALL tabs - so the render issue is causing a widespread issue. Any thoughts on this

    thanks

    code ....


    private string dotText = "l";

    pfont = new SimpleFont( "Wingdings", 6) { Bold = true };


    Draw.Text(this,"dot"+CurrentBar.ToString(), true, dotText, 0, currDotValue, yPixels, currDotColor, pfont, TextAlignment.Center, Brushes.Transparent, Brushes.Transparent, 0) ;


    the following error messages result ....


    2016-01-08 15:58:57:214|3|16|Failed to call OnRender for 'Text': 'HRESULT: [0x88990016], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_PUSH_POP_UNBALANCED/PushPopUnbalanced], Message: The push and pop calls were unbalanced. '
    2016-01-08 15:58:57:214|3|16|Failed to call OnRender for 'Text': 'HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: The object was not in the correct state to process the method. '
    2016-01-08 15:58:57:214|3|16|Failed to call OnRender for 'Text': 'HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: The object was not in the correct state to process the method. '
    2016-01-08 15:58:57:214|3|16|Failed to call OnRender for 'Text': 'HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: The object was not in the correct state to process the method. '
    2016-01-08 15:58:57:214|3|16|Failed to call OnRender for 'Text': 'HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: The object was not in the correct state to process the method. '
    2016-01-08 15:58:57:214|3|16|Failed to call OnRender for 'Text': 'HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: The object was not in the correct state to process the method. '
    2016-01-08 15:58:57:214|3|16|Failed to call OnRender for 'Text': 'HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: The object was not in the correct state to process the method. '
    2016-01-08 15:58:57:215|3|16|Failed to call OnRender for 'Text': 'HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: The object was not in the correct state to process the method. '
    2016-01-08 15:58:57:215|3|16|Failed to call OnRender for 'Text': 'HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: The object was not in the correct state to process the method. '
    2016-01-08 15:58:57:215|3|16|Failed to call OnRender for 'Text': 'HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: The object was not in the correct state to process the method. '
    2016-01-08 15:58:57:215|3|16|Failed to call OnRender for 'Text': 'HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: The object was not in the correct state to process the method. '
    2016-01-08 15:58:57:215|3|16|Failed to call OnRender for 'Text': 'HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: The object was not in the correct state to process the method. '
    2016-01-08 15:58:57:215|3|16|Failed to call OnRender for 'Text': 'HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: The object was not in the correct state to process the method. '

    #2
    I haven't played with this for a while, but from what I remember, make sure your FREEZE all your resource before calling the Draw.Text() or any other Draw function. Not sure if this is the problem, but figure I would put it out there in case it helps.

    So make sure "currDotColor" is frozen, I am not sure if SimpleFont has that option but if it does, I would freeze that too.

    Comment


      #3
      Heh NJA, thanks for the reply it prompted me to examine the code above what i showed you and there were some instances in the logic where 'currDotColor' was undefined and thus the Brush was not set.
      It was a predefined brush and now know but more on Freeze for using custom defined brushes for other scenarios - so in this case freeze wasnt required.
      Also a lesson in porting / converting code i did not write and sourced from the forum and needing to go over line by line in the conversion particularly for rendering and graphics calls. Have converted quite a few indicators now with Draw objects and had not run into this issue but undefined Color did not seem to pose an issue in NT7 - somehow it retained a value.

      thanks

      Comment


        #4
        So unfortunately this is not resolved and the issue was not the Brush setting.

        I was looking at this over weekend and this works fine with a live connection but no data coming in.
        This morning it was working for a period then as tick rate picks up the screen is not selectable i then was forced to close N8 and the same above error messages result.

        Can you see if you can reproduce this . btw the text character of the wingding set is 'l' lower case elll ie j k l m not 1. The reason for using this as was used in N7 is ability to set the font size of chart markers as the N8 like N7 one still cannot change the size of dots or other chart markers.
        Also the preferable approach would be to use a Plot line - but this indicator has plots in the indicator panel and the purpose of the Draw.Text is to draw on the price panel some associated markers.

        Interesting this is not an issue in N7 and the signature for the Draw.Text other than the 'this' as parameter 1 and the Brush in place of Color.

        if you need further info to reproduce let me know

        thanks

        Comment


          #5
          In the interim i have replaced Draw.Text with Draw.Line which seems to be working better and not freezing the charts and forcing a close of N8. Is Draw.Text a huge overhead in general vs Draw.Line - in any case something is out of alignement with Draw.Text it would appear.
          As per previous posts requests has the error messaging to the log been changed for impending beta 8 with respect to more detail ie context chart instrument etc ?

          thanks

          Comment


            #6
            soulfx,

            Improvements to reporting are considered in all cases.

            Do you have a script that reproduces this in Beta release 8 of NinjaTrader 8?

            Comment


              #7
              Hello following some tweaking to code and testing i decided to separate out the indicator into 2 indicators 1 for drawing only on the chart panel and 1 for only drawing on the Indicator panel.
              Whilst it appeared to work and after trying a tip from N7 which apparently is unsupported (yet works on N7) to change the setting DrawOnPricePanel from true to false in front of the Draw.x methods seemed to drag the performance. I am not receiving the error messages and performance seems fine.
              SO to clarify if it NOT Recommended to mix drawing within a panel indicator to attempt to draw on the indicator panel and the chart/price region? Is it unsupported to try to do so?

              I would have thought with the drawing the ability to draw on 2 panels within an indicator would be possible and not an issue - has this been raised as a feature request.

              So in summary the separation approach works best at the moment but some clarification on the above questions would be appreciated
              thanks

              Comment


                #8
                soulfx,

                I am not sure I fully follow what you did here. So you had DrawOnPricePanel set to true and then switched it to false before the drawing? What was the purpose of this?

                Can you provide a sample script of the DrawOnPricePanel and of the WingDings items?

                Comment


                  #9
                  Hello,

                  here is link to previous topic on this

                  also there was another forum topic where it was suggested to try
                  Drawing with DrawOnPricePanel = true
                  do some drawing
                  then set to false
                  do some drawing
                  thereby accomplishing drawing on the chart panel and price panel.
                  The purpose of this is as was explained going back to beginning of this thread trying to accomplish both with one indicator.
                  I will try to find the other forum post on this where it works in NT7.

                  If Plots are set in an indicator they will draw on the indicator panel
                  and by setting DrawOnPricePanel to true .. draw methods would draw on chart.

                  I am trying to ascertain what works / what is recommended / what is and is not supported.
                  I think it is clear.
                  I supplied wingding code below .. or do you need a cut down script?
                  There are issues with this here that is clear and i am trying to establish guidelines as it is NOT clear in the documentation what is and is not supported. As i stated it 'should' be feasible with the drawing revamp of N8 but that is not clear.
                  As i stated since splitting out the code into 2 indicators it so far appears to work better but this is not ideal to have 2 loaded indicators when one would suffice and the ability to control which panel to draw in
                  thanks

                  Comment


                    #10
                    soulfx,

                    Switching DrawOnPricePanel would not be recommended. Using two indicators would be recommended. While using DrawOnPricePanel and switching it between true and false works, in my tests it is heavy on performance and drags down the refresh of the chart enough for it to be noticeable.
                    I will dig further if there is a means to do so in OnRender.

                    I tested your Draw.Text() line from the initial post a few times and did not see any issues. Is this something you are performing in another method? I assumed this was used in OnBarUpdate(), is this correct?

                    Comment


                      #11
                      Hello, ' I tested your Draw.Text() line from the initial post a few times and did not see any issues. Is this something you are performing in another method? I assumed this was used in OnBarUpdate(), is this correct? ' Yes to both
                      For now i just removed the chart part of the indicator doing draw.text with the wingding font and thus far am not getting these errors as per the initial posting. It is interesting the error messages only show up once i close N8 and relogin. They dont appear realtime. The performance without this is better and i realise there is alot of market volatility - i was applying this to a tick chart for the ES and ZB and the charts were set to Tick Replay True. So i will isolate this draw and test a bit more when i have time. I lost alot of time trying to test and reload charts last week so i will get back to this in a week or so. But there is some issue yet to be identfied with this. I will send/email some code once i can replicate or send the indicator as is once i have reviewed.
                      thanks

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by kevinenergy, 02-17-2023, 12:42 PM
                      115 responses
                      2,699 views
                      1 like
                      Last Post kevinenergy  
                      Started by prdecast, Today, 06:07 AM
                      1 response
                      4 views
                      0 likes
                      Last Post NinjaTrader_LuisH  
                      Started by Christopher_R, Today, 12:29 AM
                      1 response
                      14 views
                      0 likes
                      Last Post NinjaTrader_LuisH  
                      Started by chartchart, 05-19-2021, 04:14 PM
                      3 responses
                      577 views
                      1 like
                      Last Post NinjaTrader_Gaby  
                      Started by bsbisme, Yesterday, 02:08 PM
                      1 response
                      15 views
                      0 likes
                      Last Post NinjaTrader_Gaby  
                      Working...
                      X