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

Loading indicator with different series

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

    Loading indicator with different series

    Hi guys

    I wanted to ask if there is a way to load an indicator value from another indicator but actually divert the primary series so that it loads for a different time frame. So for example my current indicator is applied to a 3 minute chart, within that indicator it loads another one and extracts a value with the following

    protected override void OnStartUp()
    {
    USS = VolatilitySwing(Input, dtbStrength, endOffset, multiplier, period).UpSwingSignals;
    DSS = VolatilitySwing(Input, dtbStrength, endOffset, multiplier, period).DnSwingSignals;
    DW = DailyWindow(Input, 3).Signal;
    }

    Are there other values that I can pass to Input instead of the default, what I gather is that Input will pass through the same data series being used as the primary in the passing indicator which in this case is the 3minute, I would however like the DailyWindow indicator to be run off the daily series. How best do I accomplish this?

    At the moment the only way I can figure it but it seems inefficient since I'm loading an extra series is to put this code into daily window indicator:

    In initialize

    Add(PeriodType.Day,1);

    In Onbarupdate

    if (BarsInProgress == 0) return;

    I think this should have the effect of overriding the primary passed series but it means this indicator can only ever run as daily for one and secondly it will be loading a second series and then ignoring one which seems inefficient.

    I'm thinking there must be a better way that I'm not aware of?

    cheers for any help
    Ross

    #2
    Think I might of figured it, this is just a thought, loading a secondary series in the calling indicator and then passing the secondary series when calling the other indicator using the secondary timeframe like below?

    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    Overlay = true;
    PriceTypeSupported = true;

    Add(PeriodType.Day, 1);
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)

    /// </summary>
    protected override void OnStartUp()
    {
    DW = DailyWindow(BarsArray[1], 3).Signal;
    }

    Will above work?

    My other question is how many bars lookback are loaded in the the Day series that I've added since it's not configurable in the Add(), will it default to whatever the primary series is?

    Cheers
    Ross

    Comment


      #3
      Hi Ross, correct that should do it, just point to the BarsArray you want to calculate on since each indicator would implement the IDataSeries interface...the loaded days will mirror the setting you choose for the primary series / chart this is working on. Just keep in mind if you do it from within a strategy that there need to be enough bars present for all series called to satisfy the MinBarsRequired setting.
      BertrandNinjaTrader Customer Service

      Comment


        #4
        Thanks Bertrand, much appreciated.

        Comment


          #5
          Hi Bertrand,

          Above works a charm, one more related question I wanted to ask, is there anyway to load an indicator like I have done in the example and designate a different session template as opposed the the template designated in the calling chart or MA panel?

          Thanks again
          Ross

          Comment


            #6
            Hi Ross, great to hear - no unfortunately not, the session template will be the one your primary series uses.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by adeelshahzad, Today, 03:54 AM
            5 responses
            32 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by stafe, 04-15-2024, 08:34 PM
            7 responses
            32 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by merzo, 06-25-2023, 02:19 AM
            10 responses
            823 views
            1 like
            Last Post NinjaTrader_ChristopherJ  
            Started by frankthearm, Today, 09:08 AM
            5 responses
            20 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            43 views
            0 likes
            Last Post jeronymite  
            Working...
            X