Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EntriesPerDirection in Multi-Instrument strategy

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

    EntriesPerDirection in Multi-Instrument strategy

    My strategy has the code within OnBarUpdate()


    Code:
    [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][COLOR=blue][FONT=Verdana]for[/FONT][/COLOR][COLOR=black][FONT=Verdana]([/FONT][/COLOR][COLOR=blue][FONT=Verdana]int[/FONT][/COLOR][COLOR=black][FONT=Verdana] i = [/FONT][/COLOR][COLOR=purple][FONT=Verdana]0[/FONT][/COLOR][COLOR=black][FONT=Verdana]; i < instruments; i++)[/FONT][/COLOR][/COLOR][/SIZE]
    [COLOR=#0000ff][SIZE=2][COLOR=#282828][FONT=Verdana] { [/FONT][/COLOR][/SIZE]
    [SIZE=2][COLOR=#282828][FONT=Verdana]  if(Positions[i].MarketPosition == MarketPosition.Flat)[/FONT][/COLOR][/SIZE]
    [SIZE=2][COLOR=#282828][FONT=Verdana]             EnterLong(i, shares,"MyStrategy LONG");[/FONT][/COLOR][/SIZE]
    [SIZE=2][COLOR=#282828][FONT=Verdana]  }[/FONT][/COLOR][/SIZE][/COLOR][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
    If I have EntriesPerDirection = 1, does this mean the long entry for only my first instrument will be executed?

    Or does it mean that only one long entry per instrument will be executed?

    [The above for NT 6.5]
    Last edited by AnotherTrader; 12-22-2010, 10:23 AM.

    #2
    Hello AnotherTrader,

    EntriesPerDirection is based on the signal name of the entries, and works closely with EntryHandling property.

    If set to 1 it only allows one entry per signal name with unique handling.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_RyanM View Post
      Hello AnotherTrader,

      EntriesPerDirection is based on the signal name of the entries, and works closely with EntryHandling property.

      If set to 1 it only allows one entry per signal name with unique handling.
      So, in my example, the only entry would be the long entry for my first instrument (i.e. the one with BarsInProgress = 0)?

      Comment


        #4
        Yes, that's correct. EntriesPerDirection is based on rules in the whole strategy, and not per instrument.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_RyanM View Post
          Yes, that's correct. EntriesPerDirection is based on rules in the whole strategy, and not per instrument.
          ... and so I guess if I set EntriesPerDirection equal to the number of instruments, then there could be an entry for each instrument?

          Comment


            #6
            That's one way to do it. You can also leave it at 1 but set EntryHandling to unique entries. You can then tag your entries as unique with something like this:


            for(int i = 0; i < instruments; i++)
            {
            if(Positions[i].MarketPosition == MarketPosition.Flat)
            EnterLong(i, shares,"MyStrategy LONG" + i);
            }
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Thanks! That worked really well.

              Comment


                #8
                Am continuing to work through this, and have the following code incorporated:

                Code:
                 
                for(int i = 0; i < instruments; i++)
                { 
                if(Positions[i].MarketPosition == MarketPosition.Flat)
                EnterLong(i, shares,"MyStrategy LONG" + i);
                }
                If I am working with daily bars for 3 instruments (so OnBarUpdate() gets evaluated for BarsInProgress = 0, 1 and 2), and if I evaluate the above code during BarsInProgress = 1, i.e. ...

                Code:
                 
                If(BarsInProgress == 1)
                {
                for(int i = 0; i < instruments; i++)
                { 
                if(Positions[i].MarketPosition == MarketPosition.Flat)
                EnterLong(i, shares,"MyStrategy LONG" + i);
                }
                }
                ... it seems that the entry happens on the same day for instruments 1 and 2, but on the next day for instrument BIP = 0 (I guess as OnBarUpdate() has already been evaluated for instrument BIP = 0?).

                Any suggestions as to how I can get instrument BIP = 0 to enter on the same day?

                Comment


                  #9
                  What are the three time frames you're using?
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_RyanM View Post
                    What are the three time frames you're using?
                    All instruments use just daily bars.

                    Comment


                      #11
                      Do you get better results when using if (BarsInProgress == 0) for your condition?

                      You also might want to try this in 7 as multi series strategies have changed since 6.5. I'm getting 3 entries on the same day with 7 using a similar setup.
                      Ryan M.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      580 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      336 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      102 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      554 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      552 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X