Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Opposing strategy entries

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

    Opposing strategy entries

    Hello,
    I was wondering if someone can explain to me what happens when you have one automated strategy active, say in a long position, and another strategy triggers which enters the opposite direction.
    For example, say I'm long natural gas from an algo, and another algo for a short position triggers. Obviously I can't be both long and short simultaneously on the same account, so my question is whether I simply end up flat, with the second entry cancelling the first and neither strategy active, or if the logic somehow recognizes I'm currently long, and enters two short contracts to establish the new position. I assume the former since I don't see any way each strat logic would be able to "see" that there is a pre-existing position.

    I am also curious what happens to any stops or targets -- again, say I'm long NG with both a stop and target in place, and then a short strategy triggers, which ALSO has a stop and target....assuming the second strategy puts me flat, are all of the stops and targets cancelled and removed as well? Or would these in fact still be sitting on the chart/exchange waiting to be filled? I'd hate to have an opposing strategy take me out, only to leave these to get filled....since they are OCO you'd then end up naked on fill and with no strategy logic to take you out either.

    Regards,

    Andrew

    #2
    Hi LightWeight,

    If one strategy is long 1 and another is short 1, your overall account position will be flat.

    The stop losses and profit targets will still be active for that order even if it is closed from another script.

    Below is a link to a video about the strategy position vs the account position.
    https://www.youtube.com/watch?v=US9c...A140D7&index=8
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Oh wow....so in theory if each strategy had a stop and target, you could possibly end up flat, but with four working orders on the chart (two stop orders and two limit orders)? Is there any way around that at all, outside of real time monitoring? I would expect that to be a rare occurrence, but the concern obviously is this happens when you're asleep or away, and you end up in the situation I described above. I suppose one option would be to have two different accounts, one for long only and one for short only, to avoid the conflict...then if they both triggered the profit/loss would obviously offset, but the strategy function would remain intact.

      Comment


        #4
        Hi LightWeight,

        While that would be correct, if the stop and targets were filled your account you account would still be flat. So it really wouldn't do any damage i don't think.

        You can choose to have two accounts so that you are short in one and long in the other.

        You could also use unsupported code to check your accounts position and decide whether to place the order.

        Below is unsupported code that can assist with that.
        Code:
        foreach (Account acct in Cbi.Globals.Accounts)
        {
        if (acct.Positions != null)
        {
        PositionCollection positions = acct.Positions;
        foreach (Position pos in positions)
        {
        Print(pos.Account.Name + " " + pos.Instrument + " " + pos.MarketPosition + " " + pos.Quantity + " " + pos.AvgPrice);
        }
        }
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by LightWeight View Post
          Hello,
          I was wondering if someone can explain to me what happens when you have one automated strategy active, say in a long position, and another strategy triggers which enters the opposite direction.
          For example, say I'm long natural gas from an algo, and another algo for a short position triggers. Obviously I can't be both long and short simultaneously on the same account, so my question is whether I simply end up flat, with the second entry cancelling the first and neither strategy active, or if the logic somehow recognizes I'm currently long, and enters two short contracts to establish the new position. I assume the former since I don't see any way each strat logic would be able to "see" that there is a pre-existing position.

          I am also curious what happens to any stops or targets -- again, say I'm long NG with both a stop and target in place, and then a short strategy triggers, which ALSO has a stop and target....assuming the second strategy puts me flat, are all of the stops and targets cancelled and removed as well? Or would these in fact still be sitting on the chart/exchange waiting to be filled? I'd hate to have an opposing strategy take me out, only to leave these to get filled....since they are OCO you'd then end up naked on fill and with no strategy logic to take you out either.

          Regards,

          Andrew
          You would not be naked. The other positions orders would act as stop/target, still OCO'd.

          Comment


            #6
            That's true, if both strategies are using stop and target. Some of my strats have neither, or some only have a stop, relying on the logic for exit, in which case there would still be issues. In that case it does seem like having two different accounts would be the best approach.

            Comment


              #7
              Originally posted by LightWeight View Post
              That's true, if both strategies are using stop and target. Some of my strats have neither, or some only have a stop, relying on the logic for exit, in which case there would still be issues. In that case it does seem like having two different accounts would be the best approach.
              Actually it will still make no difference. If there are no protective orders, then you will be flat with no orders sitting. If you have only stops, they will not be OCO'd as they are from different orders, so they will simply act as an entry and stop, albeit possibly pretty wide apart.

              Comment


                #8
                Yes, in the case that both strategies used the same trade management approach -- the problem is when I have one that say uses stop and target, and the opposing strategy which uses neither, or only stop -- then there is no even offset from the trade management side. Or say for example you have two strategies with no protection -- neither strategy knows you've been put flat, so the exit logic is still operating -- however you ARE flat, so presumably if the exit logic triggered to sell because it thought you were still long, it would actually put you back into the market short, and naked. The same is true say if you manually exit a strategy position -- the logic is still operating. The only way to shut it off I see is to actually disable the strategy and then re-enable it, which will force it to stay flat until the logic is also flat before making any further executions (if you have "wait until flat to execute" enabled).

                It's quite a rabbit hole to go down trying to plan for all the possible scenarios, but given that I do have strategies that trade long or short in the same instrument, I began to wonder what could happen if somehow they both triggered. Hopefully that's a pretty rare occurrence however.

                Comment


                  #9
                  Yes, this is definitely something to keep in mind.

                  So.. not a good idea to run two strategies on the same instrument on the same account.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by LightWeight View Post
                    Yes, in the case that both strategies used the same trade management approach -- the problem is when I have one that say uses stop and target, and the opposing strategy which uses neither, or only stop -- then there is no even offset from the trade management side. Or say for example you have two strategies with no protection -- neither strategy knows you've been put flat, so the exit logic is still operating -- however you ARE flat, so presumably if the exit logic triggered to sell because it thought you were still long, it would actually put you back into the market short, and naked. The same is true say if you manually exit a strategy position -- the logic is still operating. The only way to shut it off I see is to actually disable the strategy and then re-enable it, which will force it to stay flat until the logic is also flat before making any further executions (if you have "wait until flat to execute" enabled).

                    It's quite a rabbit hole to go down trying to plan for all the possible scenarios, but given that I do have strategies that trade long or short in the same instrument, I began to wonder what could happen if somehow they both triggered. Hopefully that's a pretty rare occurrence however.
                    Absolutely. If the two strategies have different trade management setups, this is a real possibility, so using 2 different accounts will be the correct thing to do here. Using one account is only viable if the 2 different strategies are using the same trade management method.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by cmtjoancolmenero, Yesterday, 03:58 PM
                    11 responses
                    39 views
                    0 likes
                    Last Post cmtjoancolmenero  
                    Started by FrazMann, Today, 11:21 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post FrazMann  
                    Started by geddyisodin, Yesterday, 05:20 AM
                    8 responses
                    52 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by DayTradingDEMON, Today, 09:28 AM
                    4 responses
                    27 views
                    0 likes
                    Last Post DayTradingDEMON  
                    Started by George21, Today, 10:07 AM
                    1 response
                    22 views
                    0 likes
                    Last Post NinjaTrader_ChristopherJ  
                    Working...
                    X