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 CortexZenUSA, Today, 12:53 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by CortexZenUSA, Today, 12:46 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by usazencortex, Today, 12:43 AM
        0 responses
        2 views
        0 likes
        Last Post usazencortex  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        168 responses
        2,264 views
        0 likes
        Last Post sidlercom80  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        11 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X