Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtesting does not work

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

    Backtesting does not work

    To make the backtesting the system gives me all the orders as good because when the candles are very large and breaks my stop in the same candle, does not make it as bad. How do I solve this problem?.

    The candle of the 17h is bad, but for the system is good, if the order comes out in the following candle there are no problems and he does it well.
    Attached Files

    #2
    elgrajillo, in backtesting NinjaTrader would take the conservative approach - if both target and stop could've been filled on the same bar it would execute the stop then. To better test your strategy here you could add more granular data to it - http://www.ninjatrader.com/support/f...ead.php?t=6652

    Comment


      #3
      I am truing to backtest a strategy but it doesn't work, I a msure the problem is because there is something wrong in the code. I have this:
      if (Position.MarketPosition==MarketPosition.Flat)
      {
      if (High [1] > High [0])
      {
      Tope = High[0];
      }

      else
      {
      Tope = High [1];
      }

      if (Low [1] > Low [0])
      {
      Base = Low[0];
      }

      else
      {
      Base = Low [1];
      }
      }
      I previously declared the variable Tope=0 and Base=0
      What I want is to enterlong in the middle between Tope and Base, so I wrote this:
      EnterLongLimit((Tope-Base)/2,"BuyOrder")

      For the stoploss and profit target:
      if (Position.MarketPosition== MarketPosition.Long)
      SetStopLoss ("Largos",CalculationMode.Percent,Base-Base*StPct,false);
      SetProfitTarget(CalculationMode.Ticks, 6);

      Any idea why the backtest results are there 0 trades?

      Thanks

      Comment


        #4
        I would suggest you print the price for entry you calculate here in your code, you can also try just issueing a Stop market order for example to see if it's just the limit order not filling.

        For strategy debugging, the TraceOrders feature is also very helpful :

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        672 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        379 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        111 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        577 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        582 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X