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 Gerik, Today, 09:40 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by RookieTrader, Today, 09:37 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by alifarahani, Today, 09:40 AM
    0 responses
    5 views
    0 likes
    Last Post alifarahani  
    Started by KennyK, 05-29-2017, 02:02 AM
    3 responses
    1,284 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by AttiM, 02-14-2024, 05:20 PM
    11 responses
    186 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X