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 jpapa, Today, 07:22 AM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by kevinenergy, 02-17-2023, 12:42 PM
    116 responses
    2,757 views
    1 like
    Last Post kevinenergy  
    Started by franatas, 12-04-2023, 03:43 AM
    7 responses
    106 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by Jltarrau, Today, 05:57 AM
    3 responses
    8 views
    0 likes
    Last Post Jltarrau  
    Started by f.saeidi, Today, 05:56 AM
    2 responses
    8 views
    0 likes
    Last Post NinjaTrader_Erick  
    Working...
    X