Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss and Reverse in Managed Approach

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

    SetStopLoss and Reverse in Managed Approach

    Hey guys,

    Question.. can you use SetStopLoss to reverse your position if it's hit while using the Managed Approach? Let's say if I set a Buy Stop Market order above a bar and SetStopLoss below that bar with a SetProfitTarget some distance away. Once the Long order is taken in, if it hits the SetStopLoss, it would automatically go into a Short with a new SetStopLoss and SetProfitTarget.
    Is this doable?

    #2
    Hello PN720,
    Thanks for your post.

    This is certainly doable. I have attached a sample that demonstrates how your SetStopLoss() and SetProfitTarget() methods will cancel and resubmit appropriately when switching positions like this. Just run the strategy and wait 5 bars for the strategy to switch positions. You should see the protective orders get canceled and new ones submitted with the new position.

    Help Guide - SetStopLoss()

    Let me know if you have any questions.
    Attached Files
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh,

      Thank you for the example.

      It seems to me that the orders will reverse if you are in a Long position and you EnterShort. However, my scenario would be if I'm entering with a Buy Stop and the order will reverse when the StopLoss is hit. How would I do that?

      Comment


        #4
        PN720,

        In my sample it is switching from long to short, and because of that the stop and target changes. (not the other way around). NinjaTrader is not going to reverse just because your stop loss is hit, unless you have specifically coded your logic that way.

        You would need to run some logic through OnExecutionUpdate to see if the stop loss was hit and then run your other logic. Here is a reference sample on how to track your orders using OnOrderUpdate() and OnExecutionUpdate(). You should be able to modify this sample to fit your needs.




        Josh G.NinjaTrader Customer Service

        Comment


          #5
          Josh,

          Just so I understand correctly, there's not an easy way without coding using the OnExecutionUpdate to detect if the Stop Loss has been hit and then submitting another order going the other way.
          The functionality I'm looking is how an ATM works currently if 'Reverse At Stop' is checked but I want to do it through a Strategy.

          Or if I'm on the Chart Trader and doing this manually, if I'm in a Long with 1 Contract and set a Sell Stop with 2 contracts so if it's hit, it will close out the current one and enter Short with the remaining 1 contract.

          Comment


            #6
            PN720,

            You are understanding correctly. You'll need to create the logic for that behavior to occur, and I believe OnExecution will be the place to start.

            Please let me know if you have any questions.
            Josh G.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            30 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            124 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            64 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            41 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            46 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X