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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    72 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    152 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    100 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    288 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X