• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.

    http://www.ninjatrader.com/support/h...nstruments.htm

    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
    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.

      http://www.ninjatrader.com/support/h...nstruments.htm

      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 guidoisot, Today, 03:01 AM
          0 responses
          2 views
          0 likes
          Last Post guidoisot  
          Started by rontronimous, Yesterday, 05:55 PM
          0 responses
          9 views
          0 likes
          Last Post rontronimous  
          Started by bcgeek, Yesterday, 03:43 PM
          2 responses
          8 views
          0 likes
          Last Post bcgeek
          by bcgeek
           
          Started by Mberg, Yesterday, 04:05 PM
          1 response
          16 views
          0 likes
          Last Post NinjaTrader_ChrisSch  
          Started by dkbyond, Yesterday, 03:52 PM
          0 responses
          5 views
          0 likes
          Last Post dkbyond
          by dkbyond
           
          Working...
          X