Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

drawing a line between trigger and a past bar

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

    drawing a line between trigger and a past bar

    I have read over the documentation regarding drawing lines but I don't see any
    specific info regarding what I'm trying to code.

    What I want to do is have the indicator draw a horizontal line from the close of the trigger bar in a method to the close of a bar I've assigned to a double from a previous trigger. The reason I need to use a double for the 1st plot point is that I don't know what bar it occurred on the past when the current trigger bar occurs.

    I'm assuming I need to use this but what do i put in the ()

    HorizontalLine myLine = Draw.HorizontalLine( please fill in blanks here )

    To make the example easier to understand just the var previoustrigger in the explanation.

    Also how do I draw a line a set number of bars forward or backwards from the current bar. Thanks in advance for your assistance.
    Last edited by gordongekko; 12-10-2017, 12:38 AM.

    #2
    Hello gordongekko,

    Thank you for your note.

    If you wanted to draw a line between two points, you would want to use Draw.Line rather than Draw.HorizontalLine.

    You could use the syntax which takes a start/end bars ago, or a DateTime object.

    Using the bar index syntax, the following would draw a line between the current bar and 10 bars back.

    Code:
    Draw.Line(“this”, “x”+CurrentBar, 10, Close[0], 0, Close[0], Brushes.Red);
    Please see the following section of our helpguide,


    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    164 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    318 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    246 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