Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

setstoploss where?

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

    #16
    Hello tonynt,

    Thanks for your reply.

    Yes, you should be good to go.

    Yes, you can use the SetStopLoss and ExitLongStop on separate orders using separate signalnames.
    Paul H.NinjaTrader Customer Service

    Comment


      #17
      Hello,

      when searching for an answer in the forum I found this thread again about this topic, but missing a reply to onorderupdate.

      It occurs sometimes that I have not stop and no target for a trade. I have setstoploss and setprofittarget in onexecution. So, I assume that the onorderupdate sets my entryorder back to null before onexecution can perform "if(.... order filled) then setstoploss" (which works fine 99% of the time).

      I assume I should move the setstoploss to onorderupdate a.) to avoid naked trades and b.) when I want to change the basic-stop to what is determined by a certain entry and conditions immediately after the entry (and not to onbarupdate-that might be reacting only with close of bar)?

      And if I have in onorderupdate (if entryorder ... filled) then setstoploss() do I have to put setstoploss also in Initialize or only in onOrderupdate please?


      Thank you
      Tony
      Last edited by tonynt; 08-15-2017, 08:20 AM.

      Comment


        #18
        Hello tonynt,

        Thanks for your post.

        The Set methods must be set prior to placing an order as otherwise when the order is filled that last use case of the Set methods will be employed immediately before you can change to your preferred values. In other words, the set methods remember the last value they were set to so if you do not set them before placing the next order when the entry is filled the set methods will be deployed with the previously used values which may be inappropriate.

        From the helpguide, "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" The same idea/message is presented in the SetProfitTarget() method and also in the SetTrailStop()

        The idea of setting them in the initialize method would only be valid if you were intending to use the very same values each time, for example, SetStopLoss(CalculationMode.Ticks, 15); would mean that every order placed would have a 15 tick stop loss and you need not code anything else. However if in the OnBarUpddate you then decide to code another stop loss, when this stoploss is used every subsequent order will use this new level.

        I assume you are determining your entry logic in the OnBarUpdate() and recommend that if you are using changing (dynamic) stop/profits that these be set prior to making any entry so that when your entry order is filled the correct stop/profits targets will be deployed. Otherwise, you risk using incorrect values.
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bmartz, 03-12-2024, 06:12 AM
        5 responses
        32 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by Aviram Y, Today, 05:29 AM
        4 responses
        13 views
        0 likes
        Last Post Aviram Y  
        Started by algospoke, 04-17-2024, 06:40 PM
        3 responses
        28 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by gentlebenthebear, Today, 01:30 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by cls71, Today, 04:45 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X