Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Questions regarding multi-day, multi instrument capability

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

    Questions regarding multi-day, multi instrument capability

    Hello Ninja Experts,

    I have a few questions im hoping you can help me with regarding strategy development, and the capabilities of ninja trader. First, I have developed a working strategy in a different toolset, for simplicity lets just say it is a moving average crossover strategy. The strategy typically holds individual positions for 2-10 days and makes a few hundred trades per year.

    My goal is to port this to NT for autotrading, and ive been doing quite a bit of research on whether or not this is achievable. First, I have already ported the basic ruleset successfully into a strategy in NT, and when I back test against an individual instrument my results are consistent. However, here are the questions I am concerned about:

    1. Fundamentally, my strategy needs to run against several hundred stocks each day. Ideally, the Russel 1000 for example. I have read the multi instrument - multi timeframe informatoin, but my question is, can NT effectively run a strategy against such a large group of instruments from a performance and complexity perspective?

    2. Since my strategy runs against daily bars and usually holds the position for multiple days, I need NT to "keep state" overnight or at least be able to pick up where it left off the next day. Is management of a multi-day strategy possible with NT?

    3. Position sizing and trade management -- I have implemented a basic position sizing strategy in my strategy that uses a % of account balance for each trade. My question is, given point one above, is NT going to be able to effectively manage position sizing and trade management when i scale my strategy to multiple overnight trades daily?


    I think these are my core questions at this point. While i have my core strategy ported and work nicely at this point, taking it to the next level via multi-instrument support is not going to be easy. I'd like to have a sense of whether what I am trying to achieve is reasonable and possible with this toolset before investing substantially more time.

    If there is another approach you would recommend (for example, run the scan separately and then just run individual per-instrument strategy instances, although #2 would still be an issue), please let me know.

    Thanks in advance for your help and guidance!

    br

    #2
    follow up

    One quick follow up also-

    I ran my strategy against a single instrument that would currently have an open position. I was expecting the strategy to "assume" that a position was open and manage it. It did generate a stop loss order when i started it up (even though the position would already have been open for three days), but it didnt show any open positions on the positions tab. Am i missing something here?

    Comment


      #3
      1. Technically speaking it can do it. The concern is if your data provider will offer you streaming data on all of those instruments simultaneously along with if your PC is powerful enough to run calculations on every single incoming tick of every single instrument.

      2. It is provided it is coded properly with features like ExitOnClose set to false.

      3. NT does not necessarily handle "overnight" trades. What it does is process trades at the open of the next day when data starts flowing again.

      4. When you start up a strategy it will generates what is known as a strategy position. This position is not shown in the positions tab until it becomes a real position.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Great

        Thanks for your response -- very helpful. Couple of follow up questions:

        1. Since my strategy executes of daily bars, im not sure that the ability to process tick data will be an issue? I would like to also layer in processing of minute bars to handle the stop strategy at some point. Would you anticipate this would pose much of a problem?

        2. Lets say i want to add the entire russel 1000 to my strategy - do you have a recommendation on how to do this? Seems tedious to type in 1000 'add' lines. Can i read the symbols in from a text file at run time? or from a DB? Just looking for guidance on the best approach here...

        3. You said a strategy wont show the open positions until they are real...What makes them real? What if they were already held in my account prior to the strategy start up? What im trying to ensure is that the strategy will pick up where it left off if i have to restart it for some reason.

        Thanks again

        Comment


          #5
          1. It is doable. From a performance standpoint please ensure you are running on a machine that is as strong as possible since you will be running lots of data and lots of calculations.

          2. Unfortunately the only supported way is via Add() lines.

          3. This article should provide more insight: http://www.ninjatrader-support2.com/...ead.php?t=4033
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Thanks again for getting back to me. I wanted to provide a couple of updates and points of clarification:


            1) I believe i can programatically load the symbol list and iterate through it, adding each symbol. I havent tried it yet, but i saw soimeone else said they used this approach. Much better and more flexible than typing in 1000 lines.


            2) When i run a strategy that has an open position, most of the time it will not execute in a way that it recognizes it has a position open. Obviously, this is brutal, in that it makes it very difficult to recover from a restart. I found one way that it will work -- and that is to run the strategy from a chart. Unfortunately, this doesnt scale well if you are trying to scan 500 or 1000 stocks. It is silly that i can't just run the strategy and have it automatically figure out what positions are open (maybe by setting a start execution date). This is a real problem with the product when it comes to multi-day strategies.

            Comment


              #7
              1. You can definitely try it, but we cannot offer support for it.

              2. Not sure what you mean. Running a strategy from a chart or the Strategies tab is the same thing. Both start with virtual strategy positions and then continue along making trades as they deem necessary. If you start a strategy and it determines it is long, it holds on to this virtual long no matter where you start the strategy from. It just may be harder to get feedback on this from a strategy started in the strategies tab.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Hi,

                With regard to #2, please see this post:



                I have been wrestling for a couple of days with the fact that my strategies, when started from the strategy tab, would not consistently open the positions that should have already been opened. Sometimes it would, but mostly not. No rhyme or reason to it...(as far as i can tell)

                The thread above discusses the same problem -- and gave me the idea to try running the strategy from the chart. When i run the exact same strategy from the chart with the exact same parameters, it opens the position properly. I do know how to check what a strategy has done when running it from the strategy tab.

                If i'm missing something, let me know. I really, REALLY need to be able to run the strategy from the strategy tab and have it properly open the simulated positions it should open.

                Thanks for your help...

                Comment


                  #9
                  Not sure I follow. NinjaTrader NEVER converts virtual positions to real positions. It maintains it as a virtual position and then proceeds into live trades afterwards. Of course you won't see anything.

                  It is imperative to understand the difference between a strategy's virtual position and an account position. http://www.ninjatrader-support2.com/...ead.php?t=4033 You need to either manually sync them or have NT wait until the strategy reaches a flat state before submitting live orders. Tools->Options->Strategies->NinjaScript->Wait until flat before executing live
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Josh,

                    I guess i am not being clear -- my apologies. My specific problem is that NT is not properly opening my virtual positions when i start a strategy from the strategy tab. Obviously, if it doesn't properly open the virtual positions, it will not properly manage them from that point forward.

                    This is critical for a multi-day strategy because there will be times when a restart has to happen (for one of a thousand reasons), and I need the strategy to calculate what positions are open, open them virtually, and then manage them properly to closure.

                    I have found that if I run the strategy from a chart, it does properly calculate the open virtual positions. I got that idea from the other thread i sent you, so someone else experienced the same/similar problem.

                    I don't understand the underlying cause -- but it seems fundamental and is almost a deal breaker for any strategy that is multi-day.

                    It seems so basic that I'm hoping there is a work-around, or an appropriate way to do this so it works properly.

                    In my case, some of the positions that should be "opened virtually" are only a few days old -- and yet NT does not recognize and open them properly when launching the strategy from the strategies tab.

                    Thanks again for your help!

                    Comment


                      #11
                      How are you concluding it does not see your virtual position? Have you tried printing to the Output Window to see what the strategy thinks its position is?

                      Print(Position.MarketPosition.ToString() + " " + Position.Quantity.ToString());
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        Hi Josh,

                        I will try that. I need to see why sometimes it is entering the position correctly, and other times not.

                        One thing i just noticed is that with "Exit on Close" set to true, it seems to reflect the position in the stragey performance history, but not in the strategy tab.

                        let me test it some more tonight and get back to you....thanks for your assistance.

                        regards
                        brandon

                        Comment


                          #13
                          Virtual positions are not visible anywhere on the strategies tab. Exit on Close means it will close out some trades and so performance wise you will see the trades.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            Just FYI, to see the "virtual positions" i was right clicking on the running strategy, then going to "see performance", historical and real time. There, I can see if a trade has been entered into and is still open.

                            Thanks

                            Comment


                              #15
                              Right, but that is not on the strategies tab. I will need information on how you are discerning that a strategy from a chart has a virtual position, but the same strategy from the strategies tab has no virtual position.

                              Provided you load the same amount of data for both the chart and strategies tab, you should find no difference.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              581 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              338 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 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