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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        47 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        15 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        21 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        23 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X