Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Horizontal Price Line extended right; proper class?

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

    Horizontal Price Line extended right; proper class?

    Good afternoon,
    I have been using the Draw. class to produce horizontal lines at my desired prices.
    Code:
               // Draw horizontal line
        Draw.HorizontalLine(this,
            "SignificantLevel_" + CurrentBar.ToString(),
            significantLevel,
            Brushes.RoyalBlue,
            DashStyleHelper.Solid,
            3);​
    While this is visually appealing and fairly resource efficient, this is not quite correct. The lines should not extend backwards before the OnBarUpdate() on which they are produced yet by default it seems that the horizontal line does so without a bool option to extend lines into the past which could skew hindsight biases...
    I need the line to only extend right and I would prefer not to have to specify the exact number of bars as that shouldn't be required.
    Should I use another class and simply specify the same y- value twice to make the line straight?

    Also whichever class you recommend, I also need the line to be about 50% transparent and the last C# method I tried to define the brush caused errors.

    NinjaTrader 8​
    I did my homework before bothering you but my first thoughts were quite wrong.

    If you have any insights or can point me in the correct direction I would be grateful as always.

    #2
    Hello DynamicTest,

    You would need to use Draw.Ray for that purpose. Use 1 bars ago or 0 bars ago as the start bar and then use 0 or -1 bars ago as the end bars ago to point it to the right.

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello DynamicTest,

      You would need to use Draw.Ray for that purpose. Use 1 bars ago or 0 bars ago as the start bar and then use 0 or -1 bars ago as the end bars ago to point it to the right.
      Thank you so much for clarifying!
      Have a great weekend!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      590 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      342 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      555 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      552 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X