Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Errors on custom code after last NT8 update

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

    Errors on custom code after last NT8 update

    Hello,

    After last update (Release Candidate 1) some parts of my code are throwing errors, some of them are this not recognized methods:

    Stroke.Dispose();

    and

    Bars.IsTimebased;

    Should I use another methods instead of them?

    #2
    Hello,
    There were some code breaking changes made with RC1 involving these two methods.
    Please see the code breaking changes of the help guide for more information: http://ninjatrader.com/support/helpG.../?8_0_0_13.htm
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Cody, that's useful.

      However I'm finding not that easy some other transformation in my code; I used to use some code similar to the one used (on previous version) on BarTimer to show remaining time on a certain location on the screen, but I can't make it work on current version.

      A way to get it is described here:



      But I'm getting an error relative to 'textBrush_aux' parameter when invocating DrawTextLayout with this code:

      Code:
      SharpDX.Direct2D1.Brush textBrush_aux = new SharpDX.Direct2D1.SolidColorBrush(RenderTarget, Color4.White);
      
      RenderTarget.DrawTextLayout(location, textLayout, textBrush_aux);
      I know this forum is not focused con C# itself, but since this code was used on previous versions of NT8 (on its own indicators code) and I'm just trying to keep my code working on new version (and given that it's not a complex issue) I would really appreciate just one simple example of how to keep on showing a text on a certain location and a simple brush. (In the given example on the forum, it takes the brush from a plot; I just want to be able to use a simple new brush).

      Thanks in advance.

      EDIT:

      The error I get is this one:

      Code:
      A direct X error has occured while rendering the chart: HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: Unknown
      
      Chart rendering failed. There is likely a problem with a chart object's OnRender method. D2D error = 'HRESULT: [0x88990001], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_STATE/WrongState], Message: Unknown'
      Last edited by manugarc; 09-06-2016, 07:41 PM.

      Comment


        #4
        Hello,
        Can you provide a simplified example of your script that reproduces what you are experiencing? This would provide us more information on what is going on with the object which would allow us to investigate further.
        Cody B.NinjaTrader Customer Service

        Comment


          #5
          Sure, I'll try to explain it in short while showing the "big picture":

          In previous Beta version of "BartTimer" indicator NT overrides OnRender(ChartControl chartControl, ChartScale chartScale) method and there it shows a label on X,Y coordinates using this function:

          RenderTarget.DrawTextLayout(location, textLayout, chartControl.Properties.AxisPen.BrushDX, DrawTextOptions.NoSnap);

          On last update, BarTimer doesn't overrides OnRender, which I've though is a better option since code keeps on "more abstracts layers", so I've tryed to modify my code (which does exactly the same as previous BarTimer, it just draw some labels on X,Y coordinates) to avoid overriding OnRender.

          The problem is new BarTimer doesn't override OnRender BUT neither show labels on X,Y coordinates; instead, it draws it's label using an ENUM which makes impossible to define X,Y.

          So: I've tried to not override OnRender, and still show my labels on X,Y coordinates, and as I don't have access to chartControl parameter, I define my Brush as I pasted on previous post. To recreate it, you just have to replace in the new BarTimer the line where it shows the label, and use X,Y coordinates instead of the ENUM. (And if you do it and get no errors, that's the line I need )

          On the other hand I'm not sure I should avoid to override OnRender, so if you think there's no problem doing it and it's perfectly correct, I'll just do that.

          Comment


            #6
            Hello manugarc,

            I would suggest the continued use of OnRender() if you wish to specify a specific X and Y coordinate to place your drawing.
            Zachary G.NinjaTrader Customer Service

            Comment


              #7
              Great. Then I'll just leave it as it is. Thanks!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by fx.practic, 10-15-2013, 12:53 AM
              5 responses
              5,404 views
              0 likes
              Last Post Bidder
              by Bidder
               
              Started by Shai Samuel, 07-02-2022, 02:46 PM
              4 responses
              95 views
              0 likes
              Last Post Bidder
              by Bidder
               
              Started by DJ888, Yesterday, 10:57 PM
              0 responses
              7 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by MacDad, 02-25-2024, 11:48 PM
              7 responses
              159 views
              0 likes
              Last Post loganjarosz123  
              Started by Belfortbucks, Yesterday, 09:29 PM
              0 responses
              8 views
              0 likes
              Last Post Belfortbucks  
              Working...
              X