Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reference multiple timeframes

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

    Reference multiple timeframes

    I would like to create a strategy that will, for instance, use an indicator on the current chart, say a 1hr chart, but then include, in the same strategy, a reference to an indicator on a 30 min chart. If both conditions are true I will do something.
    Can this be done. If so, can you give me a code snippet that accomplishes this?
    Regards,
    Duke

    #2
    Hello Duke,

    Thank you for your note.

    Yes this can be done through NinjaScript to make this a Multi-Instrument strategy.

    Please see the following Help Guide link for general information on Multi-Instrument/Time Frame scripts.



    To add a 30 minute Time Frame you will have the following code:

    protected override void Initialize()
    {
    // Add a 30 minute Bars object - BarsInProgress index = 1
    Add(PeriodType.Minute, 30);
    }

    You can then use this as part of a check in your strategy to check for true conditions.

    CameronNinjaTrader Customer Service

    Comment


      #3
      Thanks Cameron.. the ref really helped.. another thing

      Originally posted by NinjaTrader_Cameron View Post
      Hello Duke,

      Thank you for your note.

      Yes this can be done through NinjaScript to make this a Multi-Instrument strategy.

      Please see the following Help Guide link for general information on Multi-Instrument/Time Frame scripts.



      To add a 30 minute Time Frame you will have the following code:

      protected override void Initialize()
      {
      // Add a 30 minute Bars object - BarsInProgress index = 1
      Add(PeriodType.Minute, 30);
      }

      You can then use this as part of a check in your strategy to check for true conditions.

      http://www.ninjatrader.com/support/h....html?add3.htm
      If I have the following:
      Add(period.minute,3); --- 3 min chart
      How can I use a variable for the '3' so that I can change on input screen?
      Thanks,
      Duke

      Comment


        #4
        Hello Duke,

        You can use an int Variable to change the secondary data series on the Indicator input panel.

        Example:


        private int test = 3;


        protected override void Initialize()
        {
        Add(PeriodType.Minute, Test);
        }
        CameronNinjaTrader Customer Service

        Comment


          #5
          Thank you Cameron... I will give this a try.
          Duke

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          602 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          347 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          560 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          559 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X