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

Object global draw issue

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

    Object global draw issue

    Hello, I'm using the following code to draw object and I need to use global function to draw in all charts.

    All work fine using different names for every object:
    Code:
    Draw.Line(this, "Swing3Dw_"+ CurrentBar.ToString(), false, _H3_New_Time, _H3_New, _L3_New_Time, _L3_New, true, "ZZ3");
    It gives me more strong issues drawing objects, in Global crooshair and loading strategy when I try use refresh drawing using a unique name and changing positions of the objects.
    Code:
    Draw.Line(this, "New3_Swing", false, _L3_New_Time, _L3_New, _H3_New_Time, _H3_New, true, "ZZ3_UP");
    Is a problem to use the refresh object in global mode ...is true?

    Could you tell me something about?

    Many thanks. Best regards.
    Last edited by ClauTrade; 06-04-2023, 09:05 AM.

    #2
    When you say "refresh object" are you trying to change the existing one or add a new one? If you're trying to change the existing one you need to use the same name, or you need to retain a reference to it so you can manipulate its properties.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      Yes, about "refresh object" I change the same object using same name. As my two examples in first post, the first object have unique name drawing more objects, and all work fine. The second uses same name changing position of the same line. This last gives conflict, I thought because it has to draw, cancel and re-draw object in all chart.

      Comment


        #4
        Hello ClauTrade,

        Thanks for your post.

        I am not aware of any issues regarding drawing a global line drawing object on a chart with Draw.Line() and moving the line draw object.

        See the demonstration video which draws a global line on the chart using Draw.Line() and each time we have an up bar on the 1-Minute chart the indicator is applied to, the line is moved to a new location on both the 1-Minute chart and the 30-second chart.

        Demonstration video: https://brandonh-ninjatrader.tinytak...NF8yMTU0NzEzNA

        Have you added debugging prints to your script to see exactly how that drawing object is behaving?

        Below is a link to a forum post that demonstrates how to use prints to understand behavior.
        https://ninjatrader.com/support/foru...121#post791121

        You could consider making a simple test script that only draws that line on the chart so you can determine what exactly is causing the unexpected behavior. To create a copy of your script to modify, open a New > NinjaScript Editor, select your script, right-click in the Editor, select 'Save as', name the script, and click OK.

        ​​
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Haiasi, Today, 06:53 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by ScottWalsh, Today, 06:52 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by ScottW, Today, 06:09 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by ftsc2022, 10-25-2022, 12:03 PM
        5 responses
        256 views
        0 likes
        Last Post KeyonMatthews  
        Started by Board game geek, 10-29-2023, 12:00 PM
        14 responses
        244 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Working...
        X