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

override-n inputs are not seen

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

    override-n inputs are not seen

    if we use the standard way:
    Code:
    class Indi_A : Indicator
    
    [Display(Name = "name")]
    [NinjaScriptProperty]
    public string myName  {  get; set;  }
    then everything is ok, and we can call indi from other indis, like:

    myIndi( string Name)

    however, when i add`override`


    Code:
    class Indi_A : Indi_B 
    .......
    
    
    class Indi_B : Indicator
    
    [Display(Name = "name")]
    [NinjaScriptProperty]
    public string myName  {  get; set;  }

    when I add want to call `indi_A(....)` from other indicator, it doesnt have an overload with string myName, like `indi_A(string myName)`.

    In base class I have several MUST-HAVE inputs (that i use in all indicators), and wanted that my indicators inherited those inputs automatically, in addition that they could be programatically called (but this last one is problem).
    Last edited by ttodua; 04-06-2018, 08:13 AM.

    #2
    Hello TazoTodua,

    Thanks for the post.

    If you are trying to override the property from a different indicator, the indicator (Indicator B) can use the variable from the other indicator's property (Indicator A) because they share the same namespace. Indicator B does not inherit from Indicator A so it does not know what to override.

    I found this StackOverflow post on this subject. It should help with completing this:
    I have an abstract base class and I want to declare a field or a property that will have a different value in each class that inherits from this parent class. I want to define it in the baseclass...


    The polymorphic way of doing this would require your base class to be abstract, but we are unable to change the implementation of the class given to us when we generate a new NinjaScript Indicator or Strategy.

    Please let us know if we may be of any further assistance.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      I have updated original question to be more clear.

      Comment


        #4
        Hello TazoTodua,

        Thanks for the reply.

        This could be possible but the NinjaScript compiler will not generate properties from the base class. The properties must be available in the same indicator class to display in the property grid. The supported way of doing this would be to save your properties to a document and copy/paste the properties if you need to use these properties in multiple scripts.

        Please let me know if I may be of any further assistance.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChrisL View Post
          Hello...
          but what you say is indication that NT compiler has a bug and we had to make a burden of manual copy-paste to solve that..

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by FrancisMorro, Today, 03:24 AM
          0 responses
          1 view
          0 likes
          Last Post FrancisMorro  
          Started by Segwin, 05-07-2018, 02:15 PM
          10 responses
          1,770 views
          0 likes
          Last Post Leafcutter  
          Started by Rapine Heihei, 04-23-2024, 07:51 PM
          2 responses
          31 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by Shansen, 08-30-2019, 10:18 PM
          24 responses
          944 views
          0 likes
          Last Post spwizard  
          Started by Max238, Today, 01:28 AM
          0 responses
          11 views
          0 likes
          Last Post Max238
          by Max238
           
          Working...
          X