• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to reset SetTrailStop ?

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

    how to reset SetTrailStop ?

    In the documentation it states:

    "Should you call this method to dynamically change the trail stop price in the strategy OnBarUpdate() method, you should always reset the trail stop price / offset value when your strategy is flat otherwise, the last price/offset value set will be used to generate your trail stop order on your next open position"


    I'm using this in both OnBarUpdate as well as OnExecutionUpdate .

    SetTrailStop("MY LONG ALERT",CalculationMode.Ticks, StopLoss, false);


    What is the code to reset the trail stop price??


    The parameter StopLoss is passed in as an input parameter.

    #2
    Hello priceisking,

    If you are using CalculationMode.Ticks and this isn't changing, then you are not calling this method dynamically.

    If the value of StopLoss is changing and you are calling this method multiple times so that you are dynamically changing the number of ticks for the stop loss, that would be dynamically.

    To reset it, you would just set StopLoss back to the original number of ticks and then call the method again.

    Below is a link to an example named ProfitChaseStopTrailSetMethodsExample_NT8 that dynamically changes the price of a stop. It is reset back to the original distance on lines 94 through 103.
    https://ninjatrader.com/support/foru...269#post802269
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea. One quick question. When I place my trailstop, i am unable to get the profit target to get placed. How can i get it to be an OCO. The thing is, I want to be able to move my trailing stop around on the chart. if i use setProfitTarget, the limit order moves back to the previous position when the bar closes.

      if (EnableTrail)
      {
      SetTrailStop("MY L",CalculationMode.Ticks, StopLoss, true);
      targetOrder = ExitLongLimit(0, true, execution.Order.Filled, execution.Order.AverageFillPrice + ProfitTarget * TickSize, "MY L T", "MY L");
      }


      Comment


        #4
        Hello priceisking,

        Thanks for your reply.

        I would expect that the use of ExitLongLimit is being "ignored" based on the internal order handling rules, specifically, "Methods that generate orders to exit a position will be ignored if: A position is open and an order submitted by a set method (SetStopLoss() for example) is active". In this case the set method is the SetTrailStop(), please see, "Internal Order Handling Rules that Reduce Unwanted Positions" on page: https://ninjatrader.com/support/help...d_approach.htm

        In general strategies are not intended for manual interaction and it would be expected that orders would continue to be set back to the place they were upon each update to the strategy's OnBarUpdate() method. You may also create/cause unexpected orders/positions or disable the strategy, depending on the timing of moving the orders and the OnBarUpdate().

        If you wish to be able to move stops/profit targets around then you should look at using the special ATM methods in Ninjascript that allow you to work with a specific ATM template when the strategy has entered a position. The trade then is controlled by the ATM which allows you dynamic adjustments if you wish. Once the trade is closed by the ATM, control returns to the Ninjascript strategy to find and place the next entry. An example of this strategy is in your platform and is called SampleATM strategy. The strategy is a nInjascript strategy and is well commented to help clarify the internal functionality. Here is a link to the specific ATM ninjascript methods you would use: https://ninjatrader.com/support/help...gy_methods.htm
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          I'm having a problem with my strategy performing a profit target function in replay. I have a simple crossover strategy using ATR Trailing Stop indicator. I have the profit target set to 7 ticks. On one day (July 11) the strategy worked and took profits every 7 ticks when set to Profit Target Total Position. It did not take profits using Profit Target setting with @long and @short. When I tested the strategy using July 12 replay data, the strategy wouldn't take profits at 7 ticks with either of the settings. I'm using September ES futures contract. Any suggestions as to what is wrong here?

          Comment


            #6
            Hello LTWCI,

            Is this from using SetProfitTarget()?

            Are you getting an ignored message with TraceOrders?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea--yes, used with SetProfitTarget Total Position. How do I see trace orders? I have not used NT in a while. I tested again today and the strategy is working.

              Comment


                #8
                Hello LTWCI,

                Assign TraceOrders = true; in State.Configure.

                Below is a link to the help guide.
                https://ninjatrader.com/support/help...raceorders.htm

                Also, below is a link to a forum post on using prints to understand behavior.
                https://ninjatrader.com/support/foru...121#post791121
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Chelsea,

                  This is off topic--will there be a mobile version of Ninja Trader? If there was a mobile version I could enable my strategy before market open and if desired turn the strategy off via mobile app version while at work. Even if the mobile app was bare bones offering only Market Analyzer and Workspace it would suffice. The ability to turn a strategy on or off via mobile would be an advantageous improvement. If the data provider has a mobile app that would work too. Thanks.
                  Last edited by LTWCI; 07-27-2019, 03:42 PM.

                  Comment


                    #10
                    Hello LTWCI,

                    I cannot comment if a mobile version is planned.

                    I will however submit your vote to the feature request for this this.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Hello LTWCI,

                      I have received tracking ID# SFT-584 for this request for a mobile app.

                      Please note it is up to the NinjaTrader Development to decide if or when a request will be implemented.

                      We appreciate your feedback.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Chelsea,

                        Great. After taking a few years off to test new strategies, I'm looking to get back to trading with strategies and futures. Does Ninja Trader Brokerage have a mobile app? That would probably solve my need. I've been trading option spreads the past few ears and found the broker's mobile app to be invaluable.

                        Comment


                          #13
                          Hello LTWCI,

                          There may be something from the brokerage side you can use.

                          Please contact brokeragesupport [at] ninjatrader [dot] com for more information.
                          Chelsea B.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by seagraph, Today, 03:27 PM
                          0 responses
                          11 views
                          0 likes
                          Last Post seagraph  
                          Started by dedouglas, Today, 02:54 PM
                          1 response
                          11 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Started by elkhatabi, 08-01-2019, 06:36 PM
                          5 responses
                          53 views
                          0 likes
                          Last Post NinjaTrader_RyanL  
                          Started by mr_trade, Today, 01:01 PM
                          4 responses
                          19 views
                          0 likes
                          Last Post mr_trade  
                          Started by Renorail, Today, 12:31 PM
                          1 response
                          14 views
                          0 likes
                          Last Post NinjaTrader_PaulH  
                          Working...
                          X