Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

OnRender D2DERR_WRONG_FACTORY/WrongFactory

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

    OnRender D2DERR_WRONG_FACTORY/WrongFactory

    maybe someone can help me, the following problem, i have 1 strategy each different instances (ID 227628150 and ID 227628151) on different accounts running. where approximately i have to look for the error and what triggers it i am aware, but how can i solve the problem?

    2021-03-19 15:22:13:966|3|16|Chart-Rendering fehlgeschlagen. Es ist wahrscheinlich ein Problem mit einer OnRender Methode eines Chartobjekts. D2D Fehler = 'HRESULT: [0x88990012], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_FACTORY/WrongFactory], Message: Gemeinsam verwendete Objekte müssen von der gleichen Zuordnungsinstanz aus erstellt werden.

    2021-03-19 15:22:17:755|3|4|DirectX Fehler ist während des Rendering aufgetreten: HRESULT: [0x88990012], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_FACTORY/WrongFactory], Message: Gemeinsam verwendete Objekte müssen von der gleichen Zuordnungsinstanz aus erstellt werden.

    2021-03-19 15:22:17:755|3|16|Chart-Rendering fehlgeschlagen. Es ist wahrscheinlich ein Problem mit einer OnRender Methode eines Chartobjekts. D2D Fehler = 'HRESULT: [0x88990012], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_FACTORY/WrongFactory], Message: Gemeinsam verwendete Objekte müssen von der gleichen Zuordnungsinstanz aus erstellt werden.
    I have created my own public class (StopLoss, ProfitTarget, PositionLine, EntryOrder) for my own charttrader lines:
    Click image for larger version

Name:	Screenshot_2.jpg
Views:	238
Size:	32.0 KB
ID:	1147422

    The values are stored in the base class (OnRender), for example:
    Code:
    if (positionLine != null) positionLine.OrderLabelRectX = rectXOrderLabelPos;
    I also have a short video about it: https://youtu.be/uf-EdtDvUT0

    they seem to be my problem now, with more than one chart. can anyone give me a helpful tip on how to solve the problem?
    sidlercom80
    NinjaTrader Ecosystem Vendor - Sidi Trading

    #2
    Hello sidlercom,

    Thank you for your post.

    Since NinjaTrader release 8.0.19.0 we now mandate NinjaTrader.Core.Globals.D2DFactory be used for custom rendering when needed and is accessed only in OnRender/OnRenderTargetChange.

    See the help guide documentation below for more information.
    D2DFactory - https://ninjatrader.com/support/help...d2dfactory.htm

    Ultimately, debugging steps should be taken for custom rendering errors. I would suggest taking the following debugging steps.

    Comment out and test various pieces of code that are rendering to find problematic part. Try to implement it in a separate script to focus on those rendering routines.

    Make sure to create resources in OnRender and dispose of those resources at the end of OnRender. Ensure those resources work, then move to optimizing your resources with OnRenderTargetChange.

    Make sure you understand the difference between device-dependent and device-independent resources, such as what needs a RenderTarget, and how to manage those resources. See the help guide below regarding device-dependent and device-independent resources.

    Using SharpDX for Custom Chart Rendering - https://ninjatrader.com/support/help...arpDXResources

    Note that using dummy values with the rendering routines may help when testing.

    If you find you are not getting D2D errors through your own script, isolate the issue. If D2D errors fall on items NinjaTrader items such as drawing tools or price markers (something you are not rendering yourself) please try to reproduce the issue and report it.

    Let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Waxavi, Today, 02:10 AM
    1 response
    16 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by Kaledus, Today, 01:29 PM
    5 responses
    13 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by Waxavi, Today, 02:00 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by alifarahani, Today, 09:40 AM
    5 responses
    23 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by gentlebenthebear, Today, 01:30 AM
    3 responses
    17 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X