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 set dynamic value for Line?

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

    how to set dynamic value for Line?

    Hello,

    In Initialize I have...

    Add(new Line(Color.Black, AlertLevel, "Line"));

    How can I dynamically change where the Line is plotted, based on a new value of AlertLevel (that would occur during an OnBarUpdate)?

    I do not have the correct value of AlertLevel at Initialize time.

    thank you

    #2
    Hello,

    You an use Lines which is similar to Values in NinjaScript.

    Here is the syntax:

    Code:
    Lines[0].Value = 200;
    Also one note about Lines, if the value of the price is 1000, and my Line is 100, I would not see the line because these do not autoscale. So please keep this in mind if you do not see the line, look at the charts Price opposed to the Lines value and see that value is on the chart or not.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by Turtle Trader View Post
      Hello,

      In Initialize I have...

      Add(new Line(Color.Black, AlertLevel, "Line"));

      How can I dynamically change where the Line is plotted, based on a new value of AlertLevel (that would occur during an OnBarUpdate)?

      I do not have the correct value of AlertLevel at Initialize time.

      thank you
      You probably should use the DrawLine() method, instead of a static line in Initialize().

      Comment


        #4
        You can also add a simple plot and select the PlotStyle HLine. This has the advantage to allow you to understand where your line was historically plotted, when you scroll back your chart horizontally.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by RubenCazorla, 08-30-2022, 06:36 AM
        3 responses
        77 views
        0 likes
        Last Post PaulMohn  
        Started by f.saeidi, Yesterday, 12:14 PM
        9 responses
        23 views
        0 likes
        Last Post f.saeidi  
        Started by Tim-c, Today, 03:54 AM
        0 responses
        3 views
        0 likes
        Last Post Tim-c
        by Tim-c
         
        Started by FrancisMorro, Today, 03:24 AM
        0 responses
        4 views
        0 likes
        Last Post FrancisMorro  
        Started by Segwin, 05-07-2018, 02:15 PM
        10 responses
        1,772 views
        0 likes
        Last Post Leafcutter  
        Working...
        X