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

Multi timeframe indicators

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

    Multi timeframe indicators

    My first post -- great product and a great forum.

    I'm testing some strats in Strategy Analyzer and liking these tools -- very nice. I am testing a daily/weekly strat. I would like to know if there is a way to get the value of the higher timeframe indicator as though it were calculated through the current bar of the lower time frame.

    For example, I'm handling a Thursday daily bar, but the Stoch weekly value is four days out of date. Might there be some way to get a value for the weekly Stoch as though its last data point were the current daily bar? (And all previous values were the normal weekly values).

    I realize that I could code this myself, but that can get to be a bit of work to do for many indicators. Stoch is not the only indicator I use.

    I realize that CalculateOnBarClose is always true for backtesting.

    Any ideas or suggestions would be appreciated.

    Lew

    #2
    Hello Palance,

    Welcome to the NinjaTrader forums!

    When using version 6.5, the secondary series should be smaller than the primary series.

    You would run the strategy against a weekly series and then add a daily series.

    You define the context you're working from with BarsInProgress.

    Example:

    if (BarsInProgress == 1) //Refers to OnBarUpdate calls to the daily series
    myDouble = Closes[0][0]; //Captures the value of the primary series into a variable.

    This reference sample helps demonstrate the sequence of OnBarUpdate() calls in a multi-series strategy.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ryan, thanks much for the welcome and for the quick reply.

      Interesting rule re making the highest time frame be the primary series -- I'll follow that. (And yes, I'm using 6.5).

      But my entry conditions are mostly on the lower time frame object. So it can easily occur that several lower time frame bars beyond the higher time frame point have elapsed and thus that the higher time frame indicator value is that much out of date, at least until a new higher time frame bar completes.

      So the weekly Stoch, for example, is completely current over the weekend, one day out of date after Monday, two days out of date after Tuesday, etc. And if my entry condition occurs on Thursday, I would like to have a "current" weekly Stoch that includes the current partial week.

      Just wondering if there's a way to get this without coding it myself.

      Lew

      Comment


        #4
        Lew, when running the strategy real-time, you can set CalculateOnBarClose = false and then whenever you retrieve the weekly value, it would be current up to the most recent tick. The reference sample Ryan posted also goes over how to backtest with an intrabar granularity, and you could tweak it to your liking.

        It would also be possible to construct a "fake" weekly series through DataSeries objects and then run whatever calculations you'd like on that series, although the specifics of such an implementation would be up to you.

        Here are the applicable links:
        Using a DataSeries object to store calculations
        Synchronizing a DataSeries object to a secondary time frame
        AustinNinjaTrader Customer Service

        Comment


          #5
          OK. Thank you both very much. The Data Series objects may be a good way to go, at least for backtesting. I appreciate the help.

          Lew

          Comment


            #6
            Originally posted by Palance View Post
            My first post -- great product and a great forum.

            I'm testing some strats in Strategy Analyzer and liking these tools -- very nice. I am testing a daily/weekly strat. I would like to know if there is a way to get the value of the higher timeframe indicator as though it were calculated through the current bar of the lower time frame.

            For example, I'm handling a Thursday daily bar, but the Stoch weekly value is four days out of date. Might there be some way to get a value for the weekly Stoch as though its last data point were the current daily bar? (And all previous values were the normal weekly values).

            I realize that I could code this myself, but that can get to be a bit of work to do for many indicators. Stoch is not the only indicator I use.

            I realize that CalculateOnBarClose is always true for backtesting.

            Any ideas or suggestions would be appreciated.

            Lew
            would you bguys be able to show me how and where to get ichimoku cloud on ninja trader?

            Comment


              #7
              Hello ibos0986,

              Thank you for your post.

              You can find the NinjaTrader 8 version at the following link: http://www.ninjatrader.com/support/f...d=7&linkid=947
              You can find the NinjaTrader 7 version at the following link: http://www.ninjatrader.com/support/f...d=4&linkid=553

              Please let me know if you have any questions.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by algospoke, Today, 06:40 PM
              0 responses
              10 views
              0 likes
              Last Post algospoke  
              Started by maybeimnotrader, Today, 05:46 PM
              0 responses
              7 views
              0 likes
              Last Post maybeimnotrader  
              Started by quantismo, Today, 05:13 PM
              0 responses
              7 views
              0 likes
              Last Post quantismo  
              Started by AttiM, 02-14-2024, 05:20 PM
              8 responses
              168 views
              0 likes
              Last Post jeronymite  
              Started by cre8able, Today, 04:22 PM
              0 responses
              10 views
              0 likes
              Last Post cre8able  
              Working...
              X