Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unable to run backtest...

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

    Unable to run backtest...

    I am new to Ninjar Trader, so this question maybe dump...but I searched the help guides still not able to solve my problem...

    I imported a historical daily file of HSI thru historical data function (Please refer to the attached HSI_Ninja3.txt, only part of the data), the instrument I wanna back test is a MHI 06-09, I did rename the file to MHI 06-09.csv b4 import. And the import is successfully (from the log).

    And then I ran a back test with the attached ninja script. However no trades were generated, and no activities was happened thru the back test.

    I wonder what I did wrongly? Thanks for answering my question...
    Attached Files

    #2
    Jeffrey,

    You cannot import a .csv file. The file needs to be a .txt file and the contents need to be in the format outlined here: http://www.ninjatrader-support.com/H...V6/Import.html

    Please try reimporting a .txt file and then running your backtest again. Thank you.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      Jeffrey,

      You cannot import a .csv file. The file needs to be a .txt file and the contents need to be in the format outlined here: http://www.ninjatrader-support.com/H...V6/Import.html

      Please try reimporting a .txt file and then running your backtest again. Thank you.
      I tried, but the same result....actually I've tried to export the historical data to ensure the import was successfully....any further hints? Your help is appreciated.

      Comment


        #4
        To check if you have imported data properly please try opening a chart. If the chart loads then you have data and you can proceed with backtesting. To test backtesting please use SampleMACrossOver. When all of that is working properly then you can proceed with testing your script.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          To check if you have imported data properly please try opening a chart. If the chart loads then you have data and you can proceed with backtesting. To test backtesting please use SampleMACrossOver. When all of that is working properly then you can proceed with testing your script.
          Yes, you are right, my chart is empty....so do you find any problem of my attached import data file? The control center said it is successful so I dun know what to do next.......

          Comment


            #6
            Hi Jeffrey,

            I was able to get a daily chart using your .txt file, here is what I did:

            Save your file as HSI 06-09.
            Import this file in NinjaTrader.
            Open HSI 06-09 daily chart.

            Please let me know if you can do the same.
            Ray S.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_RJStein View Post
              Hi Jeffrey,

              I was able to get a daily chart using your .txt file, here is what I did:

              Save your file as HSI 06-09.
              Import this file in NinjaTrader.
              Open HSI 06-09 daily chart.

              Please let me know if you can do the same.
              Oh yes, I can do that now..I mislead the term chart, I was doing it with the Strategy Analyzer.....Now is ok with another chart function.

              But when I run the backtest again on HSI 06-09 with SampleMACrossOver, still no trade activities comes out...

              Comment


                #8
                Originally posted by Jeffrey.Ng View Post
                Oh yes, I can do that now..I mislead the term chart, I was doing it with the Strategy Analyzer.....Now is ok with another chart function.

                But when I run the backtest again on HSI 06-09 with SampleMACrossOver, still no trade activities comes out...
                Did you run the backtest on a DAILY chart?

                Do you see the two MA's cross over in the chart when the strategy is complete?
                Ray S.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_RJStein View Post
                  Did you run the backtest on a DAILY chart?

                  Do you see the two MA's cross over in the chart when the strategy is complete?
                  Yes...I missed the DAILY chart...Thanks for your swift response, it works now!

                  btw, several follow up question...

                  1. In the instrument manager, the margin value of MHI is a money value rather than a percentage. As far as I know, margin shall calculate in %...any way to input a percentage value?

                  2. All the volumes of my data file are zero bcoz the ninja trader will throw exception and quit if I put the original value on it.

                  Actually the volume is 2331661200 instead of zero for this record, is it too large for ninja trader?

                  20090427;15160.69;15160.69;14798.9;14840.42;233166 1200

                  Thanks again...

                  Comment


                    #10
                    1.) I beleive this represents a %, try inputting the % margin you want to use.

                    2.) Are you sure you have the correct volume value?


                    "2331661200" is over 2 BILLION in 1 day??

                    I tested by inputting 1 million, 1000000 and it worked fine.

                    Please double check your DAILY volume value.
                    Ray S.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_RJStein View Post
                      1.) I beleive this represents a %, try inputting the % margin you want to use.

                      2.) Are you sure you have the correct volume value?


                      "2331661200" is over 2 BILLION in 1 day??

                      I tested by inputting 1 million, 1000000 and it worked fine.

                      Please double check your DAILY volume value.
                      I missed one point, the volume means nominal volume of money or no. of executed contracts / shares?

                      Comment


                        #12
                        Originally posted by Jeffrey.Ng View Post
                        I missed one point, the volume means nominal volume of money or no. of executed contracts / shares?
                        You will have to change this to number of trades/ticks, not money/share volume as that is not supported.
                        Ray S.NinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by NinjaTrader_RJStein View Post
                          You will have to change this to number of trades/ticks, not money/share volume as that is not supported.
                          Thanks.

                          And one more question about the back test. How to set up the initial capital? Because it didn't mention in the setting/report, so I don't know how the system calculate the profit...

                          Comment


                            #14
                            You can select to 'Set order quantity' by 'account size' under the backtest properties - http://www.ninjatrader-support.com/H...AStrategy.html

                            Furthermore you can then set the required margin in the Instrument Manager which determines then the maximum order size used by your strategy.

                            Comment


                              #15
                              Originally posted by NinjaTrader_Bertrand View Post
                              You can select to 'Set order quantity' by 'account size' under the backtest properties - http://www.ninjatrader-support.com/H...AStrategy.html

                              Furthermore you can then set the required margin in the Instrument Manager which determines then the maximum order size used by your strategy.
                              1. I wanna set my initial capital to 5000 dollars, so I changed the "account size" to 5000, and "set order quantity" to by account size.

                              2. The maintenance margin of the instrument is 80% of contract value, so I put 80 in the "margin value" inside the instrument manager.

                              Do I correct? becoz the backtest result is a little strange...

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              85 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              47 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              29 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              32 views
                              0 likes
                              Last Post TheRealMorford  
                              Started by Mindset, 02-28-2026, 06:16 AM
                              0 responses
                              67 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Working...
                              X