Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Running Same strategy on different Instruments - odd result

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

    Running Same strategy on different Instruments - odd result

    Hi,

    I have a strategy that I wrote that I use on more than one instrument and I have odd results during testing.
    It is an automated strategy and is using a SIM account, but what I have seen is that the code which prints
    some Debug data does not track the debug output if two instruments are in a trade at the same time.

    Is there a known issue with running a single strategy on more than one instrument at a time? All my signals
    are timestamped and the trades are not entered at the same time. If this is a known issue then I can adjust
    so that I have copies of the same strategy for each instrument. Seems a waste to do that though.

    Thanks.

    #2
    Hello ATMtrader0001,

    When you say that the debug data does not track the debug output at the same time what specifically do you mean?

    Multiple instruments won't have exactly the same data events at the same intervals, they are individual markets. Using identical logic on two different instruments in realtime could result in your conditions becoming true at different times as each individual market has its own updates. The fills could also be at different times depending on the market.


    JesseNinjaTrader Customer Service

    Comment


      #3
      So, for example at the close of a bar I will print some statistics for that bar for the instrument in question.

      What happens when I am in a trade for more than one instrument is that I only get the debug data for one of the trades.
      I get nothing on the other. I'll be more mindful if timing plays a part in which one on which I get the data.

      Comment


        #4
        Hello ATMtrader0001,

        Two strategies of the same type on separate instruments will not conflict with each other. Based on the details it sounds like either one of the strategies did not have its condition become true at the same time or your prints need to be adjusted. Without seeing what you coded it would be difficult to say however I can say that you should in general have unique results per instrument meaning that they won't identically match because each market has its own individual trades that drive the market.

        JesseNinjaTrader Customer Service

        Comment


          #5
          I can't recreate it without actually placing multiple orders through the strategy.

          However it did do it this AM during the EU Opening hours. I was in a trade on one instrument and I was getting a reference of the Close[0] for the
          other instrument.

          I am using Close[0] in my code. Then after one exited the trade I was getting Debug that it was calling a Exit on the other trade, but that trade continued.
          I added additional code to include the instrument name. It just seems the Code is not getting the information correctly.

          Can I call InstrumentName.Close[0]?

          Comment


            #6
            Hello ATMtrader0001,

            Are you using a multi instrument strategy where you have used AddDataSeries in its code? A strategy can only manage positions that it creates. If you have not made a multi instrument strategy then it can only submit trades to or close positions on the primary instrument that you applied it to. We would need more specific details about what you coded to be able to provide more direct answers here.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Here is how I have it setup.

              1) I created a Strategy
              2) In the Strategies Tab I created a New Strategy for trading Crude Oil using the strategy in Step 1
              3) In the Strategies Tab I created a New Strategy for trading Natural Gas using the strategy in Step 1

              In the output window I was seeing inconsistencies with the data seeming to show Crude Oil data when both were in a trade at the same time.

              It is infrequent when it happens as I am rarely in a trade in both at the same time, but when it does I get odd results.

              Comment


                #8
                Hello ATMtrader0001,

                As mentioned two strategies that are applied separately on two different instruments cannot conflict with each other In this case you would need to provide more specific detail on what problem you are seeing in regard to the output and what you are trying in the code.

                JesseNinjaTrader Customer Service

                Comment


                  #9
                  I would like to give you more information, but this happens so infrequently and I don't always capture the logs.

                  I'll change to write the logs to a text file.

                  Comment


                    #10
                    Hello ATMtrader0001,

                    You can do that however the logs by themself won't mean anything to me as I don't know what you are trying in the code. If you find an example you will need to extract the part of code that is related to the log so we can see what you are doing in code in comparison to the print. We would also need to know what the expectation was vs what you see is wrong.
                    JesseNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by JoMoon2024, Today, 06:56 AM
                    0 responses
                    6 views
                    0 likes
                    Last Post JoMoon2024  
                    Started by Haiasi, 04-25-2024, 06:53 PM
                    2 responses
                    17 views
                    0 likes
                    Last Post Massinisa  
                    Started by Creamers, Today, 05:32 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post Creamers  
                    Started by Segwin, 05-07-2018, 02:15 PM
                    12 responses
                    1,786 views
                    0 likes
                    Last Post Leafcutter  
                    Started by poplagelu, Today, 05:00 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post poplagelu  
                    Working...
                    X