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 stafe, 04-15-2024, 08:34 PM
        9 responses
        42 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by frslvr, 04-11-2024, 07:26 AM
        7 responses
        111 views
        1 like
        Last Post caryc123  
        Started by rocketman7, Today, 09:41 AM
        3 responses
        8 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by traderqz, Today, 09:44 AM
        2 responses
        5 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by rocketman7, Today, 02:12 AM
        7 responses
        31 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X