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 helpwanted, Today, 03:06 AM
        1 response
        7 views
        0 likes
        Last Post sarafuenonly123  
        Started by Brevo, Today, 01:45 AM
        0 responses
        7 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X