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

D2derr_wrong_factory

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

    D2derr_wrong_factory

    Hello-

    I'm not seeing adequate answers to my question re: this error, so I'll ask a different way:

    Hypothetically, you have only 2 print statements:

    Draw.Text(this,"FDivImbal" + CurrentBar, IsAutoScale, (+ filledDivImbalance).ToString("#"), 0, Low[0], -(placementats),
    Brushes.Cyan, ChartControl.Properties.LabelFont, TextAlignment.Center, Brushes.Transparent, Brushes.Transparent, 0);
    and:

    Draw.Text(this,"NormRatio" + CurrentBar, IsAutoScale, (+ fPImbalNormRatio).ToString("#.#"), 0, Low[0], -78,
    Brushes.Orange, ChartControl.Properties.LabelFont, TextAlignment.Center, Brushes.Transparent, Brushes.Transparent, 0);
    At random times throughout the day you get:

    [D2DERR_WRONG_FACTORY/WrongFactory], Message: Objects used together must be created from the same factory instance.

    Here are my specific questions:

    1) In order to find the cause of this error, on what SPECIFIC part(s) of the print statements will you focus?
    2) As you focus on this part(s), what are you hoping to change in order to fix this error?

    Please someone answer these questions.

    Thank you.

    #2
    Hello,

    Thank you for the post.

    I wanted to gather more details on this item.

    Regarding your questions,

    1: If you were to debug this, I would suggest focusing on commenting out all logic except what you think is causing the problem. For example, if you need Two Draw.Text's, I would suggest creating a new script that only uses Two texts and test with that. Eliminating all other logic in the script would help you identify an absolute portion of syntax to focus on.

    2: When you locate the region of syntax that is having a problem you would need to replace it with modified syntax that works for the purpose. If it is easy to see what needs to be changed, we would want to see an example of that specific syntax and how it is being used along with the setup instructions. We could then try to recreate what you are seeing from the provided sample. In some cases, you may be seeing something unexpected and we could confirm that using the sample that demonstrates it, otherwise we could look into what another syntax can be used to prevent the problem.

    If you can refine the script you are working on and still produce the error, I would first like to try and recreate that myself using your modified sample. In the case I could not we may want to look into other specifics related to your system.



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

    Comment


      #3
      Thanks for that. If I have more than one indicator doing similar things with similar print statements with variables which have the same names, is it possible for one to conflict with the other and cause an error? Or are they always treated separately and the error is coming from only one indicator?

      Thank you.

      Comment


        #4
        Hello,

        Generally speaking, everything is separate related to error reporting from the platform. There can be situations where developers make scripts communicate so it is possible that other items affect each other but you would still likely get the error from the script the exception happened in. In the case of these type of errors, they can be difficult to track down as they are lower level error codes which have little meaning in relation to the syntax you are using.

        Because this error is related to rendering, it could be something you are using syntax wise in the script or could be some standard NinjaScript syntax and the way it is being used. Most items in the platform render now so it can make identifying the source more difficult.

        If you have multiple scripts producing the error, I would suggest to start simple and try 1 script and see if the same outcome happens. You could build up to the current state you are in now to find the tipping point.

        Sometimes it can be helpful to do this in reverse as well or to save a template of the chart in question, then remove an item and check for errors. Keep removing items and ensure the error keeps happening. This would eliminate excess items that are not related. The template just allows you to reload the error state to start over if you fail to find any relevant details.


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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jclose, Today, 09:37 PM
        0 responses
        4 views
        0 likes
        Last Post jclose
        by jclose
         
        Started by WeyldFalcon, 08-07-2020, 06:13 AM
        10 responses
        1,413 views
        0 likes
        Last Post Traderontheroad  
        Started by firefoxforum12, Today, 08:53 PM
        0 responses
        9 views
        0 likes
        Last Post firefoxforum12  
        Started by stafe, Today, 08:34 PM
        0 responses
        10 views
        0 likes
        Last Post stafe
        by stafe
         
        Started by sastrades, 01-31-2024, 10:19 PM
        11 responses
        169 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X