Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Live Trading a Basket of Stocks Questions

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

    Live Trading a Basket of Stocks Questions

    Hi,

    Hoping to ask for some guidance and pointers for trading a basket of instruments please... My end goal is to run a fully automated strategy that monitors and trades a basket of 250 stocks. Currently for backtesting I have created one strategy and then I have been using Strategy Analyzer against the instrument list (of 250 stocks) to test the strategy. This runs them one by one, however in order to live trade my understanding is that I need to hardcode the dataseries for each instrument into a single strategy. Some questions please:
    1. Is this understanding correct? are there any better or other options for live trading against a large volume of instruments? (e.g. could I open 250 chart windows, load each instrument onto its own chart and turn on the strategy? I think I read somewhere that some traders have multiple NT8 licenses - I'm not sure if they've got 5 machines running 50 windows each etc)
    2. Are there any examples you can point to to illustrate how to do this (even if 2-3 instruments, it'd be enough to get going from).
    3. To actually run the strategy with live trading, what is the high level process please? E.g. do I open 'Chart' and select a nominal instrument, then select my strategy? Presumably there'd be ~250 lines on a chart
    4. This may need to be a separate post on its own... when adding each of the instruments (stocks), is it possible to use 'Volume'(rather than time based seconds/minutes) and set different Volume levels per each of the 250 instruments? E.g. stock ABC I'd want to form bars for 1,000 volume, while stock DEF I'd want to form bars based on 5,000 volume - but both would be running from the same single strategy that's trading 250 stocks.

    Thanks in advance for any help or guidance you can provide.

    ChainsawDR

    #2
    Hello ChainsawDR,

    Thanks for your post.

    1. Is this understanding correct? are there any better or other options for live trading against a large volume of instruments? (e.g. could I open 250 chart windows, load each instrument onto its own chart and turn on the strategy? I think I read somewhere that some traders have multiple NT8 licenses - I'm not sure if they've got 5 machines running 50 windows each etc)
    No, you would not need to hard code the data series. When you run a live strategy you can run it two ways, one is by applying the strategy to a chart of the instrument, however having 250 charts would not likely be the best approach. The other way would be to apply the strategy to the strategy tab where it would not be associated with a chart. When using the strategy tab, you would need to specify the instrument, bars type and size and days to load.
    Reference: https://ninjatrader.com/support/help...t_strateg2.htm
    I couldn't address why other users have multiple licenses other than to suggest that they may have a VPS that runs their NinjaTrader production strategies and another license for home PC, allowing them to have their development and/or discretionary trading locally (would also need another login and another datafeed).

    2. Are there any examples you can point to to illustrate how to do this (even if 2-3 instruments, it'd be enough to get going from).
    You can create multi-instrument strategies if you wish and this then is where you would hard code the added data series. The coding must be different in a multi-instrument strategy so I would highly recommend a thorough review of the help guide here: https://ninjatrader.com/support/help...nstruments.htm You can see a simple example of a multi instrument strategy in your Ninjatrader with the strategy SampleMultiInstrument. This sample strategy, when applied to a chart of an instrument will use the chart instrument and will add the instrument "MSFT".

    3. To actually run the strategy with live trading, what is the high level process please? E.g. do I open 'Chart' and select a nominal instrument, then select my strategy? Presumably there'd be ~250 lines on a chart
    If you want to use a chart you can do that Or you can initiate from the strategy tab. Please see the help guide links:
    Reference: https://ninjatrader.com/support/help...strategies.htm

    4. This may need to be a separate post on its own... when adding each of the instruments (stocks), is it possible to use 'Volume'(rather than time based seconds/minutes) and set different Volume levels per each of the 250 instruments? E.g. stock ABC I'd want to form bars for 1,000 volume, while stock DEF I'd want to form bars based on 5,000 volume - but both would be running from the same single strategy that's trading 250 stocks.
    Yes, you absolutely can use any bar type you wish and each can be as different as you wish.

    To clarify a single strategy. When you create a strategy, that strategy original you created is never actually used. What happens is that when you apply the strategy the system creates a copy of that strategy and applies any of the parameters you have selected/changed from defaults when you apply the strategy to create a unique "Instance" of the strategy that is actually used. This is why you can run 250 copies of the same strategy where each of the 250 can be on different instruments and can have different parameters but they all use the logic you created.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you Paul, this is really helpful. A couple of clarifying questions please...
      1. Is my understanding correct that when you use Strategy Analyzer and select a list of (250) instruments, it copies it and runs 250 instances of the strategy, and when you live trade via the Strategy tab and select a list of (250) instruments, it similarly copies it and runs 250 instances (but this time live, not backtesting)?
      2. If I wanted to run a strategy against a 250 list of instruments, with 50 on 1000 volume, 100 on 2000 volume, and 100 on 5000 volume, am I correct in thinking the correct approach is to:
      A) specify a nominal bars type and size on the strategy page (e.g. 1min) which is effectively ignored... (and is there any code efficient bar to use, e.g. for a throwaway primary bar type is it better to use 1min, 5min etc or does it not matter?)
      B) within the strategy code, I add a secondary volume dataseries that is actually used by the strategy code.
      C) within the strategy code I add some form of list that maps the volume size per stock symbol that the secondary volume dataseries should use (e.g. a streamreader file which lists the 50 stocks to use Volume 1000, the 100 to use 1000 volume, the 100 to use 5000 volume)
      ... Or is there a more optimal method for specifying the Volume Bar size to use per stock within an instrument list?

      Thanks again for your help!

      ChainsawDR

      Comment


        #4
        Hello ChainsawDR,

        Thanks for your reply.

        1. Is my understanding correct that when you use Strategy Analyzer and select a list of (250) instruments, it copies it and runs 250 instances of the strategy, and when you live trade via the Strategy tab and select a list of (250) instruments, it similarly copies it and runs 250 instances (but this time live, not backtesting)?
        The strategy analyzer will process the strategy one instrument at a time, so no it would not create 250 simultaneous instances of the strategy.

        For live trading, in the strategy tab, to run all 250 at the same time you would have to create 250 instances which you do when you add a strategy to the strategy tab and specify the instrument/data series needed.

        2. If I wanted to run a strategy against a 250 list of instruments, with 50 on 1000 volume, 100 on 2000 volume, and 100 on 5000 volume, am I correct in thinking the correct approach is to:
        A) specify a nominal bars type and size on the strategy page (e.g. 1min) which is effectively ignored... (and is there any code efficient bar to use, e.g. for a throwaway primary bar type is it better to use 1min, 5min etc or does it not matter?)
        B) within the strategy code, I add a secondary volume dataseries that is actually used by the strategy code.
        C) within the strategy code I add some form of list that maps the volume size per stock symbol that the secondary volume dataseries should use (e.g. a streamreader file which lists the 50 stocks to use Volume 1000, the 100 to use 1000 volume, the 100 to use 5000 volume)
        ... Or is there a more optimal method for specifying the Volume Bar size to use per stock within an instrument list?
        Running 250 strategies at once will be taxing to your system so I would recommend not wasting any resources. It would be better for you to write your strategy to use the primary bar and not add further data series. You can specify volume bars as the primary series. To point (C), NinjaTrader does not support or recommend dynamically added dataseries and recommend that they be hard coded.

        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Thanks Paul. I think I’m almost there (thanks for your help and patience). As the ultimate objective is to run a strategy against a 250 list of instruments, with 50 on 1000 volume, 100 on 2000 volume, and 100 on 5000 volume. Based upon your feedback it sounds like the best way to achieve this is to split the single 250 list into three (50/100/100) and run three strategies with the primary data series set as 1000/2000/5000 respectively. In practice it’s not quite this clean so I’m still trying to understand if it’s possible to achieve via one strategy.

          Am I correct in thinking that to achieve the objective, by definition there must always be a secondary data series? (As picking a single size data series on the strategy window won’t work for all). If so I’m hoping that adding:

          Code:
          if (BarsInProgress == 0) return;
          will minimize the impact as much as possible, but please let me know if there are more effective methods.

          Regarding hardcoding a secondary series, would this approach be recommended:

          Code:
          protected override void OnStateChange()
          {
              if (State == State.Configure)
              {
                  // Add Volume Bars object - BarsInProgress index = 1 
          
          if (this = “ABC”) AddDataSeries(BarsPeriodType.Volume, 1000);
          
          if (this = “DEF”) AddDataSeries(BarsPeriodType.Volume, 2000);

          Comment


            #6
            Hello ChainsawDR,

            Thanks for your reply.

            Yes, you can take that approach.
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Good afternoon, please tell me, have you found the answer to your 3rd question? I am still only a beginner in this field, and I am very interested in learning how people solve certain problems. I often read news about promotions on the Best Penny Stocks website to then talk to people on forums about it and consider new things for me. It seems to me that only in practice we will be able to learn quickly and efficiently, and if we study only theory for a long time, then it will remain theory forever, and we will not be able to profit from it
              Last edited by OfericSchim; 05-18-2022, 09:22 AM.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Kaledus, Today, 01:29 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by frankthearm, Yesterday, 09:08 AM
              13 responses
              45 views
              0 likes
              Last Post frankthearm  
              Started by PaulMohn, Today, 12:36 PM
              2 responses
              16 views
              0 likes
              Last Post PaulMohn  
              Started by Conceptzx, 10-11-2022, 06:38 AM
              2 responses
              55 views
              0 likes
              Last Post PhillT
              by PhillT
               
              Started by yertle, Yesterday, 08:38 AM
              8 responses
              37 views
              0 likes
              Last Post ryjoga
              by ryjoga
               
              Working...
              X