Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting user input for indicator

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

    Getting user input for indicator

    I found this post but it's closed so I couldn't reply there.



    I'd like to use this code to update info in my indicator. It looks perfect but there are at least a couple things I don't understand.

    in this section of code,
    HTML Code:
        public class SetIndicatorValueFromAddonWindowExample : Indicator
        {
            #region Variables
            private    string                                        message;
            private System.Windows.Controls.Grid                myGrid;
            private System.Windows.Controls.Button                openWindowButton;
            
            private AddOns.SetIndicatorValueFromAddonWindowExampleToolsWindow    setIndicatorValueFromAddonWindowExampleToolsWindow;
            #endregion
    ​

    the AddOn uses the name of the indicator with "ToolsWindow" appended to the end of the indicator name. I tried to make a copy of the indicator, called Bob, I get an error that says I can't convert Bob to SetIndicatorValueFromAddonWindowExample. Which I think I understand. So I changed every occurrence of "SetIndicatorValueFromAddonWindowExample" with "Bob". That didn't work.

    So how do I add this code to my existing indicator, which isn't called "SetIndicatorValueFromAddonWindowExample".

    2nd thing I don't understand.
    there is this method that displays the info on screen
    HTML Code:
            public void ShowValues()
            {
                message = string.Format( "Instrument: {0} | Integer: {1} | String: {2}", ((InstrumentValue != null) ? InstrumentValue.FullName : "null"), IntValue, StringValue );
                Draw.TextFixed(this, "valuesBox", message, TextPosition.Center, ChartControl.Properties.ChartText, new SimpleFont("Arial", 20), Brushes.Black, ChartControl.Properties.ChartBackground, 100);
                ForceRefresh();
    ​
    But I don't see it being called.

    My plan is to use the code to update items in a list. I will select a drawing object on the screen. When I click the "Open Window" button I will loop thru the Drawing Objects collection to find the one that has state = editing. I will populate the fields from the drawing object attributes and change whatever ones need to be updated. Then save them back to the list that creates the drawing object.

    But I'm not sure where to do that since the ShowValues method doesn't appeared to be called anywhere, but is shows up and stays after you first click the button.

    As simple as the code looks, I can't get my head around those 2 concepts to be able to add them to my code. Any clarification is appreciated

    #2
    Hello cre8able,

    SetIndicatorValueFromAddonWindowExample is the name of the indicator class.

    SetIndicatorValueFromAddonWindowExampleToolsWindow is the name of the NTWindow class in the SetIndicatorValueFromAddonWindowExampleTools.cs file in the Addons folder.

    You can use any unused name for the indicator class, and any unused name for the NTWindow class, but these do need to be unique.
    From the indicator you will need to reference whatever name you give the NTWindow class in the Addon file.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      thanks ChelseaB. I haven't used Addons before so missed that

      How does the ShowValues method get called?

      I need to put my indicator code in the right spot to get the data I want

      Comment


        #4
        Hello cre8able,

        The ShowValues method in the indicator is called from the button click handler method in the addon NTWindow class on line 108.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        647 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X