Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Validate other temporalities

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

    Validate other temporalities

    I want to know how I can validate the volume on a 5 minute time frame if I am working on a 1597 tick time frame? Code. Thanks

    #2
    Hi carguzpa,

    You can use the AddDataSeries() function and the Volumes object to obtain the volume for a 5-minute time frame.

    Please refer to the code below:

    Code:
    protected override void OnStateChange(){
      if (State == State.Configure) {
        // Adds a 5-minute Bars object to the strategy and is automatically assigned
        // a Bars object index of 1 since the primary data the strategy is run against
        // set by the UI takes the index of 0.
        AddDataSeries("AAPL", BarsPeriodType.Minute, 5);
      }
    }
    
    protected override void OnBarUpdate() {
      // Compares the primary bar's volume to the 5-minute bar's volume
      if (Volumes[0][0] > Volumes[1][0]) {
          Print("The primary bar's volume is greater");
      }
    }
    For more information about the AddDataSeries() function and the Volumes objects, you can access the following links to learn more:


    Regards,
    William
    ninZa
    NinjaTrader Ecosystem Vendor - ninZa.co

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    646 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    367 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X