Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple Strategies with same instrument

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

    Multiple Strategies with same instrument

    I am trying to run multiple strategies on the same instrument on NT8.
    On both strategies, I have Start behavior set to "Immediately submit".
    When enabling the strategies, the conditions are such that both strategies should enter their own short positions.

    Both strategies have code that will print when the entry conditions are met.
    I can see the entry conditions are met on both strategies, but only the first one that I Enable will trigger an order.

    Psuedo code, similar in both strategies:
    If (entry conditions are met)
    {
    Print("Enter Short " + Time[0].ToString());
    EnterShort(Convert.ToInt32(PosSize), "");
    }

    Review the Output window for Strategy 1 (the first strategy I enable):
    Enter Short 11:28:27
    Enabling NinjaScript strategy 'Strat1/106813811' : On starting a real-time strategy - StartBehavior=ImmediatelySubmit EntryHandling=All entries EntriesPerDirection=2 StopTargetHandling=By strategy position ErrorHandling=Stop strategy, cancel orders, close positions ExitOnSessionClose=False SetOrderQuantityBy=Strategy ConnectionLossHandling=Recalculate DisconnectDelaySeconds=10 CancelEntriesOnStrategyDisable=False CancelExitsOnStrategyDisable=False Calculate=On each tick IsUnmanaged=False MaxRestarts=4 in 5 minutes

    NinjaScript strategy 'Strat1/xxxxxxxxx' submitting order


    When I enable strategy 2, I get the exact same text in the output window, except it does contain the "submitting order" output.

    The result on the Strategies tab in the Control Center is:
    Strategy 1: Position: 100s, Account Position, 100s
    Strategy 2: Position: 300s, Account Position, 100s

    The result I'm trying to achieve is Account Position 400s; both strategies submit their own orders.

    I've read many threads on this and seems like the answers vary widely. Any suggestions are appreciated.

    #2
    Hello DividedSky,

    It looks like the second strategy is in a historical position, meaning had you started the strategy earlier, it would have taken a position.

    If you place the following under OnBarUpdate within strategy 2’s code,

    Code:
    if(State ==State.Historical) return;
    Does the second strategy put you were you expect?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_AlanP View Post
      Hello DividedSky,

      It looks like the second strategy is in a historical position, meaning had you started the strategy earlier, it would have taken a position.

      If you place the following under OnBarUpdate within strategy 2’s code,

      Code:
      if(State ==State.Historical) return;
      Does the second strategy put you were you expect?

      I look forward to your reply.
      It seems to be working with a quick test! thank you!

      I need to test it more and will let you know of i have any more questions. (can't test today because of work).

      Thanks!

      Comment


        #4
        While this is working, it leaves me wondering why it is necessary.
        Both strategies are in historical positions. Both strategies are set to Immediately submit.
        No matter what order I turn them on, only the first one submits an order... if I'm not using the workaround provided, if(State ==State.Historical) return;
        Position = Flat
        Turn on Strat2, it submits an order.
        Turn on Strat1, it prints that my entry criteria is met, but does not submit.

        Flatten, retest in opposite order.
        Turn on Strat1, it submits order. Strat2 does not.

        I thought the whole point of "Immediately Submit" is that it will join a historical trade if necessary.
        I can't justify in my head why ignoring Historical would fix this or why it is necessary. Thoughts?

        Comment


          #5
          Hello DividedSky,

          Could you please send an email to platformsupport[at]ninjatrader[dot]com with Attn: Alan P in the Subject line. Also within the email please include a link to this thread, and attach the log and trace files for the day in subject which you can find in My Documents>NinjaTrader8>Log and My Documents>NinjaTrader8/Trace folders.

          I look forward to your email.
          Alan P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by gbajaj, Today, 03:35 PM
          2 responses
          7 views
          0 likes
          Last Post gbajaj
          by gbajaj
           
          Started by space_trader, Today, 03:19 PM
          2 responses
          8 views
          0 likes
          Last Post space_trader  
          Started by max1ci6, Today, 02:02 AM
          4 responses
          27 views
          0 likes
          Last Post joromero  
          Started by Johnny, Today, 02:38 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Tyler  
          Started by M_ichel, Today, 02:26 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Tyler  
          Working...
          X