• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Attempting TDD with NT8

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

  • NinjaTrader_Jesse
    replied
    Hello AnotherTrader,

    Thank you for updating the post that you had solved the question.

    Regarding the other thread, unit testing is not something our support would be able to assist with as there is currently no specification for this in NinjaScript. I wouldn't have anything additional that I could add to that post which could be helpful at this point, this is a subject you would need to explore further on your own if this is something you need to use with your development. We do have a feature request for adding in unit test support (SFT-2793) which I have added a vote for.

    I look forward to being of further assistance.

    Leave a comment:


  • AnotherTrader
    replied
    Hi, I have opened another thread on Unit Testing and TDD. https://ninjatrader.com/support/foru...6-unit-testing

    Did you get any further with this?

    Leave a comment:


  • trader_rick
    replied
    Thanks Jesse, However, now I have another issue.

    Is there a limit on exporting historical data?

    I'm using the ES ##-## series as my test data which I'm going to rename with my new test ticker. However, although I can retrieve historical data for this ticker within a chart well prior to what I need, there seems to be around a 6 month cutoff for the start of the data when I export it from Tools/Historical Data/Export, although no such warning is given. You'll only notice it when you go to examine the data.

    EDIT:

    Please ignore - I didn't realize I needed to manually download the data first within the Historical Data window before exporting it.
    Last edited by trader_rick; 11-26-2018, 12:19 PM.

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello trader_rick,

    If you create a test data set, you could import that using the historical data import tool. You can find directions on how to use this tool along with the formats it supports in the help guide here: https://ninjatrader.com/support/help.../importing.htm

    After creating a new instrument, you would need to create the test data and name the file per the guidelines in the helpguide. For example, importing data for a stock would use the name MSFT.Last.txt.

    The various formats are listed in the linked page, you would output the test data into that format and then the platform could import it for the custom instrument.

    I look forward to being of further assistance.

    Leave a comment:


  • trader_rick
    replied
    OK Jesse, thanks.

    In the meantime, I think I've come up with a workaround. I want to create a dummy instrument which I will associate with test data. Creating the instrument seems straightforward enough from Tools/Instruments/Add. Generating test data is also not a problem. But please could you talk me through how I would associate my new dummy ticker with the data and get my NT strategy to read this in and run on it?

    thanks

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello trader_rick,

    Thank you for the post.

    You are correct, there is a lot of internal handling happening here to instantiate the object correctly. The state system for the script is run along with base properties being populated. This happens with all NinjaScript types and is not necessarily something we could advise how to recreate as that part is internal code. Some types are more simple (import types) than others and you may be able to manually run it through its states using its SetState method but that is not something I could suggest for strategy specifically. I am afraid I won't be able to be much help here other than confirming your suspicions surrounding this question.

    I am unsure if any other forum members have had luck in this area with strategies but if they have I am sure they will post here.

    I do see we have had another request for adding in support for unit testing in the past so I will add you to that feature request as well: SFT-2793

    I look forward to being of further assistance.

    Leave a comment:


  • trader_rick
    started a topic Attempting TDD with NT8

    Attempting TDD with NT8

    Hi guys,

    I know this is not officially supported but I am tryihg to apply Test Driven Development to NT strategies and indicators.

    I've managed to set up my project in Visual Studio 2017 and add all the necessary references to NT to my test project so everything builds fine with no errors.

    e.g. inside the body of my test class, this builds fine;

    Code:
    var obj = new MyCustomIndicator();
    However, when I come to actually run the tests, I get the following error;

    Code:
    Message: Test method testMyCustomIndicator.UnitTest1.TestMethod1 threw exception:
    System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> System.ArgumentNullException: Value cannot be null.
    Parameter name: ptr
    I'm guessing this is because when an NT Strategy or Indicator is run, a whole lot of initialization code is run too before the Strategy is instantiated, something which doesn't take place with my simple instantiation statement.

    My question to you is this - is there any way of instantiating an NT Strategy or Indicator from outside? If so, what are the additional setup calls I need to make?

    many thanks

    EDIT:

    I see this issue has been raised before so I am not optimistic re: a solution.

    https://ninjatrader.com/support/foru...le?postcount=1
    Last edited by trader_rick; 11-26-2018, 08:59 AM.

Latest Posts

Collapse

Topics Statistics Last Post
Started by gemini42, Yesterday, 09:44 PM
0 responses
6 views
0 likes
Last Post gemini42  
Started by martyn73, Yesterday, 03:09 PM
0 responses
4 views
0 likes
Last Post martyn73  
Started by martyn73, Yesterday, 03:05 PM
0 responses
5 views
0 likes
Last Post martyn73  
Started by mic414, Yesterday, 02:17 PM
0 responses
2 views
0 likes
Last Post mic414
by mic414
 
Started by U0000999, 11-15-2019, 06:18 PM
1 response
23 views
0 likes
Last Post NinjaTrader_ChrisL  
Working...
X