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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      54 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      72 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      38 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      99 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      60 views
      0 likes
      Last Post PaulMohn  
      Working...
      X