Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtesting

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

    Backtesting

    I have a problem with backtesting.

    I have historical prices on SP500. If i put in 01-01-1950 as from date and 01-05-2010 as to date and then test a strategy notting appears on summary. Every thing is $0, but the Chart appears correctly, but there is no executions, trades or orders.

    The test strategy is pretty simple. Buy if the short average cross above the long average and sell when the short average cross below the long average.

    protectedoverridevoid OnBarUpdate()
    {
    // Condition set 1
    if (CrossAbove(SMA(MediumAverage), SMA(LongAverage), 1))
    {
    EnterLong(DefaultQuantity,
    "BUY");
    }
    // Condition set 2
    if (CrossBelow(SMA(MediumAverage), SMA(LongAverage), 1))
    {
    ExitLong(
    "SELL", "");
    }
    }

    I hope someone can help me.

    #2
    superjma,

    Please check your Control Center logs for runtime errors. What are your values for MediumAverage and LongAverage?
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Log and values

      The Log are empty and the values are 50 and 200.

      I have attached a image showing the settings.
      Attached Files

      Comment


        #4
        superjma, please try backtesting this strategy on a stock or ETF, on indices it'll unfortunately not work as those are not directly tradable.

        Comment


          #5
          It worked

          Thanks a lot.

          I just created the index as a new stock and imported the data and it worked fine.

          Perfect.. now i'm ready to develop a strategy.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          144 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          71 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          125 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          79 views
          0 likes
          Last Post PaulMohn  
          Working...
          X