Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 merzo, 06-25-2023, 02:19 AM
    10 responses
    823 views
    1 like
    Last Post NinjaTrader_ChristopherJ  
    Started by frankthearm, Today, 09:08 AM
    5 responses
    15 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    43 views
    0 likes
    Last Post jeronymite  
    Started by yertle, Today, 08:38 AM
    5 responses
    16 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by adeelshahzad, Today, 03:54 AM
    3 responses
    19 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Working...
    X