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

Strategy parallel executions

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

    Strategy parallel executions

    Hello,

    I run multiple strategy and write informations about it to log.

    I see, that Ninja call OnBarUpdate calls serially, not in parallel.
    Is that true?

    Exists way how enable parallel OnBarUpdate calling?
    Or will be support it NinjaTrader 8?

    Thanks Petr


    Ninja call strategy 2, after it 102, 101 and 1... Serially...
    19-05-2015 13:29:00.4983562,[19-05-2015 - 13:29:00] 1 - before OnBarUpdate()
    19-05-2015 13:29:00.5139066,[19-05-2015 - 13:29:00] 1 - after OnBarUpdate()
    19-05-2015 13:30:06.9839168,[19-05-2015 - 13:30:00] 2 - before OnBarUpdate()
    19-05-2015 13:30:06.9839168,[19-05-2015 - 13:30:00] 2 - before OandaAccountApi.GetOrder
    19-05-2015 13:30:06.9839168,[19-05-2015 - 13:30:00] 2 - after OandaAccountApi.GetOrder
    19-05-2015 13:30:06.9995395,[19-05-2015 - 13:30:00] 2 - before OandaAccountApi.IsFlatPosition
    19-05-2015 13:30:07.0307911,[19-05-2015 - 13:30:00] 2 - before OandaAccountApi.CreateMar****rder
    19-05-2015 13:30:07.9214244,[19-05-2015 - 13:30:00] 2 - after OandaAccountApi.CreateMar****rder
    19-05-2015 13:30:07.9214244,[19-05-2015 - 13:30:00] 2 - after all
    19-05-2015 13:30:07.9214244,[19-05-2015 - 13:30:00] 2 - after OnBarUpdate()
    19-05-2015 13:30:07.9214244,[19-05-2015 - 13:30:00] 102 - before OnBarUpdate()
    19-05-2015 13:30:07.9214244,[19-05-2015 - 13:30:00] 102 - before OandaStrategyApi.GetOrder
    19-05-2015 13:30:07.9526899,[19-05-2015 - 13:30:00] 102 - after OandaStrategyApi.GetOrder
    19-05-2015 13:30:07.9526899,[19-05-2015 - 13:30:00] 102 - before OandaStrategyApi.IsFlatPosition
    19-05-2015 13:30:08.0933007,[19-05-2015 - 13:30:00] 102 - before OandaStrategyApi.CreateMar****rder
    19-05-2015 13:30:09.2295005,[19-05-2015 - 13:30:00] 102 - after OandaStrategyApi.CreateMar****rder
    19-05-2015 13:30:09.2295005,[19-05-2015 - 13:30:00] 102 - after all
    19-05-2015 13:30:09.2295005,[19-05-2015 - 13:30:00] 102 - after OnBarUpdate()
    19-05-2015 13:30:09.2428218,[19-05-2015 - 13:30:00] 101 - before OnBarUpdate()
    19-05-2015 13:30:09.2428218,[19-05-2015 - 13:30:00] 101 - before OandaStrategyApi.IsFlatPosition
    19-05-2015 13:30:09.2662981,[19-05-2015 - 13:30:00] 101 - before OandaStrategyApi.GetOrder
    19-05-2015 13:30:09.3020144,[19-05-2015 - 13:30:00] 101 - after OandaStrategyApi.GetOrder
    19-05-2015 13:30:09.3020144,[19-05-2015 - 13:30:00] 101 - before OandaStrategyApi.CloseStopOrder
    19-05-2015 13:30:09.3105366,[19-05-2015 - 13:30:00] 101 - after OandaStrategyApi.CloseStopOrder
    19-05-2015 13:30:09.3105366,[19-05-2015 - 13:30:00] 101 - after all
    19-05-2015 13:30:09.3105366,[19-05-2015 - 13:30:00] 101 - after OnBarUpdate()
    19-05-2015 13:30:09.3105366,[19-05-2015 - 13:30:00] 101 - before OnBarUpdate()
    19-05-2015 13:30:09.3186780,[19-05-2015 - 13:30:00] 101 - after OnBarUpdate()
    19-05-2015 13:30:09.3186780,[19-05-2015 - 13:30:00] 1 - before OnBarUpdate()
    19-05-2015 13:30:09.3186780,[19-05-2015 - 13:30:00] 1 - before OandaAccountApi.IsFlatPosition
    19-05-2015 13:30:09.3286772,[19-05-2015 - 13:30:00] 1 - before OandaAccountApi.GetOrder
    19-05-2015 13:30:09.3438166,[19-05-2015 - 13:30:00] 1 - after OandaAccountApi.GetOrder
    19-05-2015 13:30:09.3438166,[19-05-2015 - 13:30:00] 1 - before OandaAccountApi.CloseStopOrder
    19-05-2015 13:30:09.3548384,[19-05-2015 - 13:30:00] 1 - after OandaAccountApi.CloseStopOrder
    19-05-2015 13:30:09.3548384,[19-05-2015 - 13:30:00] 1 - after all
    19-05-2015 13:30:09.3548384,[19-05-2015 - 13:30:00] 1 - after OnBarUpdate()
    19-05-2015 13:30:09.3548384,[19-05-2015 - 13:30:00] 1 - before OnBarUpdate()
    19-05-2015 13:30:09.3628436,[19-05-2015 - 13:30:00] 1 - after OnBarUpdate()
    19-05-2015 13:31:04.8514955,[19-05-2015 - 13:31:00] 101 - before OnBarUpdate()
    19-05-2015 13:31:04.8665509,[19-05-2015 - 13:31:00] 101 - after OnBarUpdate()
    Last edited by svopex; 05-19-2015, 02:41 PM. Reason: Misspelling ...

    #2
    Hello svopex,

    To clarify, you have added multiple data series to your script. Are you asking which BarsInProgress will trigger on each bar that closes at the same time?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Answer ...

      Hello Chelsea B., no . Sorry for my bad English.

      NinjaTrader, by my opinion, run OnBarUpdate() in same time (in same candle) for more strategies serially, not paraell.
      Ninjatrader don't use multitasking.

      For example, i have two strategy:

      class strategy1: Strategy
      {
      void OnBarUpdate(...)
      {
      ...
      }
      }

      class strategy2: Strategy
      {
      void OnBarUpdate(...)
      {
      ...
      }
      }

      And NinjaTrader run it (for eample on 15 minutes candles):

      ...
      ...
      ...

      Candle 16:15
      ===========
      16:15:00 strategy1->OnBarUpdate(...)
      16:15:02 strategy2->OnBarUpdate(...)

      Description:
      strategy2->OnBarUpdate() run after strategy1->OnBarUpdate() stopped...

      Candle 16:30
      ===========
      16:30:00 strategy1->OnBarUpdate(...)
      16:30:03 strategy2->OnBarUpdate(...)

      Description:
      strategy2->OnBarUpdate() run after strategy1->OnBarUpdate() stopped...

      ...
      ...
      ...

      And i want to NinjaTrader run strategies (OnBarUpdate(...) function) paraelly (as multitasking, for example windows have multitasking, MSDOS haven't multitasking) in same candle time:

      Candle 16:15
      ===========
      16:15:00 strategy1->OnBarUpdate(...) ... 16:15:00 strategy2->OnBarUpdate(...)

      Candle 16:30
      ===========
      16:30:00 strategy1->OnBarUpdate(...) ... 16:30:00 strategy2->OnBarUpdate(...)

      Candle 16:45
      ===========
      16:45:00 strategy1->OnBarUpdate(...) ... 16:45:00 strategy2->OnBarUpdate(...)

      Can you enable this feature in NinjaTrader?
      Or support this feature NinjaTrader 8?

      Thanks for answer Petr
      Last edited by svopex; 05-20-2015, 12:15 AM. Reason: Misspelling ...

      Comment


        #4
        Hello svopex,

        NinjaScripts and the NinjaTrader UI all run in one thread. NinjaTrader 7 is not a multi-threaded application.

        NinjaTrader 8 is designed as a multi-threaded application. Each chart will run in its own thread.

        Below is a link to a list of Major Enhancements for NinjaTrader 8.
        http://www.ninjatrader.com/downloads...njaTrader8.pdf

        However, it is not confirmed if multiple strategies running on a chart will be in one thread or if strategies added without charts.

        If I find more information about this I will post in this thread (bookmarking).
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Super.

          Can I participate on the beta version of Ninja trader 8 testing?

          Petr

          Comment


            #6
            Hello Petr,

            Please send an email to platformsupport [at] ninjatrader [dot] com requesting to be added to the NinjaTrader 8 Beta.

            Right now the beta is limited to a small group but that group will expand. I cannot say for sure if you will be chosen for the beta but we can add you to the list.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello svopex,

              I've got a little more information for you.

              All strategies will be run in the Control Center thread.

              When opening a new chart, all indicators started on that chart will run in the same thread as that chart.

              All events such as OnMarketData, OnMarketDepth, etc are run in a background service thread.

              If you add a strategy to a chart that also adds indicators to the chart, the strategy will be run in the Control Center thread while all the indicators will be run in the thread of the chart.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thanks for detailed information, but I must wait to NinjaTrader 8 :-).
                Petr

                Comment


                  #9
                  You write:

                  However, it is not confirmed if multiple strategies running on a chart will be in one thread or if strategies added without charts.

                  I have additional question.

                  Is this correct?
                  - strategies without chart are run as multithreading
                  - multiple charts, one strategy in one chart, this is run as multithreading
                  - multiple strategies in one chart: ???

                  Is multiple strategies in one chart run as multithreading?

                  Thank you for answer.

                  Comment


                    #10
                    Originally posted by svopex View Post
                    You write:

                    However, it is not confirmed if multiple strategies running on a chart will be in one thread or if strategies added without charts.

                    I have additional question.

                    Is this correct?
                    - strategies without chart are run as multithreading
                    - multiple charts, one strategy in one chart, this is run as multithreading
                    - multiple strategies in one chart: ???

                    Is multiple strategies in one chart run as multithreading?

                    Thank you for answer.
                    Thank you for your note.

                    Each object will run on the thread it is started from. So each strategy on the Strategies tab would be ran on that one thread.

                    Comment


                      #11
                      To clarify my response, this is for NinjaTrader 8. NinjaTrader 7 all objects would be on one thread.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by judysamnt7, 03-13-2023, 09:11 AM
                      4 responses
                      59 views
                      0 likes
                      Last Post DynamicTest  
                      Started by ScottWalsh, Today, 06:52 PM
                      4 responses
                      36 views
                      0 likes
                      Last Post ScottWalsh  
                      Started by olisav57, Today, 07:39 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post olisav57  
                      Started by trilliantrader, Today, 03:01 PM
                      2 responses
                      21 views
                      0 likes
                      Last Post helpwanted  
                      Started by cre8able, Today, 07:24 PM
                      0 responses
                      10 views
                      0 likes
                      Last Post cre8able  
                      Working...
                      X