Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by obwon1, Today, 02:16 PM
    2 responses
    7 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by obwon1, Today, 01:34 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by ernest93, Today, 01:26 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Kate  
    Started by nothingbutprofits, Today, 11:30 AM
    2 responses
    52 views
    0 likes
    Last Post NinjaTrader_PatrickH  
    Started by uri1007, Today, 12:22 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Jim  
    Working...
    X