Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtesting Error

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

    Backtesting Error

    Hello, I'm running my strategy on backtesting but I'm getting the following error : " Object reference not set to an instance of an object ". this error its only happening on backtesting, in Realtime it works perfect. The code is not entering the loop when it does the backtest, idk why.
    Attached the code lines waiting for help thanks
    Attached Files

    #2
    Hello Sandra73,

    DrawingObjects are not drawn during a backtest.

    The ChartControl will be null until after the backtest is complete.

    You can check the ChartControl is not null, the DrawObjects collection is not null, the variable myReg_reingreso is not null, etc.

    Unfortunately, I don't have a link for a note on this in NinjaTrader 7, but I can provide a link to the help guide on DrawObjects.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello ChelseaB;
      I have no idea how I can fix this. I use Region EndAnchor.Price as a re-entry price level? But Draw Collection is null on backtesting, any way to draw object or access the levels of the region(Start/EndAnchor) to take them as a reference?
      I'm using NT8
      Thanks

      Comment


        #4
        Hello Sandra73,

        Don't use drawing objects for prices in a strategy that is meant to be back-tested.

        Just calculate the prices directly, and use these for the order prices.

        You will not be able to use drawing objects in a backtest.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        574 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        332 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        553 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X