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 dappa, Today, 09:18 AM
    0 responses
    0 views
    0 likes
    Last Post dappa
    by dappa
     
    Started by bill2023, Yesterday, 08:51 AM
    4 responses
    22 views
    0 likes
    Last Post bltdavid  
    Started by trilliantrader, Today, 08:16 AM
    3 responses
    9 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by NinjaTrader_ChelseaB, 01-08-2017, 06:59 PM
    79 responses
    19,662 views
    5 likes
    Last Post zrobfrank  
    Started by funk10101, Today, 08:14 AM
    3 responses
    5 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X