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

access custom dataseries

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

    access custom dataseries

    i have a multitimeframe indicator.
    i created a custom dataseries
    how can i access barsarray created in different timeframe in lower timeframe?
    in the below example, i have a bars array ConseqLow = new Series<int>(BarsArray[1], createed in 25 min timeframe
    i would like to access the data in my basetimeframe which is 5 minutes.
    Code:
    public class PullbackBounce : Indicator
        {
     private Series<int> LongDirection, ShortDirection,ConseqLow,ConSeqHigh; // Define 
    
    protected override void OnStateChange()
            {
     if (State == State.Configure)
                    {
                        Print(BarsPeriod.ToString());
    
                        //                    if (BarsPeriod.BarsPeriodType == BarsPeriodType.Minute)
                        //                    {
                        AddDataSeries(BarsPeriodType.Minute, 25);
                        AddDataSeries(BarsPeriodType.Tick, 1);
                        
    }
    if (State == State.DataLoaded)
                    {
                        LongDirection = new Series<int>(this, MaximumBarsLookBack.Infinite);
                        ShortDirection = new Series<int>(this, MaximumBarsLookBack.Infinite)
                        ConseqLow = new Series<int>(BarsArray[1], MaximumBarsLookBack.Infinite);
                        ConseqHigh = new Series<int>(BarsArray[1], MaximumBarsLookBack.Infinite);
    
                    }
    }
    
      protected override void OnBarUpdate()
            {
     if (BarsInProgress == 0) // this is the different timeframe. how can i acces teh ConseqLow bars array?
    }
    }
    
    }

    #2
    Hello junkone,

    In OnBarUpdate, when BarsInProgress is 1, then the 25 minute series is the series processing.

    However, I am not showing there is a 5 minute series added to the script.

    If the primary series is the 5 minute series, then you would want to call the custom series when BarsInProgress is 0.

    I may not be understanding your inquiry correctly.
    Please let me know if you are not asking about which added series is the processing series.

    You can access any series at any time as long as it has bars.

    For example:
    if (BarsInProgress == 0 && CurrentBars[1] > 0)
    {
    Print(ConseqLow[0]);
    }
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by maybeimnotrader, Yesterday, 05:46 PM
    3 responses
    23 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    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
    23 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Working...
    X