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

Questions on Trailing Stops

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

    Questions on Trailing Stops

    Question 1) How do I use the trailing stop in combination with a simple stop ?

    E.g. A strategy buys a contract at 100, and wants to set the initial stop at 5% (95). Once the price reaches 101, a trailing stop of 1% must be engaged.

    Using SetStopLoss(...) and SetTrailStop() together does not seem to work because the SetStopLoss() overrides the SetTrailStop.

    So what is a better solution ?

    The documentation talks about "reset" the trailing stop.
    Question 2) How do I reset the trailing stop loss ?

    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
    The reason I ask is, if I want to abandon a Trailing Stop midway. Let us say, the strategy buys at 100.0, and applies a trailing stop of 2%. After a certain threshold is reached, it must abandon (stop using) the trailing stop. The trailing stop remains where it was - it not used further.
    Is it possible ?

    #2
    adheer, your understanding on the Set's is correct - on the same position only the SetStopLoss or the SetTrailStop could work, not both. A reset could be done by just calling the set method again in OnBarUpdate(), as would be for example needed when implementing a custom trailing stop via dynamically calling SetStopLoss.

    We have a reference sample on this topic here - http://www.ninjatrader.com/support/f...ead.php?t=3222

    That way you could combine all aspects as you would have full control when to move the stop to provide the trailing (Set's could not be unset though).

    If you still need more granular control, then implementing this over the Exit methods would be recommended.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      hi Bertrand

      I have refereed to sample you provided in this post. if the time you are using a higher time fram (60 min) how can you get the artificial trailing stop to move up tick by tick.? is it as simple as turning of off the calculationonbarclose to false?

      if this is the way to do this, how can you replicate this in to show accurate backtesting results in Strategy wizard if you are using higher time frames than tick

      Comment


        #4
        The Set's would always run on the primary bars of your script, therefore in realtime or replay it could amend using CalculateOnBarClose = false. However for backtesting you could not simulate this action without reworking the trail logic using the Exit methods that would allow for submission against a finer tick series for example on historical. Our next major platform update will have enhancements in this area.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rocketman7, Today, 02:12 AM
        2 responses
        16 views
        0 likes
        Last Post rocketman7  
        Started by briansaul, Today, 05:31 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by PaulMohn, Today, 03:49 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by frslvr, 04-11-2024, 07:26 AM
        6 responses
        106 views
        1 like
        Last Post NinjaTrader_BrandonH  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        6 responses
        26 views
        0 likes
        Last Post trilliantrader  
        Working...
        X