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

Indicator testing automation

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

    Indicator testing automation

    Hello,

    Before I turn indicator into strategy I always back test the idea. Let's say I want to go long when 34 EMA crosses above 55 EMA, and close the trade after it closes below. Then I want to do the same with 35 EMA over 56 EMA, and so on. EMA values are parameters of course. Is there any tool (3rd party totally fine) that can press F5 (refresh), recognize that the indicator finished running, and then click F5 again for the next batch. I can figure out on my own how to change the parameters, but the process of automatically keep triggering indicator, I am not sure how to do.

    Thanks,
    redduke

    #2
    Hello RedDuke,

    Thanks for your post.

    I'm not aware of any means to accomplish your goal using an indicator and refresh. We can leave this thread open for any contribution by other members.

    The iterative process you are describing is exactly what the strategy analyzer optimizer will do for you when you apply a strategy and have provided inputs that are user adjustable. In the optimizer, you can set the start, end and step values for the moving averages to test. https://ninjatrader.com/support/help...a_strategy.htm

    Your indicator idea of various period crossovers can be made into a very simple strategy using the strategy wizard.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hi Paul.

      Thanks for the answer. Does strategy analyzer runs of minute data or I need market replay data for it to work? I have recorded data for few years, where min data I have 10 years.

      Thanks,
      redduke

      Comment


        #4
        Hello RedDuke,

        Thanks for your reply.

        The strategy analyzer would not be able to use market replay data as that is a special format of historical data that includes all levels of data. The strategy analyzer would use the historical data as found under Tools>Historical data manager. This is the data that your charts would use when you connect to a live data feed and the historical data is used to backfill the chart's data series based on the number of days to load.

        Historical data is recorded in tick, minute or day bars, all other bar types are generated from this data.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by RedDuke View Post
          Does strategy analyzer runs of minute data or I need market replay data for it to work? I have recorded data for few years, where min data I have 10 years.
          SA uses Historical data only (which is stored differently than Market Replay data) -- it cannot use Market Replay data.

          Btw, since you're asking specifically about Minute data, you're in luck. You can download an unlimited number of years
          of Historical minute data using the Historical Data Manager (see Options -> Tools -> Historical Data Manager -> Download),
          but since it seems you already have Historical minute data from the last 10 years, so you're all set.

          Lastly, there is a sample strategy provided by NinjaTrader that exists in your bin/Custom/Strategy folder, it's called,

          @SampleMACrossOver.cs

          which uses the SMA but otherwise does exactly what you're asking.

          I've attached a modified copy of that file (changed all usages of SMA to EMA) for you to get started.
          Attached Files
          Last edited by bltdavid; 06-20-2019, 08:59 AM.

          Comment


            #6
            Originally posted by NinjaTrader_PaulH View Post
            Hello RedDuke,

            Thanks for your reply.

            The strategy analyzer would not be able to use market replay data as that is a special format of historical data that includes all levels of data. The strategy analyzer would use the historical data as found under Tools>Historical data manager. This is the data that your charts would use when you connect to a live data feed and the historical data is used to backfill the chart's data series based on the number of days to load.

            Historical data is recorded in tick, minute or day bars, all other bar types are generated from this data.
            Paul,

            Just to confirm, does strategy analyzer uses tick data? Let's say I want to back test 10 years back, but data vendor only has 3 years of historical tick data and 10 years of min data. My assumption is that strategy analyzer will only be able to back test 3 years.

            Thanks,
            redduke

            Comment


              #7
              Originally posted by bltdavid View Post

              SA uses Historical data only (which is stored differently than Market Replay data) -- it cannot use Market Replay data.

              Btw, since you're asking specifically about Minute data, you're in luck. You can download an unlimited number of years
              of Historical minute data using the Historical Data Manager (see Options -> Tools -> Historical Data Manager -> Download),
              but since it seems you already have Historical minute data from the last 10 years, so you're all set.

              Lastly, there is a sample strategy provided by NinjaTrader that exists in your bin/Custom/Strategy folder, it's called,

              @SampleMACrossOver.cs

              which uses the SMA but otherwise does exactly what you're asking.

              I've attached a modified copy of that file (changed all usages of SMA to EMA) for you to get started.

              Hi bltdavid,

              Thank you very much for above info.

              Regards,
              redduke

              Comment


                #8
                Hello RedDuke,

                Thanks for your reply.

                If your strategy uses minute based bars then it will draw from the historical minute bars. (Example, 3 minute, 60 minute, 240 minute, etc)

                If your strategy uses tick based bars then it will draw from your 3 year supply of tick data (Example: Tick bars, Volume bars, range bars, renko bars, seconds bars.

                The answer depends on the bar type used and if your strategy adds other type data series, for example, a strategy that is applied to 5-minute bars but adds a 1 tick data series would be limited to the 3 years of tick data.
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Paul,

                  Let me clarify my question. Let's say my strategy goes long when current bar breaks high of previous bar (on 1 hour chart), and never repeats the trade on the same bar. And it also sets profit target (20 ticks) and stop loss (below low of previous bar). Now let's assume during current hour market break high/low of previous bar multiple times, back and forth. 2 scenarios could unfold:

                  1) the market could have first hit my profit target, and close the trade in the green
                  2) the market could have first hit my stop loss and close the trade in red

                  How will strategy analyzer know the exact unfolding? My assumption is that for reliable back test and optimization tick data is required. Can you please clarify,

                  Thanks

                  Comment


                    #10
                    Hello RedDuke,

                    Thanks for your reply.

                    The strategy analyzer will take the conservative approach and fill the stop first.

                    Adding a faster time frame and submitting orders to the faster time frame would be the answer, considering that your chart is using 60-minute bars you could certainly test with adding a 1-minute series if you are trying to keep to your minute bars historical data. Otherwise, a single tick series will do the trick.

                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      Paul,

                      What do you mean by submitting orders on faster time frame? If my main chart is 60 min, how do I tell strategy analyzer to drop to 1 min ?

                      Thanks

                      Comment


                        #12
                        Hello RedDuke,

                        Thanks for your reply.

                        You would use the entry method overload that allows you to specify the bars to submit the order to.

                        I've linked an education example of this here: https://ninjatrader.com/support/help...ipt_strate.htm
                        Paul H.NinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by NinjaTrader_PaulH View Post
                          Hello RedDuke,

                          Thanks for your reply.

                          You would use the entry method overload that allows you to specify the bars to submit the order to.

                          I've linked an education example of this here: https://ninjatrader.com/support/help...ipt_strate.htm
                          Thanks a lot

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by ruudawakening, Today, 12:58 AM
                          1 response
                          8 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Started by i019945nj, 12-14-2023, 06:41 AM
                          4 responses
                          63 views
                          0 likes
                          Last Post NinjaTrader_BrandonH  
                          Started by thread, Yesterday, 11:58 PM
                          1 response
                          8 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Started by stafe, Yesterday, 08:34 PM
                          1 response
                          16 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Started by jclose, Yesterday, 09:37 PM
                          1 response
                          11 views
                          0 likes
                          Last Post NinjaTrader_Gaby  
                          Working...
                          X