Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enter long and short orders for multiple instruments in a single strategy

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

    Enter long and short orders for multiple instruments in a single strategy

    Hi there. I'm having some difficultly trying to implement an idea. Basically I've added over 100 ETF Instruments in my strategy. What I'm looking to do is every 5 bars or so:

    -Run calculations on all instruments in the strategy
    -Buy the top 5 instruments
    -Short the bottom 5 instruments

    For some reason, I get long 1 instrument and short 1 instrument, but I can't get long or short the 5 instruments.

    I am using the method call

    IOrder order = EnterLong(key, tradeSize, entrySignal);

    where:
    -key is the index value in the BarsArray
    -tradeSize is = 1
    -entrySignal = "ETF" + key + "-" + CurrentBar

    So the first one works, but in Visual Studio I can see that every method call to EnterLong after that returns null. Any ideas why?

    #2
    Sigh.... so after posting I remembered I can set TraceOrders to true and then was able to see that my EntriesPerDirection was equal to 1. After setting EntryHandling to UniqueEntries, it is now working.

    My apologies. Please feel free to bill me for my waste of bandwidth. :-)

    Comment


      #3
      No worries, great to hear it works for you now. All the best.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      67 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      36 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      60 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X