Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sample using Multi-Instruments in strategy

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

    #16
    Hello MGHORBEL,

    Please try using 4 as the entries per direction when you apply the strategy or using UniqueEntries for the EntryHandling mode. If you are trading multiple entries in the same direction you will need to increase the entries per direction to match what you want to allow.

    Comment


      #17
      Hello Jesse
      I added as you recommended but nothing changes.
      I tested the code on another connection and it works.

      Comment


        #18
        The code used is in the attached file.
        Attached Files

        Comment


          #19
          Hello MGHORBEL,

          I am not certain I follow, you mentioned that you now see the code working are you just sharing what you used or did you still have a question? The code provided works for me to produce 4 entries for the 4 instruments being used.

          Comment


            #20
            Hello Jesse

            I used shared file on my PC, it doesn't work.

            I tried a web server and it works well.

            I don't know why but it works

            Click image for larger version

Name:	image.png
Views:	65
Size:	55.8 KB
ID:	1294649
            Last edited by MGHORBEL; 03-07-2024, 07:50 AM.

            Comment


              #21
              Hello MGHORBEL,

              Are you using the same version of NinjaTrader and the same connection on both PC's?

              Comment


                #22
                Yes I use the same version of NinjaTrader and the same connection on both PC's. The connection is not used in same time.

                Click image for larger version  Name:	image.png Views:	0 Size:	15.9 KB ID:	1294724
                Last edited by MGHORBEL; 03-07-2024, 11:15 AM.

                Comment


                  #23
                  Hello MGHORBEL,

                  Are you doing the exact same test with the same primary instrument being used? If any of the series are duplicated meaning if you use a primary that is also being added as secondary that will change how the Positions collection reports, you would need 4 different instruments for that test to show a position on each bars in progress.

                  Comment


                    #24
                    Hello Jesse
                    I performed the exact same test with the same main instrument used.
                    I used 4 different instruments.​

                    Comment


                      #25
                      Hello MGHORBEL,

                      In that case I would not be certain what would cause a difference, the code that was provided is working correctly when I test it on my end. You can try using TraceOrders to check if the orders are being ignored for some reason.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by NullPointStrategies, Yesterday, 05:17 AM
                      0 responses
                      75 views
                      0 likes
                      Last Post NullPointStrategies  
                      Started by argusthome, 03-08-2026, 10:06 AM
                      0 responses
                      146 views
                      0 likes
                      Last Post argusthome  
                      Started by NabilKhattabi, 03-06-2026, 11:18 AM
                      0 responses
                      79 views
                      0 likes
                      Last Post NabilKhattabi  
                      Started by Deep42, 03-06-2026, 12:28 AM
                      0 responses
                      50 views
                      0 likes
                      Last Post Deep42
                      by Deep42
                       
                      Started by TheRealMorford, 03-05-2026, 06:15 PM
                      0 responses
                      54 views
                      0 likes
                      Last Post TheRealMorford  
                      Working...
                      X