Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

User defined indicator as input for another indicators properties

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

    User defined indicator as input for another indicators properties

    Hello,

    I want my indicator to accept an externally calculated real-time value. This could (likely would) come from another indicator, probably calculated on it's on data / time series. it would NOT be the input to the indicator (ie. price series). I do not want to hard code this. I did some searching

    This user was requesting the same thing for nt7


    I did not come across a solution. I hope one exists for nt8?

    Thanks.

    #2
    Hello pjsmith,

    The concept explained in the linked post is an enum, this is something which is shown as a reference sample in the help guide: https://ninjatrader.com/support/help...ned_parame.htm

    The part of you description about the external value is not likely possible, if you are trying to get an indicator value it would need to be called using the indicators name from your syntax. What specifically were you looking to achieve for the input? If you can provide a specific example of what data you were trying to access that would help to understand if what you want to do is possible.


    I look forward to being of further assistance.

    Comment


      #3
      yes, the enum is not a route I wish to take (it does not work for me)

      Example

      I wish a trailing order (to be updated by my code), from a user defined input, say, SMA(60). Not quite what I am doing, but a simple example. The SMA could in fact be any valid indicator, though, specified by the user, so, like the OP requested, a way for the user to specify an indicator and input source, just like you would specify the input source on an indicator that can handle inputs like that.

      Comment


        #4
        Hello pjsmith,

        Thank you for the example.

        Lets put aside the user section for a moment to look at how the selection could be used in your logic. After the user selects an indicator, we will use the SMA, you would need to have a case in your logic which then creates an instance of the SMA and supplies the needed parameters to it (Period) and also reads the correct plot you want data from ([0], sma has one plot). :

        Code:
        case SMA: 
           SMA sma = SMA(inputPeriod);
           double value = sma[0];
        You would need one of these cases to configure supported indicators for each possible selection, there is not a "create indicator" function that would take the users input parameters into a NinjaScript indicator instance as you are asking.

        There is nothing I could really suggest for this level of dynamically adding data from a custom property, your script will in some way need to have defined what can be used so the user can toggle between those items and also so the script knows how to use the data from the selection.

        An indicator its self can take an input, so if you wanted to allow the user a generic selection I would likely suggest using the Input property and the default Input Series that your indicator has. When you configure the indicator in the UI it has "Input Series" which can be an indicator or price series. You can then use that input data in your script by referencing the Input[0] value similar to Close[0].



        I look forward to being of further assistance.

        Comment


          #5
          Thanks for confirming. Hard coding for specific indicators was what I wanted to avoid. For instance, the user might develop own indicator and just plug it in. I will take another (different route... Thanks, and have a great weekend.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          597 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          343 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          556 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          555 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X