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 ruudawakening, Today, 12:58 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by i019945nj, 12-14-2023, 06:41 AM
    4 responses
    64 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by thread, Yesterday, 11:58 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by stafe, Yesterday, 08:34 PM
    1 response
    16 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by jclose, Yesterday, 09:37 PM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X