Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Best approach to use Multi-timeframe

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

    Best approach to use Multi-timeframe

    Hello,

    I'm just trying to figure out the best approach to build a simple system with a multi-timeframe. Ninjatrader doesn't plot the secondary timeframe / instrument in strategy analyzer, so it's really hard to know if my expectations for secondary timeframe / instruments were met or not - and it's also time consuming.

    I usually start with strategy builder, then unlock the code, then modify it.


    Here's is a simple example:

    Primary timeframe : RSI for if below 30 (500 ticks)
    Secondary timeframe: SMA 10 crossing above SMA 20 (1 day)

    Both conditions need to be met in order to enter long.



    What would be the best approach to set this example in strategy builder, to unlock the code to then change BarInProgress?

    #2
    Hello markkm,

    The Strategy Builder has only basic tools for adding a secondary series.

    Mostly you need to understand a few concepts. Adding a series increments BarsInProgress, and adds an index to all series like CurrentBars, Closes, Opens, etc.

    BarsInProgress represents which series is currently processing or the series you are trying access.

    Closes[BarsInProgress][0] will return the most recent bar for the currently processing bars in progress.

    Closes[0][0] will always return the most recent bar for the primary series.

    Below is a public link to the help guide on AddDataSeries, BarsInProgress, and Closes.
    https://ninjatrader.com/support/help...dataseries.htm
    https://ninjatrader.com/support/help...inprogress.htm
    https://ninjatrader.com/support/help...-us/closes.htm

    The Strategy Analyzer does show plots for secondary series. But plots are specific to indicators and not strategies supply this to the indicator, and the indicator be added to the chart with AddDataSeries(). Meaning an indicator would need to plot using a secondary series and the host script would also need to add this series. Below is a public link to an example that demonstrates.
    https://ninjatrader.com/support/help...ries_as_an.htm
    Last edited by NinjaTrader_ChelseaB; 08-05-2018, 03:23 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you, I was able to figure it out over the weekend.
      Now I have a question, it's a different thread but I hope you can help me;
      Optimization is taking forever, for 3 years of tick data, multiple time frames (I am using over 5 timeframes - I set an input for each data series, so it needs to construct bars based on that).
      I looked at my computer resources , and I have an i7 8CPU , 8GB of Ram, and it keeps crashing and using almost all my memory.
      Now I stared computing on AWS amazon so I have 36 CPUs and 36GB of RAM and it's still the same problem, not crashing though but slow.
      Is there anyway to speed up optimization computing, knowing that I have really good CPUs and RAM ?

      Comment


        #4
        Please disregard this. Turning of IsInstantiatedOnEachOptimizationIteration = false; --- helped.
        Thank you.

        Comment


          #5
          Hello markkm,

          Just a tip, if you are using IsInstantiatedOnEachOptimizationIteration as false to increase optimization performance, you also need to instantiate new objects after State.DataLoaded. This is shown in the example in the help guide.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            I looked at the example, and my understanding is that it only affects variables or objects that could vary, is that correct ?

            Comment


              #7
              Hello markkm,

              Anything that is being Initialized is going to be an object that is saved to a variable.

              It is recommended objects only be created when absolutely necessary and reset when possible. Creating new objects causes the memory to grow for each test. Re-using objects by resetting them in DataLoaded using the existing object saved to a variable would not grow in memory.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Ok, thanks, Another question, I downloaded tick data and I wanted to know if there is anyway to check the accuracy of this data ?

                Comment


                  #9
                  Hello markkm,

                  You can view downloaded data in the Historical Data window to compare this with something else.

                  Click Tools > Historical Data > click the plus "+" to expand Historical > expand the instrument > expand the market data type > expand the historical data type > select a date.


                  Below is a public link to the help guide on the Historical Data window.
                  https://ninjatrader.com/support/help...HistoricalData
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Thanks a lot for your help.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Oracletrades, Today, 09:10 PM
                    0 responses
                    3 views
                    0 likes
                    Last Post Oracletrades  
                    Started by SteveAU, Today, 08:35 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post SteveAU
                    by SteveAU
                     
                    Started by Lloyd143, Today, 05:24 PM
                    1 response
                    20 views
                    0 likes
                    Last Post NinjaTrader_ShawnB  
                    Started by Hagar, Today, 04:38 PM
                    1 response
                    16 views
                    0 likes
                    Last Post NinjaTrader_ShawnB  
                    Started by [email protected], Today, 04:49 PM
                    0 responses
                    12 views
                    0 likes
                    Last Post bpatel20@gmail.com  
                    Working...
                    X