Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to draw horizontal line in custom indicator

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

    how to draw horizontal line in custom indicator

    Hi,
    I'm trying to create a custom indicator that has 2 horizontal lines (1 line above the current price and 1 line below the current price). Similar to pivot lines. I've attached a screenshot of how I want it to look.

    Questions:
    1. What method/function do I call to draw the lines?
    2. Where do I make the function call to draw the lines? OnBarUpdate()?
    2. How can I update/redraw the lines only when price cross above or below the lines?

    thanks
    Attached Files

    #2
    Hello trader252,

    Thanks for your questions.

    1. What method/function do I call to draw the lines?
    All Drawing methods can be found here - https://ninjatrader.com/support/help...ml?drawing.htm

    2. Where do I make the function call to draw the lines? OnBarUpdate()?
    Yes, Draw methods can be called in OnBarUpdate.

    3. How can I update/redraw the lines only when price cross above or below the lines?
    The Drawing method can be called again with the same tag parameter, and the drawing object will be updated. (If you append CurrentBar to the tag, you will have a unique tag per bar, and thus unique drawing objects per bar.

    If you are new to NinjaScript, you may also wish to experiment using the Strategy Builder to create some simple drawing logic. The resulting syntax can be viewed with the View Code button.

    Drawing in the Strategy Builder - https://ninjatrader.com/support/help...ToDrawOnAChart

    We look forward to assisting.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    599 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    344 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
    558 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    557 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X