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

Close all positions ONLY if stop rejected, NOT target rejected

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

    Close all positions ONLY if stop rejected, NOT target rejected

    I have a strategy that enters 3 separate entry orders per direction. I want the strategy to havethe following behavior:

    1. If ANY of the stoploss orders (one for each entry) gets rejected, I want the strategy to close down all trades and cancel any pending orders. I know that if I use RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose then this is what I get.

    However, I also want this:

    2. If a profit target order is rejected (since maybe price moved beyond that profit target already), then I want ONLY THAT ENTRY order to close at market. I want the strategy to keep running and have the two other entries still open.

    How can I do this?

    #2
    Hello westofpluto,

    Thanks for your post.

    You could place a Limit order for the profit target order so that the Limit orders will fill if the market price is better than the price of the Limit order.

    Let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      So, just to confirm, if I place a limit order to close a long trade, but when I place that limit order the price has already moved above the limit price, then the limit order will NOT be rejected. Instead it will fill at that new better price. Correct?

      So are there any circumstances in which a limit order (target order) would be rejected?

      Comment


        #4
        Hello westofpluto,

        Thanks for your note.

        Yes, that is correct. If a limit order is placed to close a long trade and the current market price is better than the limit order, the limit order will be filled.

        I am not sure what all the reasons are that could cause a Limit order to reject but there are certain moves you can make for certain types of orders where the order is on the wrong side of the market and gets rejected.

        Let us know if we may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        1 view
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        238 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        383 views
        1 like
        Last Post Gavini
        by Gavini
         
        Started by oviejo, Today, 12:28 AM
        0 responses
        1 view
        0 likes
        Last Post oviejo
        by oviejo
         
        Started by pechtri, 06-22-2023, 02:31 AM
        10 responses
        125 views
        0 likes
        Last Post Leeroy_Jenkins  
        Working...
        X