Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi time frame scripts

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

    Multi time frame scripts

    Bit of a newbie question...

    I have a basic system with a moving average and an indicator. I'd like the MA to be on 5 minutes, and the indicator on 10 minutes.

    I tried the help menu, but it's still not clicking with me...

    #2
    crimsonite, you would need to look into adding another bars object in the Initialize() method of your strategy / indicator and then you could access it in the OnBarUpdate() section for calculations - the complete MultiSeries framework we offer in NinjaScript is detailed here in our helpguide -



    A fully working strategy example is installed per default with the "SampleMultiTimeFrame" strategy.

    Comment


      #3
      Got it!... I'll go give this a shot... will it be possible (I'm assuming) to do a multi time frame on different types, i.e. 500 bars and 5 minute?

      Comment


        #4
        Originally posted by crimsonite View Post
        Got it!... I'll go give this a shot... will it be possible (I'm assuming) to do a multi time frame on different types, i.e. 500 bars and 5 minute?
        Great - yes you can mix different types and different symbols with this framework.

        Comment


          #5
          Alright... I wrote some code for 3 minute and 500 volume charts... I was wondering if you could check it real quick to make sure I'm not screwing this up
          Attached Files

          Comment


            #6
            Looks good so far, but you would also need to take care to filter the BarsInProgress calls the OnBarUpdate() calcs should 'listen' to - http://www.ninjatrader.com/support/h...inprogress.htm

            Comment


              #7
              Originally posted by NinjaTrader_Bertrand View Post
              Looks good so far, but you would also need to take care to filter the BarsInProgress calls the OnBarUpdate() calcs should 'listen' to - http://www.ninjatrader.com/support/h...inprogress.htm
              Thanks... I think I might have a somewhat unique situation, I'm trying to get the "If" statement on one set of bars, and the "&& ATR" in it on another set... can I do this? It looks like the examples are for two sets of clauses... I'm looking for two time frames on the same security in the same if bar... no biggie if I can't do this

              Comment


                #8
                That should work crimsonite, please see this simple example attached working from the primary 1 min frame for example. It adds 5 minute bars and check for an MA condition on the two timeframes (1 min close being greater than both MA's).
                Attached Files

                Comment


                  #9
                  Originally posted by NinjaTrader_Bertrand View Post
                  That should work crimsonite, please see this simple example attached working from the primary 1 min frame for example. It adds 5 minute bars and check for an MA condition on the two timeframes (1 min close being greater than both MA's).
                  Nice! Thanks for the example!

                  Comment

                  Latest Posts

                  Collapse

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