Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to data for multiple stocks into one OnBarUpdate() eventHandler

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

    how to data for multiple stocks into one OnBarUpdate() eventHandler

    if I create a strategy that requires multiple to stocks how do I submit multiple to stock to pull for into my OnBarUpdate() eventHandler. I would like this to dynamic and not not static where I have to select my stocks at design time (hard coded)...I'd like to be able to select a list of stocks and have them ALL submitted to my strategy not individually.

    #2
    Hi d.allen101,

    You can see a sample Multi instrument strategy through Tools > Edit NinjaScript > Strategy > Sample MultiTime Frame.

    We support only hard coding additional instruments in Initialize() with a separate Add statement for each instrument.

    Orders are submitted to a specific BarsInProgress using the advanced signature available for all order methods. To submit to all series at once, you could loop through.

    Below is the advanced signature for EnterLong()

    EnterLong(int barsInProgressIndex, int quantity, string signalName)
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      ok I understand the code, so how is this run? I assume since I've 'added' the stocks I want to follow within the Initialize() there's no need to create a chart to added my strategy to. How do i run this?

      Comment


        #4
        Right, it's not necessary to chart the added series. You can run from either a chart or strategy tab of control center. See this link for more information on running NinjaScript strategies:
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          is it realistic to add 100 or more stocks like this? I was thinking about adding 100 stocks and moving the calculations to a class which would process quote and indicator data from OnBarUpdate() on another thread?

          is this the correct way to go about this?

          Comment


            #6
            You're welcome to try it but this level of advanced coding is beyond our scope of support. You can look into default pivots indicator for some ideas loading async.
            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
            666 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            377 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            110 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            575 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            580 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X