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

Backtesting help needed

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

    Backtesting help needed

    What are my options for backtesting a strategy using Heiken Ashi charts so that the orders execute with the actual close price, not the Heiken Ashi close price which is just for visualization purposes? I want to use a tick chart with Heiken Ashi candles but want to execute on the true candle, using the closing tick as the limit order on the next/current bar.

    #2
    Hello awimm413,

    Thanks for your post.

    An option would be to use the Heiken-Ashi8 indicator available in the NT user apps section of the Ninjatrader ecosystem (link below).

    In the strategy analyzer, you would create standard tick bars. In your strategy, you would add then indicator (AddChartIndicator()) for the display purposes, and you would access the indicators plots of HAHigh, HALow, HAClose and HAOpen data series for your logic decisions. The entries and exits would then be placed on the real tick bars.


    This indicator is publicly available on our NinjaTrader Ecosystem website:
    Here is a basic guideline of how to Import NinjaScripts.

    To import NinjaScripts you will need the original .zip file.

    To Import
    1. Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
    2. From the Control Center window select the menu Tools>Import>Ninjascript add-on..
    3. Select the downloaded .zip file
    4. NinjaTrader will then confirm if the import has been successful.

    Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

    Once installed, you may add the indicator to a chart by:
    • Right click your chart > indicators > Select the Indicator from the list on the left > New > OK

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.


    Paul H.NinjaTrader Customer Service

    Comment


      #3
      I was abe to install the indicator. However, it doesn't seem to work in the strategy builder. When I run the analyzer, no trades are produced. I want to set up a basic EMA cross based on the Heikin Ashi values but need the orders to trigger based on the actual value. I am using a tick chart. I would like to enter the trade on the open of the following bar after the cross occurs on close of the previous bar. I'm fine using a market order, but would prefer an limit based on the close of the prior bar where the cross occured.

      Comment


        #4
        Hello awimm413,

        Thanks for your reply.

        To assist I have created a short specific video to cover the steps needed to use the Heiken-ashi8 indicator as an input to the EMAs. so that they are drawn based on the Heiken-ashi close prices. Any orders that you place can only be filled by the underlying price data which were 1000 tick bars in the example video: https://paul-ninjatrader.tinytake.co...MF8xMzc5NjMwMg
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          thank you for the video. i believe that confirms i am doing things correct. however, still no trades in strategy analyzer. is there a way we can do a screen share so you can see what i am doing?

          Comment


            #6
            also, could you send the link to the most appropriate Heikin Ashi indicator. It looks like I may have been using a different one than you have. While I believe I referenced the correct things in the setup, the EMAs aren't even showing on my chart. Thanks!

            Comment


              #7
              Hello awimm413,

              Thanks for your reply.

              Please check the "Log" tab of the control center for any error messages related to the strategy when you run the strategy.

              The link I provided in post 2 is what I was using and referencing in the video.

              If no errors in the log, then next test using the sampleMACrossover using the same Tick data over the same period. This strategy is always in so you should expect to see many trades. This is good to check that you have the data over the entire period. Make sure you look at the trade dates to ensure you see trades over the entire duration to verify again that you have all of the data. If you are not seeing trades then short your analysis period to say the last two weeks.

              If you have all of the data then I would suggest adding a print statement and print out what values you are actually using through the strategy builder. Typically you would want to look at the values of variables being used for the entry conditions. Here is a short video on building the Print statement (a good debugging technique): https://paul-ninjatrader.tinytake.co...NV8xMDk5MDc5Nw

              Another alternative would be to duplicate what I am showing in the video in post #4 and add an entry along with a profit and stop. I've attached an example of that applied in the strategy analyzer.

              Click image for larger version

Name:	awimm413-1.PNG
Views:	482
Size:	118.5 KB
ID:	1104631
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                nevermind, think i found the right one. seems to be working now. thank you so much for your help!

                Comment


                  #9
                  what is the best setup for backtesting a futures contract? should i look at a continuous contract or just the front month? also, right now i enter/exit on the bar following a moving average crossover with a market order. waht settings to i need to make this as realistic as possible? Thanks!

                  Comment


                    #10
                    Hello awimm413,

                    Thanks for your reply.

                    In NinjaTrader you can specify the current contract and set the start date as far back you have data for. NinjaTrader will pull the data for the relevant prior contracts based on the contract rollover dates in its database.

                    A good practice is to use PlayBack with Market replay data as a good check of the Strategy before going live and you can certainly check your results to the strategy analyzer. Playback will be significantly slower because it uses so much data and builds bars on a tick by tick basis. A good use would be to check 5 days in the strategy analyzer and then check the same 5 days in Playback. You can compare the trades performance of both to see what the differences are between entry/exit times and prices, if any.
                    Reference: https://ninjatrader.com/support/help...connection.htm

                    Here is a link to differences you can expect: https://ninjatrader.com/support/help...ime_vs_bac.htm
                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_PaulH View Post
                      Hello awimm413,

                      Thanks for your reply.

                      To assist I have created a short specific video to cover the steps needed to use the Heiken-ashi8 indicator as an input to the EMAs. so that they are drawn based on the Heiken-ashi close prices. Any orders that you place can only be filled by the underlying price data which were 1000 tick bars in the example video: https://paul-ninjatrader.tinytake.co...MF8xMzc5NjMwMg
                      This video cant be accessed, can you remake it ?

                      Comment


                        #12
                        Hello Teebone21,

                        Thanks for your post.

                        The video link works here.

                        Perhaps can you try in another browser?
                        Paul H.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by CortexZenUSA, Today, 12:53 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post CortexZenUSA  
                        Started by CortexZenUSA, Today, 12:46 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post CortexZenUSA  
                        Started by usazencortex, Today, 12:43 AM
                        0 responses
                        5 views
                        0 likes
                        Last Post usazencortex  
                        Started by sidlercom80, 10-28-2023, 08:49 AM
                        168 responses
                        2,266 views
                        0 likes
                        Last Post sidlercom80  
                        Started by Barry Milan, Yesterday, 10:35 PM
                        3 responses
                        13 views
                        0 likes
                        Last Post NinjaTrader_Manfred  
                        Working...
                        X