Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can't run backtest

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

    Can't run backtest

    I am new to ninjatrader. I need help running any backtest at all. I get no results even with the sample sma.

    #2
    Hello madmoney5,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    So I may investigate this matter further please answer the following questions.

    Who are you connected to? This is displayed by green on lower left corner of the Control Center window.

    What instrument(s) have you selected? If a futures instrument, what expiry is selected? (Example: ES 09-15)

    What interval and period type is selected for the backtest? (Example: Tick, Minute, Day, etc.)

    I look forward to your response.
    Riley S.NinjaTrader Customer Service

    Comment


      #3
      1) Connected to end of day Kinetick, just to try and run backtests

      2) SP 500, I only want to trade stocks above 5.00

      3) Timeframe is default 1/1/15 to 7/16/15

      4) Ok I just change it from default minute to day, which at least allowed me to run the backtest and get an error

      Error on loading chart data for WLP Default Unable to load historical data

      Error on loading chart data WAG Default

      Error on loading chart data NU Default

      I am trying to test a simple pullback strategy for S&P 500

      Comment


        #4
        Ok, so the errors look like they pertain to issues with historical data per symbol, not a big deal.

        I am looking at results, they look good, now I want to make a couple changes.

        1) I want to always make trades of 20% or 1/5 of account or know how to adjust

        2) How do I trade only stocks above $5.00?

        3) How do I prioritize trades by taking only 5 positions at a time and only taking the weakest 1 week relative strength?

        Comment


          #5
          Hello madmoney5,

          I have provided sample code snippets below to accomplish the questions you are asking for through NinjaScript. Please note that we do not provide programming services.
          1. This logic will enter a long with an amount of trades that would be equivalent to ~20% of your account value:
            Code:
            int quantity = (int)(GetAccountValue(AccountItem.BuyingPower) * .2) / Close[0]);
            EnterLong(quantity);
          2. This conditional checks if the price of the current instrument is above 5 and will enter a long if it is:
            Code:
            if (Close[0] > 5)
            {
                 EnterLong();
            }
          3. I would need further clarification on this one. What would define a value as "weak" and how do you personally define it as the "weakest"?
          Zachary G.NinjaTrader Customer Service

          Comment


            #6
            OK, the close greater then 5, I figured out, I just need to put it in manually as used defined.

            Lowest 1 week relative strength would be priority on the buy list, of only 5 maximum trades at any one time.

            So if there are 10 trades that meet my requirement at the end of the day or morning, it would only pick the 5 lowest 1 week relative strength, if that makes sense.

            Thank you very much for helping me, I greatly appreciate it.

            Comment


              #7
              Ok you might not be able to answer the prioritize the trades because I might need to hire a programmer. Another question I have.

              1) How do I get the strategy to exit the trade at the close of day 5 no mater what. I entered a user input of 5 for time, but having trouble figuring out how to get that into set two to exit or close the trade?

              Comment


                #8
                Originally posted by madmoney5 View Post
                OK, the close greater then 5, I figured out, I just need to put it in manually as used defined.

                Lowest 1 week relative strength would be priority on the buy list, of only 5 maximum trades at any one time.

                So if there are 10 trades that meet my requirement at the end of the day or morning, it would only pick the 5 lowest 1 week relative strength, if that makes sense.

                Thank you very much for helping me, I greatly appreciate it.
                Unfortunately, instances of strategies cannot communicate in the way that you are intending here.

                You would need to add each instrument to your strategy in order for the strategy to look over the instruments you would like to use.

                To do this, you would use the Add() method call. For further information on using the Add() method call, please take a look at the NinjaTrader help guide at this link: http://ninjatrader.com/support/helpGuides/nt7/?add3.htm

                For further information about multiple instruments and time frame use in NinjaScript, please take a look at this link in the NinjaTrader help guide: http://ninjatrader.com/support/helpG...nstruments.htm

                Originally posted by madmoney5 View Post
                Ok you might not be able to answer the prioritize the trades because I might need to hire a programmer. Another question I have.

                1) How do I get the strategy to exit the trade at the close of day 5 no mater what. I entered a user input of 5 for time, but having trouble figuring out how to get that into set two to exit or close the trade?
                I suggest you to take a look at this link in our support forums that deals with time to limit your trades: http://ninjatrader.com/support/forum...ead.php?t=3226

                You can use a variable to get the date when your order was filled and then check the date compared to the number of days that you want to close it out on.
                Zachary G.NinjaTrader Customer Service

                Comment


                  #9
                  Thank you, I will look over each link you sent and do some further work on the strategy.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by PaulMohn, Today, 05:00 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post PaulMohn  
                  Started by ZenCortexAuCost, Today, 04:24 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post ZenCortexAuCost  
                  Started by ZenCortexAuCost, Today, 04:22 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post ZenCortexAuCost  
                  Started by SantoshXX, Today, 03:09 AM
                  0 responses
                  15 views
                  0 likes
                  Last Post SantoshXX  
                  Started by DanielTynera, Today, 01:14 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post DanielTynera  
                  Working...
                  X