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 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