Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

setstoploss where?

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

    setstoploss where?

    Hello,

    when watching my strategies I have done now for months I´m wondering if I´m doing correct the stops, or the best way.

    Where should one set the stoploss please? In onexecution, in onorderupdate or in onbarupdate?

    Sorry that basic question, but couldn´t find a comment about different ways.

    Thank you.
    Tony

    #2
    Originally posted by tonynt View Post
    Hello,

    when watching my strategies I have done now for months I´m wondering if I´m doing correct the stops, or the best way.

    Where should one set the stoploss please? In onexecution, in onorderupdate or in onbarupdate?

    Sorry that basic question, but couldn´t find a comment about different ways.

    Thank you.
    Tony
    That depends on how you are setting the stops. Are you using Set() methods or Exit() methods?
    Last edited by koganam; 07-02-2014, 08:02 AM. Reason: Corrected spelling.

    Comment


      #3
      Hello,

      thank you for your reply. Yes, using setstoploss.

      Best regards
      Tony

      Originally posted by koganam View Post
      Taht depends on how you are setting the stops. Are you using Set() methods or Exit() methods?

      Comment


        #4
        Hello Tony,

        Thanks for your post about stoploss placement (within code).

        If your stops are fixed then initialize section is best.

        You can also place these in OnBarUpdate if you wish to change them dynamically however you would need to reset the changed stoploss when flat.

        Here is a link to the help guide: http://www.ninjatrader.com/support/h...etstoploss.htm

        Here is a reference strategy: http://www.ninjatrader.com/support/f...ead.php?t=3222

        Please let me know if you have further questions.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hello,

          thank you for your reply. I know this sample. And my questions refer to this (and I do my stops like this, but I dont have in Initialize).

          * Referring to this sample why is the "basic"setstoploss in Initialize and also in onbarupdate?

          * what would happen maybe if the setstoploss would not be in Initialize?

          * and thank you for your hint with reset when flat. Where is this to do? in onbarupdate? or this is the setstoploss n Initialize?

          Thank you
          Tony



          Originally posted by NinjaTrader_Paul View Post
          Hello Tony,

          Thanks for your post about stoploss placement (within code).

          If your stops are fixed then initialize section is best.

          You can also place these in OnBarUpdate if you wish to change them dynamically however you would need to reset the changed stoploss when flat.

          Here is a link to the help guide: http://www.ninjatrader.com/support/h...etstoploss.htm

          Here is a reference strategy: http://www.ninjatrader.com/support/f...ead.php?t=3222

          Please let me know if you have further questions.
          Last edited by tonynt; 07-02-2014, 09:59 AM. Reason: translation error

          Comment


            #6
            Hello Tony,

            Thanks for your reply.

            In the reference sample setting the stoploss in the the initialize and then later on in OnBarUpDate is simply to show that it can be done both ways. In the case of the reference sample, it checks for flat position first and sets the stop loss to the same value, which is a "reset" as later on in the reference sample the stoploss value is adjusted dynamically.

            The stoploss does not have to be in the initialize section it is just preferred because if a person programs their logic poorly they could be in a position and have not yet set a stoploss. By using the initialize section it gets the stop loss set before the 1st onbarupdate.

            The reference sample does the reset in onBarUpdate as the first action (after testing for being flat).

            The main point is that you want to set your stoploss before you place your entry.

            Please let me know if you have further questions.
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Hello Paul,

              thank you for your reply.

              With your information "The main point is that you want to set your stoploss before you place your entry." do you refer to the setstoploss in the Initialize? And please another question now referring to your information: could it happen that the stoploss is set before the entry (as you write) and the entry is not filled? If so, is the setstoploss accepted like an order and when it is triggered there is a position in the other direction?

              Thank you
              Tony




              Originally posted by NinjaTrader_Paul View Post
              Hello Tony,

              Thanks for your reply.

              In the reference sample setting the stoploss in the the initialize and then later on in OnBarUpDate is simply to show that it can be done both ways. In the case of the reference sample, it checks for flat position first and sets the stop loss to the same value, which is a "reset" as later on in the reference sample the stoploss value is adjusted dynamically.

              The stoploss does not have to be in the initialize section it is just preferred because if a person programs their logic poorly they could be in a position and have not yet set a stoploss. By using the initialize section it gets the stop loss set before the 1st onbarupdate.

              The reference sample does the reset in onBarUpdate as the first action (after testing for being flat).

              The main point is that you want to set your stoploss before you place your entry.

              Please let me know if you have further questions.

              Comment


                #8
                Hello Tony,

                Thanks for your post.

                You would want to set your stoploss before you enter a position as the best practice. This ensures that there is no delay in placing the stop loss when you enter a position. If your logic has you entering a position, then calculating and placing a stoploss, it is theoretically possible that a volatile market could go against you before you have your stop in place.

                For clarity, when using set methods, no order is placed until an entry has occurred. Setting the stop/profit targets can all be done and will not activate until an entry has occurred.

                Please let me know if you have further questions.
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Hello Paul,

                  thank you again for your reply.

                  I have to mention again from time to time: great software and great support!

                  But please let me be sure 100% with the most important thing here:

                  * the stop is set before the entry of a position when it is in Initialize(?)

                  * if it occurs that the entry will not be realized afterwards (lets assume this will happen, when I see the markets right now after the news and I hear the problems of fellows in rooms, I can imagine that everything can happen), so when this occurs that the stop is set and the entry will not be realized, then it can not happen that the stop changes to a position when market changes direction and stop-price is triggered?

                  Thank you again.

                  Best
                  Tony


                  Originally posted by NinjaTrader_Paul View Post
                  Hello Tony,

                  Thanks for your post.

                  You would want to set your stoploss before you enter a position as the best practice. This ensures that there is no delay in placing the stop loss when you enter a position. If your logic has you entering a position, then calculating and placing a stoploss, it is theoretically possible that a volatile market could go against you before you have your stop in place.

                  For clarity, when using set methods, no order is placed until an entry has occurred. Setting the stop/profit targets can all be done and will not activate until an entry has occurred.

                  Please let me know if you have further questions.
                  Last edited by tonynt; 07-03-2014, 06:48 AM. Reason: translating error

                  Comment


                    #10
                    Hello Tony,

                    Thanks for your post and questions.

                    Stop loss orders are submitted in real-time on incoming executions from entry orders.

                    If your entry is not triggered, your stoploss order will not be placed.

                    Please let me know if you have any further questions.
                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      Hello,

                      thank you for your reply.

                      I don´t understand, sorry.

                      In one of the earlier replies you wrote "The main point is that you want to set your stoploss before you place your entry."

                      Now you write "If your entry is not triggered, your stoploss order will not be placed." But when stop is set before (when in Initialize) how can this be true then?

                      Thank you.

                      Best regards
                      Tony




                      Originally posted by NinjaTrader_Paul View Post
                      Hello Tony,

                      Thanks for your post and questions.

                      Stop loss orders are submitted in real-time on incoming executions from entry orders.

                      If your entry is not triggered, your stoploss order will not be placed.

                      Please let me know if you have any further questions.

                      Comment


                        #12
                        Hello Tony,

                        Thanks for your post and questions.

                        To be clear when i wrote, "The main point is that you want to set your stoploss before you place your entry" was directed at the SetStopLoss methodology.

                        Using the SetStopLoss, SetTrailStop, SetProfitTarget methods tells NinjaTrader to create those orders after receiving an execution from an entry order. To say it another way, these methods do not place orders when the statements are executed unless and until the strategy has received an execution from an entry order.

                        Please let me know if you have further questions.
                        Paul H.NinjaTrader Customer Service

                        Comment


                          #13
                          Hello,

                          when there is an entry in onmarketdata where should be

                          a.) setstoploss
                          b.) exitlongstop

                          The stoplosses are transmitted - even with entry-conditons and stoplosses in onbarupdate - immediately with an entry. So, can both be in onbarupdate for entries based on conditions in onmarketdata? Or should they be in onexecution?

                          The reason for the question is that in my script I have conditions in onmarketdata and in onbarupdate and I want to avoid unnecessarily coding and also problems in function.

                          Thank you
                          Tony
                          Last edited by tonynt; 10-06-2015, 02:48 PM. Reason: typing error

                          Comment


                            #14
                            Hello tonynt,

                            Thanks for your post.

                            First, please keep in mind this tip about OnMarketData: With NinjaTrader being multi-threaded, you should not rely on any particular sequence of events like OnMarketData() always being called before OnBarUpdate() or vice versa. (from: http://ninjatrader.com/support/helpG...marketdata.htm)

                            Are you intending to dynamically set/adjust the stop loss value after you place the order?

                            Also, in the managed approach, the use of SetStopLoss()would prevent you from using ExitLongStop() (if you intended to use both of them), please see the internal order handling rules here: http://ninjatrader.com/support/helpG...d_approach.htm
                            Paul H.NinjaTrader Customer Service

                            Comment


                              #15
                              Hello Paul,

                              thank you for your reply.

                              Yes, I do dynamically adjust the stoploss after the order. I do this in onexecution with Iorders and this works fine (I want the stop moved only with fill of target1 and not with ticks - as ticks must not be filled)

                              But I wanted to be sure if this is OK also for entries in onmarketdata(?)

                              Referring your information about setstoploss and exitlongstop I assume you mean for same entry? With my understanding I can handle entry1 with exitlongstop and entry2 with setstoploss. Correct?

                              Thank you
                              Tony

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Betican, Today, 12:25 AM
                              1 response
                              24 views
                              0 likes
                              Last Post NinjaTrader_PaulH  
                              Started by Betican, Today, 12:32 AM
                              1 response
                              24 views
                              0 likes
                              Last Post NinjaTrader_PaulH  
                              Started by BullyWig Trader, Today, 06:30 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post BullyWig Trader  
                              Started by Don22Trader1, Yesterday, 04:20 PM
                              1 response
                              21 views
                              0 likes
                              Last Post NinjaTrader_PaulH  
                              Started by ginx10k, Today, 05:49 AM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Working...
                              X