Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Set Stop Order with ExitOnClose=true

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

    Set Stop Order with ExitOnClose=true

    Hi,

    is there any possibility how to setup stop order like EnterLongStop() at the end of the day and have ExitOnClose enabled?

    Let's say that I would like NinjaTrader to manage my entered positions to exit on close, but also I would like to set stop order overnight (at market close) so I can trigger position if market opens with gap. I assume that TimeInForce = Cbi.TimeInForce.Gtc should do the work, but it doesn't. So is there any way how to reach this funcionality?

    Thank
    Dalibor

    #2
    You would have to use custom tracking/logic checks to have this functionality.

    Likely you'll need to make ExitOnClose = false, but add a position check at a time. If the position is not flat at that time, close position.





    Let me know if I can be of further assistance.
    LanceNinjaTrader Customer Service

    Comment


      #3
      I know about that solution, but this is not exactly what I need. If I call ExitLong at the last bar of session, the NinjaTrader will close the position at next session open (because the market is already closed). So this will work only if I exit position at the bar before last.

      But is this really the only solution? I would rather reach my funcionality by Gtc, because this is supposed to be for that.

      Regards
      Dalibor

      Comment


        #4
        When exit on close is called it sends a signal that can be picked up in OnExecution()


        You potentially could add some advanced order management to resubmit the entry order, however I have not tested this.

        Alterntatively you could set COBC = false, and close out at the specific time.

        You can use FirstTickOfBar to process logic as if COB = true


        Let me know if I can further assist.
        LanceNinjaTrader Customer Service

        Comment


          #5
          Hi Lance,

          I don't know what the COBC is and I can't find any documentation about that. To use FirstTickOfBar I need tick bars and also backtesting will be slow.

          But I found that manage exit by myself should work fine for me. Also extending trading session of one bar before regular open should do the work too.

          But my point, if there are two features in NinjaTrader for that, why neither one doesn't work? TimeInForce.Gtc should work overnight (TimeInForce.Day is where I suppose my order to be cancelled at session close), also there is liveUntilCancelled for stop/limit orders. But none of them work as it is supposed, because ExitOnClose force their funcionality, so in the end TimeInForce.Gtc and liveUntilCancelled are actually useless in NinjaTrader, if you would like to benefit from ExitOnClose. It would be nice to be able setup if ExitOnClose is applied to position, order, or to both.

          Regards
          Dalibor

          Comment


            #6
            Hi dalisdj

            Thanks for your note.

            Below is a link to CalculateOnBarClose (COBC).
            http://www.ninjatrader.com/support/h...onbarclose.htm

            Regarding the ExitOnClose, this setting really is for use when you are ok with closing all positions at the session close. If you would like any orders to remain open after the session close, this would be set to false and any orders that you would like to close at the end of the session you should exit manually by adding a time clause to your script.

            The time in force as good till cancelled is also affected by the ExitOnClose. If you would like orders to remain open after the session is closed you would need to set ExitOnClose to false as well as the time in force to gtc. Setting this to day would exit at the end of the day and not the end of the session.

            Regarding the LiveUntilCancelled this is actually to keep a limit order from being cancelled if the order has not been filled by the next bar. These are only valid until ExitOnClose is called or the TIF being day is hit.

            Please let me know if this does not resolve your inquiry.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea, that explain.

              Thanks

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by cmtjoancolmenero, Yesterday, 03:58 PM
              6 responses
              28 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by gbourque, Today, 06:39 AM
              2 responses
              14 views
              0 likes
              Last Post gbourque  
              Started by rexsole, Today, 08:39 AM
              0 responses
              4 views
              0 likes
              Last Post rexsole
              by rexsole
               
              Started by trilliantrader, Yesterday, 03:01 PM
              3 responses
              31 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Started by Brevo, Today, 01:45 AM
              1 response
              14 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X