Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

reseting a setstoploss

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

    reseting a setstoploss

    Hello,
    I'm running into this issue stated in the Help on SetStopLoss:
    "Should you call this method to dynamically change the stop loss price in the strategy OnBarUpdate() method, you should always reset the stop loss price/offset value when your strategy is flat otherwise, the last price/offset value set will be used to generate your stop loss order on your next open position"

    Can someone please give me and idea of how to reset the value. Also there may be times in my strategy when the value will need reset, but I won't be flat, such as having another open position.

    Thanks

    #2
    You will reset the stop by changing stop loss value. An example for this can be found from the following reference:

    http://www.ninjatrader.com/support/f...ead.php?t=3222

    So for example, you could use something like the the following in OnBarUpdate

    if (Position.MarketPosition == MarketPosition.Flat)
    SetStopLoss(CalculationMode.Ticks, 5);

    Please let me know if you have additional questions.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Can I use another condition to reset the value? As I stated before, often my strategy will not be flat.

      Comment


        #4
        Originally posted by CaptainAmericaXX View Post
        Can I use another condition to reset the value? As I stated before, often my strategy will not be flat.
        You can change the StopLoss value at any time, using any trigger condition.

        It is just the you MUST reset the StopLoss when you go flat, or you will see many unintended consequences.

        Comment


          #5
          Thanks for the replies. To be clear must I be FLAT in order to reset the stoploss or can it be reset on another condition?

          Comment


            #6
            Hello,

            You can reset it under any condition, but do make sure you are also resetting when flat to avoid unwanted situations.
            MatthewNinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ageeholdings, 05-04-2024, 03:21 PM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by claxxical, 05-30-2017, 12:30 PM
            39 responses
            4,505 views
            0 likes
            Last Post fiendtrades  
            Started by tonynt, 05-21-2019, 06:27 AM
            12 responses
            542 views
            1 like
            Last Post fiendtrades  
            Started by alexstox, 10-16-2018, 03:29 PM
            12 responses
            355 views
            0 likes
            Last Post Tburg1073  
            Started by truepenny, Today, 03:59 AM
            0 responses
            8 views
            0 likes
            Last Post truepenny  
            Working...
            X