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

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.




    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.
    Last edited by NinjaTrader_ChelseaB; 08-05-2018, 04: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.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Thanks a lot for your help.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Johnny Santiago, 10-11-2019, 09:21 AM
                    95 responses
                    6,193 views
                    0 likes
                    Last Post xiinteractive  
                    Started by xiinteractive, 04-09-2024, 08:08 AM
                    2 responses
                    11 views
                    0 likes
                    Last Post xiinteractive  
                    Started by Irukandji, Today, 09:34 AM
                    1 response
                    3 views
                    0 likes
                    Last Post NinjaTrader_Clayton  
                    Started by RubenCazorla, Today, 09:07 AM
                    1 response
                    5 views
                    0 likes
                    Last Post RubenCazorla  
                    Started by TraderBCL, Today, 04:38 AM
                    3 responses
                    25 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Working...
                    X