Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategies stop working unexpectedly

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

    Strategies stop working unexpectedly

    I am fiddling around with strategies to get a good understanding of them. Currently I have the problem that my strategy stops processing ticks at some point. I think I found out how to reproduce. I am not sure if I misunderstand something or if it is a bug.

    This is what I have done:
    1. I made a strategy (for testing purpose) that only prints a log line on each OnBarUpdate. Also it does use "calculate on bar close" = false so it gets called on every tick.

      protected override void OnBarUpdate()
      {
      Print("I am bar: " + this.BarsInProgress + " Time:" + Time[0].ToString() + " Open:" + Open[0] + " Close:" + Close[0]);
      }
    2. I created a new instrument list named "my" and added symbol AAPL using Nasdaq
    3. I freshly start NT and connect to simulated data provider.
    4. I switch to the strategy tab and add my strategy using symbol "AAPL" from list "my", template "Default 24/7" and "Minimum bars required" 0
    5. In the output window I can see my strategy producing log lines for every tick from the sim feed (OK - as expected)
    6. But now when I switch to the orders tab and select symbol AAPL from list "my" then my strategy stops outputting log lines (so it does not get ticks anymore). The strategy is still enabled on the strategy tab though.


    What I tried afterwards:
    • Disabling and re-enabling the strategy does not help. Still no ticks.
    • Removing the strategy and re-adding it with same settings does work. Ticks appearing again.


    Here is another (even easier) method that stops the strategy ticks (similar to the above method. Bascially just enabling/disable strategy):
    1. I freshly start NT and connect to simulated data provider.
    2. I switch to the strategy tab and add my strategy using symbol "AAPL" from list "my", template "Default 24/7" and "Minimum bars required" 0
    3. In the output window I can see my strategy producing log lines for every tick from the sim feed
    4. I disable the strategy by ticking the checkbox and then I enable it again
    5. Now no further ticks arrive anymore (no more log lines appear)


    Any ideas please?

    #2
    Hello _vbs_,

    Thank you for your inquiry.

    This is due to the fact that NinjaTrader is attempting to draw data from two exchanges on the same instrument, which is not allowed.

    Please remove AAPL from your "my" instrument list and re-add it with the "Default" exchange selected.

    Attempt to run your strategy and please tell me if you experience the same.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Hi Zachary,

      thanks for your quick reply, its highly appreciated!

      First: Yes, it helps for problem #1. When I remove symbol AAPL from "my" and re-add it with exchange "default" then the strategy does not stop anymore when I select symbol APPL in the order tab (all fine).
      Well, what is the lesson out of this for me? Is it generally not recommended to have the same symbol with different exchanges in the lists? Or better do not have the same symbol multiple times at all?
      I have to admit: I am unsure what exchange "default" actually means and where it is used. Does it mean the data provider will choose an exchange he considers as the standard exchange for the symbol?
      If so, is there any way to find out later to which exchange "default" was mapped by the provider?

      Second: Even when using exchange "default", problem #2 still persists (slightly different now): When the strategy is running and I disable it and re-enable it (using the checkbox) then the strategy instantly disables itself (checkbox gets cleared). But when I wait about 1 minute then I can successfully re-enable it and I get it running again. From there on I can disable/enable the strategy without problems repeatedly.
      So basically only the first disable/enable-sequence seems odd. Is this intended?

      Comment


        #4
        Hello _vbs_,

        NinjaTrader will not allow one to draw data from two or more exchanges at the same time on the same instrument.

        When you are selecting an exchange for an instrument, Default sends the symbol mapping to the data provider and lets them sort out what the correct exchange for this instrument is. Selecting an exchange on your own would do the same thing, but instead, you are selecting what exchange you want the data to come from rather than allowing the provider to sort it out on their own.

        Depending on your data provider, you would probably be able to go to their website to see what exchange they are pulling data from for each particular instrument. With Kinetick, for example, AAPL uses NASDAQ according to their symbol search site: https://kinetick.com/support.php#Symbol-Search.php

        I am unable to reproduce the issue in your second question on my end. Does this issue continue to occur after restarting NinjaTrader, removing your strategy from the Strategies tab, adding it back in, and re-enabling it?
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          Hi Zachary,

          ok, thanks for the info regarding the default exchange. Sometimes it is not quite obvious for me when NT is trying to pull data from a second exchange. So maybe I will try to just use the default exchange exclusively. Also that the strategy silently stops working when it happens is a bit problematic imo.

          Regarding #2:
          Yes, it is totally reproducible for me (also after restarting NT, tested on two different machines). Quite strange...

          Comment


            #6
            Hello _vbs_,

            What I would suggest is, once the strategy disables itself, to check the Log tab in the NinjaTrader Control Center. There should be an error in there that will state why the strategy gets disabled on its own.
            Zachary G.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ZacharyG View Post
              What I would suggest is, once the strategy disables itself, to check the Log tab in the NinjaTrader Control Center. There should be an error in there that will state why the strategy gets disabled on its own.
              Well, I am sorry to say, but it stopped happening for me and I cannot reproduce it anymore currently.
              But I know that when it happened there was no log entry whatsoever indicating that the strategy was disabled.

              I will report back when it happens again. Much thanks so far for you help!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by sidlercom80, 10-28-2023, 08:49 AM
              166 responses
              2,234 views
              0 likes
              Last Post sidlercom80  
              Started by thread, Yesterday, 11:58 PM
              0 responses
              1 view
              0 likes
              Last Post thread
              by thread
               
              Started by jclose, Yesterday, 09:37 PM
              0 responses
              6 views
              0 likes
              Last Post jclose
              by jclose
               
              Started by WeyldFalcon, 08-07-2020, 06:13 AM
              10 responses
              1,414 views
              0 likes
              Last Post Traderontheroad  
              Started by firefoxforum12, Yesterday, 08:53 PM
              0 responses
              11 views
              0 likes
              Last Post firefoxforum12  
              Working...
              X