Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

2nd indicator input series via property dialog

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

    2nd indicator input series via property dialog

    Hello,
    I want to add a 2nd input series to a generic indicator which calculates the difference between two input series generically.
    If adding in the indicator code via:

    /// <summary>
    /// 2nd input series.
    /// </summary>
    [NinjaScriptProperty]
    [Display(Name = "Input series 2", Description = "", GroupName = "Data Series", Order = 0)]
    public ISeries<double> Input2 { get; set; }

    ... within the property dialog I cannot select input series (drop down box is empty), like it is provided for the default input series (drop down box let me select input series/indicator).
    How can I realize this in the indicator code?

    Thanks
    Frank

    #2
    Hello,

    Thank you for the question.

    Currently there is no specific documented way to do this, but you could re create an input picker using the following syntax. please note that this does not nessasarily apply the series in the same way as the original input picker does so there are unknown consenquences by using the following syntax as it is not documented. You would need to test and see if this can or will work for what you want to do.

    Code:
    [Display(Name = "MyInput", Prompt = "Pick MA Series!", Order = 99)]
    [PropertyEditor("NinjaTrader.Gui.Tools.InputEditor")]
    [XmlIgnore]
    public ISeries<double> MyInput { get; set; }
    I can then use the following syntax to access values, again please keep in mind this is not documented or expected to work correctly. I am unsure of any sync issues that could arise from the use of this code.

    Code:
    protected override void OnBarUpdate()
    {
         Print(Close.GetValueAt(Count - CurrentBar) + " " + MyInput.GetValueAt(Count - CurrentBar));
    }
    The supported and documented way to do this would be to instead not use a input picker and hard code the series by adding that series: http://ninjatrader.com/support/helpG...=adddataseries or by calling an indicator by name to retrieve its series.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks Jesse. The "PropertyEditor" fixed the input problem.
      But, MyInput is not getting updated, means in OnBarUpdate the call "var x = MyInput[0];" always returns the same value. Is there anything I can do to trigger the update of the series?
      Thanks Frank

      Comment


        #4
        Hello,

        Thank you for the reply.

        Unfortunately this is what I had provided a warning for:
        please keep in mind this is not documented or expected to work correctly. I am unsure of any sync issues that could arise from the use of this code.
        The Input selector could really only be used as a type of switch, but would not necessarily work the same way as the original.. While this technically brings up the same window/menu and allows you to Pick things, the same core logic is not being executed because it is not the original property.

        What is the end result you are looking for? I understand this is to allow the indicator to compare two series, but potentially this is not the correct approach.

        Is it necessary for the user to select ANY series/indicator or is the intended use limited to a smaller set of series like only the Open, High, Low, Close?

        The reason I ask is that generally if a second Input is to be selected a enum can be used to create a custom list of selectable series. A user could then pick from this list and that Property would delegate the scripts logic on how it handles the extra series. In this case no series is provided to the indicator, instead it would add its own series and then use the data according to what the user selected.

        If you can provide more details, potentially we are not going the right direction in the first place and could reach a better conclusion.


        Please let me know if I may be of additional assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Originally posted by TraderFrank View Post
          Hello,
          I want to add a 2nd input series to a generic indicator which calculates the difference between two input series generically.
          If adding in the indicator code via:

          /// <summary>
          /// 2nd input series.
          /// </summary>
          [NinjaScriptProperty]
          [Display(Name = "Input series 2", Description = "", GroupName = "Data Series", Order = 0)]
          public ISeries<double> Input2 { get; set; }

          ... within the property dialog I cannot select input series (drop down box is empty), like it is provided for the default input series (drop down box let me select input series/indicator).
          How can I realize this in the indicator code?

          Thanks
          Frank
          If you are seeking to specify an input price type, you should use the built-in PriceType enumeration.

          Unfortunately it is not directly documented, albeit you can find it by a search, as it is documented only as the input to a drawing.

          Here is an example, albeit in NT7. It should be hardly any different in NT8. (See how I specify an ability for the user to select an input price type for the moving averages).

          ref: http://ninjatrader.com/support/forum...74&postcount=1

          NTSupport: Can we have it properly documented, and how to use it? Thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Irukandji, Today, 04:58 AM
          0 responses
          0 views
          0 likes
          Last Post Irukandji  
          Started by fitspressoburnfat, Today, 04:25 AM
          0 responses
          2 views
          0 likes
          Last Post fitspressoburnfat  
          Started by Skifree, Today, 03:41 AM
          1 response
          4 views
          0 likes
          Last Post Skifree
          by Skifree
           
          Started by usazencort, Today, 01:16 AM
          0 responses
          1 view
          0 likes
          Last Post usazencort  
          Started by kaywai, 09-01-2023, 08:44 PM
          5 responses
          604 views
          0 likes
          Last Post NinjaTrader_Jason  
          Working...
          X