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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      81 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      41 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      64 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      66 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X