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 DJ888, 04-16-2024, 06:09 PM
        4 responses
        12 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by terofs, Today, 04:18 PM
        0 responses
        11 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by nandhumca, Today, 03:41 PM
        0 responses
        7 views
        0 likes
        Last Post nandhumca  
        Started by The_Sec, Today, 03:37 PM
        0 responses
        3 views
        0 likes
        Last Post The_Sec
        by The_Sec
         
        Started by GwFutures1988, Today, 02:48 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Working...
        X