Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetTrailStop Coexists with ExitLimit?

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

    SetTrailStop Coexists with ExitLimit?

    Hello fellow traders,

    I'm developing a strategy myself, where I try to use ExitLimit order to eliminate slippage, while use a TrailStop in case the ExitLimit order never get filled. Backtesting shows that the ExitLimit never get executed but positions always exit with TrailStop. If I remove the TrailStop from the script, the ExitLimit orders get filled.

    I wonder if it is a rule in NinjaScript that SetTrailStop could not coexist with ExitLimit. If this is the case, what could I do to achieve my intention?

    Thanks in advance.

    #2
    Hello,

    Thank you for the question.

    This would actually be expected when using the Managed Approach. NinjaTrader has some internal handing rules for the orders when using the Managed Approach. You can find the rules here: http://ninjatrader.com/support/helpG...hlightsub=exit

    In the rules section, there is this section:
    Methods that generate orders to exit a position will be ignored if:
    A position is open and an order submitted by a set method (SetStopLoss() for example) is active

    So in this case, the Exit would be ignored based on the SetTrailStop stop order being active.

    Instead of using Exit you could just adjust the existing TrailStop to Exit the position. You can call SetTrailStop instead in the condition where you are exiting and supply a price that would close the position.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,

      I replaced the ExitLimit with Exit() and it seems both the Exit and SetTrail work together. That solved part of my problem, thank you for the heads up. I still seek if I could use ExitLimit() with codes that mimic SetTrail function if that's possible.

      Pseudo code:
      if condition1 exitlimit();
      else if condition2 exit();

      wherein condition2 mimics SetTrail(). That would solve the problem completely, wouldn't it?
      Any idea?

      Thanks.

      Comment


        #4
        Hello,

        You do not absolutely have to use SetTrailStop for a trailing stop.

        Regarding the way you submit orders, if your condition 2 becomes true and remains true over a period of time or multiple bars, you could submit a Limit order over and over to act as a stop. If you call the EnterShortLimit or EnterLongLimit in the condition that becomes true on each bar, it will update the existing order with a new price you supply.

        This means that you can adjust the price for the order if needed which would basically make it a trailing stop.

        Using Logic, you can reproduce most of the logic you would find in SetTrailStop or any of the other specialized order types in the script. it really just depends on what needs to happen in the script for what you will need to use, NinjaTrader is pretty flexible in the way it allows you to submit orders so there are usually a few different ways you could accomplish the task at hand.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thank you Jesse. I will cook my codes and see how they hold up.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by XXtrader, Yesterday, 11:30 PM
          2 responses
          11 views
          0 likes
          Last Post XXtrader  
          Started by Waxavi, Today, 02:10 AM
          0 responses
          6 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Started by TradeForge, Today, 02:09 AM
          0 responses
          11 views
          0 likes
          Last Post TradeForge  
          Started by Waxavi, Today, 02:00 AM
          0 responses
          2 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Started by elirion, Today, 01:36 AM
          0 responses
          7 views
          0 likes
          Last Post elirion
          by elirion
           
          Working...
          X