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:	225
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 sjsj2732, Yesterday, 04:31 AM
    0 responses
    27 views
    0 likes
    Last Post sjsj2732  
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    283 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    280 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    131 views
    1 like
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    90 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Working...
    X