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 algospoke, 04-17-2024, 06:40 PM
        6 responses
        49 views
        0 likes
        Last Post algospoke  
        Started by arvidvanstaey, Today, 02:19 PM
        4 responses
        11 views
        0 likes
        Last Post arvidvanstaey  
        Started by samish18, 04-17-2024, 08:57 AM
        16 responses
        61 views
        0 likes
        Last Post samish18  
        Started by jordanq2, Today, 03:10 PM
        2 responses
        11 views
        0 likes
        Last Post jordanq2  
        Started by traderqz, Today, 12:06 AM
        10 responses
        21 views
        0 likes
        Last Post traderqz  
        Working...
        X