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

Changing the value of indicator lines.

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

    Changing the value of indicator lines.

    I have a plot that has 2 horizontal lines on it. These lines have default values of 2 and 4. I have set the indicator with the intention that these values can be changed by the user. However, when I change either of the values, nothing happens.
    Click image for larger version  Name:	Screenshot 2022-04-25 155358.png Views:	0 Size:	7.7 KB ID:	1198682

    #2
    Hello Kaiviti57,

    Thanks for your post.

    If you have horizontal lines being placed on the chart by calling the AddLine() method or the Draw.HorizontalLine() method, you would need to ensure that your user-defined variables are being used when calling the method that makes a horizontal line in your script.

    For example, if you have a user-defined property called LineUpper, this variable would need to be used when calling your method to place the lines. If you are using AddLine(), the code might look something like below.

    AddLine(Brushes.Gray, LineUpper, "Upper");

    See the help guide documentation below for more information.
    AddLine(): https://ninjatrader.com/support/help...t8/addline.htm
    Draw.HorizontalLine(): https://ninjatrader.com/support/help...zontalline.htm

    Let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Yeah, I think I have already done that. See the below screenshot, please. I am also attaching the indicator file if that helps.

      Click image for larger version

Name:	AddLine.png
Views:	199
Size:	31.5 KB
ID:	1198821

      Comment


        #4
        Hello Kaiviti57,

        Thanks for your note.

        I see that you are calling AddLine() in State.SetDefaults. State.SetDefaults is only processed once when initially applying the indicator to a chart.

        You would need to move the AddLine() methods in the script to State.Configure if you would like to update the values of AddLine() dynamically based on a user-defined input. The code might look something like this.

        Code:
        else if (State == State.Configure)
        {
            AddLine(Brushes.Linen, 0, "Zero");
            AddLine(Brushes.Olive, LineUpper, "Upper");
            AddLine(Brushes.Firebrick, LineLower, "Lower");
        }
        See this help guide page for more information and sample code: https://ninjatrader.com/support/help...t8/addline.htm

        Let us know if we may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ZenCortexCLICK, Today, 04:58 AM
        0 responses
        2 views
        0 likes
        Last Post ZenCortexCLICK  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        172 responses
        2,280 views
        0 likes
        Last Post sidlercom80  
        Started by Irukandji, Yesterday, 02:53 AM
        2 responses
        17 views
        0 likes
        Last Post Irukandji  
        Started by adeelshahzad, Today, 03:54 AM
        0 responses
        4 views
        0 likes
        Last Post adeelshahzad  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        13 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X