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 argusthome, 03-08-2026, 10:06 AM
          0 responses
          80 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          46 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
          66 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X