Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple StopLoss modifications

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

    Multiple StopLoss modifications

    I read your thread and the link to NinjaScript regarding the price modification of a stop as part of the strategy.

    I am interested in doing this multiple times (much like a trailing stop) based upon multiple profit target levels for any given position. My question relates to how the existing stoploss is handled. For example, if a stop loss is modified to break-even at a given profit level, and then at a higher level is modified to a new level, does the modification automatically place the new stop loss AND cancel the existing one?

    On a related note, I have a question about the StopLoss calculations. The following is an excerpt from your posted example of resetting the stoploss:
    // If a long position is open, allow for stop loss modification to breakeven
    elseif (Position.MarketPosition == MarketPosition.Long)
    {
    // Once the price is greater than entry price+50 ticks, set stop loss to breakeven
    if (Close[0] > Position.AvgPrice + 50 * TickSize)
    {
    SetStopLoss(CalculationMode.Price, Position.AvgPrice);


    Would this calculate the stoploss at each tick or only at the bar close?
    Thanks.
    Last edited by billr; 07-14-2010, 03:57 PM.

    #2
    Bill, I'm not sure what thread you're referring to, but yes, changing the stop loss would automatically place the "new" one and take care of the "old" stop loss. I put those words in quotes because I believe the stop loss is just modified instead of canceled and replaced. You would want to run your strategy on live data though to be sure.

    EDIT: The behavior of modifying the stop loss (cancel and replace or change) would depend on the broker.
    Last edited by NinjaTrader_Austin; 07-14-2010, 04:04 PM.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Austin,

      I believe it depends on the brokerage.

      Hope this helps someone.

      Comment


        #4
        Bill, I see you edited your post just now, but only because r2k posted a reply. In the future, please just reply to the thread instead of editing your post because we don't get updates to the ticket unless there is a new reply.

        Whether that calculated on every tick would depend on the CalculateOnBarClose setting. If COBC = true, then it would only be updated once per bar. If COBC = false, then it would be updated every tick. If you have strategy calculations you'd only like to run once per bar, but with a trail stop to update every tick, we have a reference sample for that: Separating logic to either calculate once on bar close or on every tick
        AustinNinjaTrader Customer Service

        Comment


          #5
          thanks r2k.

          I had planned on setting it to simulated mode, so if I understand that idea correctly, there is no stop placed to the broker. The closing order would be sent by the strategy when the stop is triggered..... I think. Thanks again.

          Comment


            #6
            Bill, you do understand that concept correctly. However, if your computer crashes or you lose your connection to the internet while you have a strategy running with a position open, that position would be unprotected and the stop would not be triggered.
            AustinNinjaTrader Customer Service

            Comment


              #7
              Thanks for confirming that Austin.

              Comment


                #8
                billr,

                To further clarify what Austin said, this is true, but an additional factor to pay attention to is actually which brokerage technology you are using. If your strategy has actually submitted your order, it depends whether or not that order is sitting at the brokerage/exchange or on your own computer. Please see here for more information: http://www.ninjatrader.com/support/f...ead.php?t=5349
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                597 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                343 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                103 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                556 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                555 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X