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

Shifting Trailing Stop Only On Bar Roll Over

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

    Shifting Trailing Stop Only On Bar Roll Over

    I have a strategy that takes entries during the bar's period - hence calculate on bar close must be set to false. However I need to tell my trailing stop to only advance after a candle has closed (i.e. at the very beginning of the next candle) - or at bar roll-over if you will. It may be worthwhile mentioning that I am doing the trailing stop logic manually so I have much control - not using the SetTrailStop() call to set it. Instead I'm using ExitLongStop() and ExitShortStop() which I am nursing manually in onBarUpdate().

    So I imagine I just need to know when the onBarUpdate() method gets called for a particular candle for the very first time. Yes, I could use Time[0] and use some type of reset mechanism when I see the minute interval change (I'm using minute charts with this) but there must be a more elegant way

    Thanks,

    Molecool
    Last edited by molecool; 02-27-2013, 06:50 AM.

    #2
    You can use FirstTickOfBar to reset your ExitLong/ShortStop() which would move the stop only when a new bar opens.

    We have a reference sample to demonstrate these concepts:



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

    Comment


      #3
      Originally posted by NinjaTrader_Matthew View Post
      You can use FirstTickOfBar to reset your ExitLong/ShortStop() which would move the stop only when a new bar opens.

      We have a reference sample to demonstrate these concepts:



      Please let me know if you have any questions.
      Awesome - that'll work just fine. Many thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by JimB17, 01-10-2020, 10:27 AM
      74 responses
      2,789 views
      0 likes
      Last Post axelbaws  
      Started by KonAdams, 05-07-2024, 10:53 PM
      6 responses
      23 views
      0 likes
      Last Post KonAdams  
      Started by dp8282, Today, 07:35 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by Klaus Hengher, Yesterday, 03:13 AM
      3 responses
      17 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by ETFVoyageur, 05-07-2024, 07:05 PM
      7 responses
      54 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X