Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

trouble with input conversion

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

    trouble with input conversion

    I am having a bit of trouble figuring out what I am doing wrong with an input conversion. Basically, I am using a string collection and type conversion to create a list of options the user can select. In Ninja 7 it works exactly as expected.

    This is the code I am using in Ninja 7
    Code:
    internal class CLM : StringConverter
                {
                    public override bool GetStandardValuesSupported(ITypeDescriptorContext itdc) {return true;}
                    public override bool GetStandardValuesExclusive(ITypeDescriptorContext itdc) {return true;}
                    public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext itdc)
                    {
                        return(new StandardValuesCollection(new String[] {"XC", "XA"}));
                    }
                }
    
    private int clm = -1;
                    private string cyphIGL = "XC";
                    [Description("")]
                    [GridCategory("10 - Manual Drawing Parameters")]
                    [Gui.Design.DisplayName ("2-2: Inverted Graystone Leg")]
                    [TypeConverter(typeof(CLM))]
                    public string Clm
                    {
                        get { return cyphIGL; }
                        set { cyphIGL = value; }
                    }
    I have tried something similar in Ninja 8, but I keep getting this error message
    Value of property 'cslt' of NinjaScript 'TE_ConstellationPro_v111_N8' is Fixed_Pip and not in valid range between 0 and 1.7976931348623157E+308.
    Here is the code from ninja 8 that isn't identical
    Code:
    [NinjaScriptProperty]
                    [Display(Name="Drawn Cypher: Stoploss Type", Description="Manual Drawn Cypher: Stoploss Type", Order=13, GroupName="10) Manual Drawing Inputs")]
                    [TypeConverter(typeof(SLT))]
                    public string cslt
                    { get; set; }
    Anyone have any idea why I keep getting this error message and how to fix it... without being forced to declare public enums? I tried using public enums, but then every time I started working on a new version, I had to remove the old version to get rid of the conflict.

    #2
    Hello Antny, and thank you for your question. Could you send us a picture of the GUI settings you are passing to this NinjaScript file?

    To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.
    Click here for instructions
    Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
    Click here for detailed instruction
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      I just wanted to follow up on this post...apparently, I have a typo somewhere. I just slapped together a couple of rudimentary example indicators to provide relevant code examples, but there is no error in Ninja 8. Thus, I must have a typo in my indicator. lol

      Regardless, I am going to post the code examples just in case someone else needs something similar to this type of input, but cannot use an enum for whatever reason.
      Attached Files

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      52 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      71 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      38 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      99 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      60 views
      0 likes
      Last Post PaulMohn  
      Working...
      X