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 Barry Milan, Yesterday, 10:35 PM
    5 responses
    16 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by DanielSanMartin, Yesterday, 02:37 PM
    2 responses
    13 views
    0 likes
    Last Post DanielSanMartin  
    Started by DJ888, 04-16-2024, 06:09 PM
    4 responses
    13 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by terofs, Today, 04:18 PM
    0 responses
    12 views
    0 likes
    Last Post terofs
    by terofs
     
    Started by nandhumca, Today, 03:41 PM
    0 responses
    8 views
    0 likes
    Last Post nandhumca  
    Working...
    X