Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stoploss/Profit Target backtesting possible?

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

    Stoploss/Profit Target backtesting possible?

    Is it possible to backtest stop-losses and profit targets on intraday strategies (10mins etc.) in NinjaTrader? It seems whenever i programm a stop/profit target into the strategy it does not get incorporated into the backtesting.

    Secondly is it possible to backtest a bracket order. Meaning to define a profit target for a new position after which a trailing stop is then triggered. Lets say new long position has to be up $1000 and then a trailing stop is initiated on that position.

    Any help would be great
    Thanks

    #2
    Hi BerndS,

    It is certainly possible to backtest Stops and Targets on intraday data.

    What are you using for your stop loss and profit? Can you provide the code sections or a screenshot if done in the wizard?

    You could certainly add a trailing stop. Or, here is a sample on modifying a stop loss within the code - http://www.ninjatrader.com/support/f...ead.php?t=3222
    TimNinjaTrader Customer Service

    Comment


      #3
      Below is the stop i want to place. Its a basic 2*ATR of the last 20 bars.

      protected override void OnBarUpdate()
      {
      SetStopLoss("Stop", CalculationMode.Ticks, 2 * ATR(20)[0], true);

      if (CrossAbove(SMA(ShortMA), SMA(LongMA), 1))
      {
      EnterLong(DefaultQuantity, "Long");
      }

      // Condition set 2
      if (CrossBelow(SMA(ShortMA), SMA(LongMA), 1))
      {
      EnterShort(DefaultQuantity, "Short");
      }
      }

      Comment


        #4
        Hi BerndS,

        Here is the syntax for SetStopLoss()
        Code:
        SetStopLoss(string fromEntrySignal, CalculationMode mode, double value, bool simulated)
        Try changing your fromEntrySignal to
        Code:
        SetStopLoss("", CalculationMode.Ticks, 2 * ATR(20)[0], true);
        to set a stop loss for any entry, be sure you are using the correct mode type for what you're trying to achieve as well.
        More info at - http://www.ninjatrader-support.com/H...ml?SetStopLoss
        TimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ETFVoyageur, Today, 04:00 PM
        0 responses
        2 views
        0 likes
        Last Post ETFVoyageur  
        Started by AaronKTradingForum, Today, 03:44 PM
        1 response
        5 views
        0 likes
        Last Post AaronKTradingForum  
        Started by Felix Reichert, 04-26-2024, 02:12 PM
        11 responses
        72 views
        0 likes
        Last Post Felix Reichert  
        Started by junkone, 04-28-2024, 02:19 PM
        7 responses
        82 views
        1 like
        Last Post junkone
        by junkone
         
        Started by pechtri, 06-22-2023, 02:31 AM
        11 responses
        136 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Working...
        X