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

ExitLongStopMarket cancelled on bar close??

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

    ExitLongStopMarket cancelled on bar close??

    Title says it all. Strategy builder is cancelling a stop market order on every bar close. Just wondering how this is fixed. Not sure if it is a setting somewhere or something that has to be hardcoded. I havent seen anything throughout the strategy builder with a setting like this.

    #2
    Hello Plzwork123,

    Thanks for your post.

    This would be the expected behavior of this order type running under the Managed Approach which is what the Strategy builder runs under. This type order is automatically canceled if not filled on the bar that it is submitted. You can read about the Managed approach on this page: https://ninjatrader.com/support/help...d_approach.htm

    To continue using the order, you would need to resubmit the order on each bar until the exit order is filled or no longer needed. One approach to this would be to create a set that checks to see if you are in a short (or long) market position. The action then would be to submit the exit order. This would continue to submit on each bar the exit order until it is filled or you are no longer in a position. Here is a link to the strategy builder condition builder on market position: https://ninjatrader.com/support/help...ionComparisons


    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Well I was running this strategy on price change. Is there a way to implement this on price change? I'm not really seeing a simple way for that.

      Comment


        #4
        Hello Plzwork123,

        Thanks for your reply.

        With regard to OnPriceChange, you should still be able to do this:

        "To continue using the order, you would need to resubmit the order on each bar until the exit order is filled or no longer needed. One approach to this would be to create a set that checks to see if you are in a short (or long) market position. The action then would be to submit the exit order. This would continue to submit on each bar the exit order until it is filled or you are no longer in a position. Here is a link to the strategy builder condition builder on market position: https://ninjatrader.com/support/help...ionComparisons".

        I've attached a demonstration example you can apply to real-time or market replay data. On the first realtime tick it will place a long market order and when filled an exitlongstopmarket type order is applied and maintained as described above.

        ExitLongStopMarketExample.zip
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Ok so it will just be resetting the stop every price change (which is a lot haha). I see now. Thank you for the help.

          Comment


            #6
            Hello Plzwork123,

            Thanks for your reply.

            You can modify that example to only once per bar by creating an int variable and in the conditions of that set, check that the int variable is NOT equal to Misc>CurrentBar. then in the actions set the variable to be the Misc>Current bar. This will give you a once per bar action for that or any other set where you only want one action per bar.
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by egordleo, Today, 05:50 AM
            0 responses
            4 views
            0 likes
            Last Post egordleo  
            Started by kevinenergy, 02-17-2023, 12:42 PM
            118 responses
            2,778 views
            1 like
            Last Post kevinenergy  
            Started by briansaul, Today, 05:31 AM
            0 responses
            9 views
            0 likes
            Last Post briansaul  
            Started by fwendolynlpxz, Today, 05:19 AM
            0 responses
            4 views
            0 likes
            Last Post fwendolynlpxz  
            Started by traderqz, Yesterday, 12:06 AM
            11 responses
            28 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X