Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Line Usage

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

    Draw.Line Usage

    Refer to the image below. How do I use the Draw.Line object to draw a line from the current High[0](i.e. point A) to High[x] (i.e. point B). My current code is drawing horizontal lines that runs through the entire screen (see code below).

    if ( (Close[0] < Open[0])
    && (Close[1] < Open[1])
    && (Close[2] > Open[2])
    && (Close[3] > Open[3])
    )

    {
    BullishBCD2 = true;
    Divp1 = Low[1];
    BarsCounter1 = CurrentBar;
    }

    if((Close[0] < Close[1])
    && (BullishBCD2 == true)
    && (Close[0] > Open[0])
    && (Close[1] > Open[1])
    )

    {
    Draw.Line(this, test+CurrentBar, false, CurrentBar - BarsCounter1, Low[0], BarsCounter1, Divp1, Brushes.White, DashStyleHelper.Solid, 2, true);
    }​



    Click image for larger version

Name:	image.png
Views:	223
Size:	13.6 KB
ID:	1274041


    #2
    Hello cryfgg,

    Thanks for your post.

    If the script is not behaving as expected then it is necessary to add debugging prints to the script to understand exactly how your logic is behaving and drawing lines on the chart.

    Add prints to the script (outside the conditions) that prints out each of the values being used within the conditions. Also, add prints one line above the Draw.Line() method to see exactly what values you are passing into the Draw.Line() method.

    Below is a link to a forum post that demonstrates how to use prints to understand behavior.
    https://ninjatrader.com/support/foru...121#post791121
    <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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X