Announcement

Collapse
No announcement yet.

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:	296
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.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    51 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    129 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X