Announcement

Collapse
No announcement yet.

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.

        ​​
        <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
        52 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        130 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        70 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        43 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        47 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X