Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

StopLoss & TrailingStop doesn´t work together

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

    StopLoss & TrailingStop doesn´t work together

    Hello,
    I tried to put a StopLoss and a TrailingStop in my strategy. Unfortunately they do not work together in backtest, just the StopLoss is working if I use both. It looks like StopLoss overwrites TrailingStop. If I use just one of them it is working.
    What could be the reason to ignore TrailingStop?
    Last edited by Jesse; 03-29-2009, 07:09 PM.

    #2
    Hi Jesse, thanks for your post, this is expected as SetStopLoss and SetTrailStop can't be used together working on the same position (signal name). You can use the ideas presented in this reference sample to code your trailing stop by modifying the SetStopLoss value - http://www.ninjatrader-support2.com/...ead.php?t=3222
    BertrandNinjaTrader Customer Service

    Comment


      #3
      I'm also running into this SetStopLoss + SetTrailStop problem (again).

      I noticed this shortcoming of NinjaTrader two years ago when I first started coding NinjaScript, and decided to code around the problem by implementing my own trailing stops.

      It's doable, but this is a lot of unnecessary work for anyone who wants both to set a stop loss and then at a later time run with a trailing stop.

      This same funcionality is nicely accomplished by using the ATM Strategies and SuperDOM or chart trader functions in NinjaTrader, but there is no way to supply an ATM strategy on-the-fly, based on program generated requirements. For this and other limiting factors, once again I've given up on programatically accessing the ATM strategy components. So I'm back to implementing my own Auto Breakeven and Trailing Stop code.

      So, how about providing a way to simply cancel an existing SetStopLoss value? This would allow programmers to switch from SetStopLoss to SetTrailStop. And if implemented it would be nice if NinjaTrader would then use the most recent SetTrailStop value specified (then we wouldn't be running 'naked' with no stop loss set, if even for a short period of time.)

      As an implementation suggestion, perhaps just setting a stop loss price of zero could be used as an indication that the programmer wants to cancel the current stop loss?

      This would then allow programmers to be able to easily do their own breakeven strategies (which requires a SetStopLoss) and then later switch to a SetTrailStop, without a lot of extra, unneeded complexity.

      Thanks for listening (or should we say reading.)

      Comment


        #4
        KBJ, thank you for your detailed input and suggestions.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hello

          I am also interested to cancel a stoploss and switch to trailingstoploss. Has there anything been implemented in the last 1.5 years?
          In some other posts you suggest to set the stoplimit far away, but this does not help in this case, because NT ignores trailingstops if a stoploss exists. Also your reference example which resets the stoploss does not help, because we are looking for a trailing stop loss. In some posts you mention that a stop loss could be canceld by orderid?
          I would appreciate if you could give a code example how a stoploss is cancelled and a new trailingstop setup.
          thanks

          Comment


            #6
            Beauregard, Bertrand's advice in post #2 still stands: "You can use the ideas presented in this reference sample to code your trailing stop by modifying the SetStopLoss value - http://www.ninjatrader-support2.com/...ead.php?t=3222".

            Another option would be to use IOrders, but that would still require you to move the stop with code instead of it being done automatically.

            There have been many discussions on the forum for how to code trailing stops, please take a look at the results generated by this search. Unfortunately it is not possible to share searches on the forum, but you can click search and then type in "trail stop" or "trailing stop" or something similar and get many results.
            AustinNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Nolyn, Today, 10:59 AM
            0 responses
            1 view
            0 likes
            Last Post Nolyn
            by Nolyn
             
            Started by Gkomi, Today, 10:02 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Jim  
            Started by JTizz, Today, 08:58 AM
            6 responses
            30 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by Bob49, Today, 08:40 AM
            0 responses
            19 views
            0 likes
            Last Post Bob49
            by Bob49
             
            Started by Malik_demoacct, Today, 08:31 AM
            0 responses
            17 views
            0 likes
            Last Post Malik_demoacct  
            Working...
            X