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

multi-instrument strategy

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

    multi-instrument strategy

    I'm developing multi-instrument strategy with NT8.

    I noticed that when I run strategy analyzer, it process all the bar twice.
    Is this behavior correct?

    When I have 33 bars for AAPL and MSFT.
    Strategy analyzer process 66 bars for one analysis.

    And one more thing.

    I set this strategy for AAPL and in the code I have AddDataSeries for MSFT.
    But not all "BarsInProgress = 0" indicates "AAPL".
    Sometimes "BarsInProgress = 0" indicates "MSFT".

    I think "BarsInProgress = 0" is always AAPL but it isn't. I don't know why.

    I attached the output and the strategy files so please check them.

    I will appreciate your help.
    Attached Files

    #2
    Hello tokyojoe, and thank you for your question. Your output looks correct. It is not processing bars twice; rather, there are two independent sets of CurrentBar. CurrentBar is always equal to CurrentBars[BarsInProgress]. CurrentBars[0] is for Apple, and CurrentBars[1] is for Microsoft.

    This said I was unable to see quite the same thing on my end that you were seeing on yours. For testing purposes, I did change the Microsoft bar type to 7 second bars, and sent in 5 second bars for apple. I never received Microsoft trading on BIP == 0 and Apple trading on BIP == 1. Could I ask that you send a picture of your strategy's configuration so I may look more deeply into this?

    To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.
    Click here for instructions
    Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
    Click here for detailed instruction
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      It worked but...

      Thank you Jessica.
      I appreciate your quick response.

      Today I tried my strategy on my another computer.
      It worked well.

      The first one has crashed several times and the another has not.
      It could be the reason.

      So, I uninstalled NT on my first one and re-installed. Then it worked.

      But I don't know why NT crashes.

      Sometimes when I run my newly developed indicator or strategy, NT crashes.
      But not all the time.

      Maybe my scripts are buggy...

      In order not to crash NT, are there any tips for developing bug-proof scripts?

      Thank you.

      Comment


        #4
        I am glad you were able to get consistent results from your code. One strategy I highly recommend is using Visual Studio debugging. Generating bug free code on a first pass is generally not possible, and even if it is, code optimized in this way is often difficult to refactor or keep up to date. So a good debugging strategy is preferable in my opinion to code being in a good state as you write it. Visual Studio debugging will make your execution paths very short - in other words, there will be small sections of code that any bug can hide in - and it will make it so you can reproduce conditions that create a bug quickly and easily.

        Please review this page for more information on Visual Studio debugging. We are happy to help with any questions that come up.

        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          Thank you Jessica.
          I will learn Visual Studio debugging.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bmartz, 03-12-2024, 06:12 AM
          5 responses
          32 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Started by Aviram Y, Today, 05:29 AM
          4 responses
          13 views
          0 likes
          Last Post Aviram Y  
          Started by algospoke, 04-17-2024, 06:40 PM
          3 responses
          28 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by gentlebenthebear, Today, 01:30 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by cls71, Today, 04:45 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X