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:	229
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 Hwop38, 05-04-2026, 07:02 PM
    0 responses
    162 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    313 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    245 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    350 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    179 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X