• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

List Box on chart

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

    List Box on chart

    Looking for guidance on how to display a list box on a chart (like a button) ... the list will be populated by an enum list. It should function the same as a list box that would appear in the parameters section, but I need it to display in the header section of the chart itself.

    I realize this is more of a C# question than NT7, but would be grateful if someone can direct me to a resource which can explain how to do this. thanks

    #2
    Don't remember where I picked this up.

    Hope it helps.
    Attached Files

    Comment


      #3
      Thank you shuglu! Appreciate your response. One more question. I need to populate the ToolbarDropdown with the ATM strategy names. I already have a section of code that accesses the strategy names to populate a list in the parameters section (see code below in blue), but not sure how do I get these ATM strategy names in the ToolbarDropdown. Any insight will be greatly appreciated! tx

      #region StringConverter
      public class AtmConverter : StringConverter
      { public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true; }
      public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) { return false; }
      public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
      { string[] sarr = new string[0];
      foreach (StrategyData data in NinjaTrader.Db.Globals.Engine.GetObjectSet(typeof( StrategyData), "category = " + 2))
      { if (data.Strategy is AtmStrategy)
      { Array.Resize<string>(ref sarr, sarr.Length+1); sarr[sarr.Length-1] = data.Strategy.Name;
      } }
      foreach (StrategyData data in NinjaTrader.Db.Globals.Engine.GetObjectSet(typeof( StrategyData), "category = " + 1))
      { if (data.Strategy is AtmStrategy)
      { Array.Resize<string>(ref sarr, sarr.Length+1); sarr[sarr.Length-1] = data.Strategy.Name;
      } }
      return new StandardValuesCollection( sarr );
      }
      }
      #endregion

      Comment


        #4
        Hello pman777,

        This would be far outside of the realm of NinjaTrader Support, however, you have a for loop in your converter that is likely populating these values.
        Originally posted by pman777 View Post
        foreach (StrategyData data in NinjaTrader.Db.Globals.Engine.GetObjectSet(typeof( StrategyData), "category = " + 2))
        You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by refine, Today, 05:02 PM
        0 responses
        1 view
        0 likes
        Last Post refine
        by refine
         
        Started by White Fork, Today, 01:57 PM
        2 responses
        6 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by martyn73, Today, 02:45 PM
        2 responses
        8 views
        0 likes
        Last Post martyn73  
        Started by ct, Today, 12:48 PM
        4 responses
        22 views
        0 likes
        Last Post eDanny
        by eDanny
         
        Started by BrandonT1292, 07-30-2018, 07:32 PM
        11 responses
        400 views
        0 likes
        Last Post EllisEdi  
        Working...
        X