Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

referenced Indicator and fresh values

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

    referenced Indicator and fresh values

    hi, lets say I use:

    if( State== State.DataLoaded){

    kn = Keltner(12);
    }


    OnBarUpdate(){
    kn.Update();
    if (kn.Upper... > ...)

    }


    should we call "Update()" on included indicator instances, to get the fresh values at first?
    ( because, as i see many NT indicators, doesnt expose dataseries with "Update()", like this:


    public Series<double> Upper
    {
    //Update(); //< -- - this is missing from NT built-in indicators, that's why i thought we should call it manually in our indis while calling NT indis
    get upper;
    }

    #2
    Hello TazoTodua,

    Thanks for opening the thread.

    When creating a Series<T> we sync it to the the underlying data series that the indicator is running off of with new Series<T>(this); Since the data series that the indicator runs on must be supplied by the hosting NinjaScript, these types should be current.

    When using public variables of different types, these are not synchronized to the data series, so they may not be current. This is when calling Update() would be advised.

    This is noted in the NT7 DataSeries documentation page, and I've requested to have this noted in the NT8 Series<T> documentation page.

    NT7 DataSeries - https://ninjatrader.com/support/help...ries_class.htm

    NT8 Series<T> - https://ninjatrader.com/support/help...s/?seriest.htm

    Please let us know if you have any additional questions.

    Comment


      #3
      thanks!
      so, can you tell me the example i.e. for ketlen channel (or any indi),
      How should I call those (Series<> public exposed variables of KeltnerChannels, like "Upper" series)

      we should add the instance in DataLoaded state or Configure? and when to Update() ?

      are there examples for Series and for different types (not **this** synced).

      Comment


        #4
        Hello TazoTodua,

        If you are calling the indicator, you can use the following syntax:

        KeltnerChannel(Close, 1.5, 10).Upper[0]

        If you are adding an instance of an indicator to the NinjaScript, you can use the syntax below:

        MyKeltnerChannel.Upper[0]

        As a tip, the Strategy Builder can be used to create condition that checks this plot, and then clicking View Code will show the generated syntax. You can use this to see how the Strategy Builder creates instances of indicators as well.

        Since the indicator uses a data series from the hosting NinjaScript, it will be synchronized and you would not need to call Update() in the getter of the child indicator for that plot's Series.

        As for additional examples with different types, I have one other example I could share that demonstrates this process with a dictionary. This is the only other example that I have prepared to share. The same concept can be applied to other types.

        That thread/example can be found here: https://ninjatrader.com/support/foru...d.php?t=108778
        Last edited by NinjaTrader_Jim; 04-12-2018, 03:53 PM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        647 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        368 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        571 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X