Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Happy to report I am successfully using Visual Studio Pro 2013 (VS2013) as my Integrated development environment (IDE) for NT. Thanks to all posters who have illuminated the way.
This was achieved by:
1) Open NinjaTrader.Custom in VS2013 (
This is what I've done to get started, and if anyone has a better or safer way please post it here. Also, depending on how brave you are you might want to wait a day or two until after I post. If I break my system, I'll post here.
I'm using …
)
2) Construct an AutoHotKey script to easily compile in NT from VS2013 (
@baruchs (: I'm wondering the same thing regarding of it's "useful" or not. Honestly, I just got it up & running today, so I guess MXASJ & Sam028 are better suited to answer this. :)
------
Quicker & easier working with Visual Studio …
)
3) Set up version control with MS Team Foundation Server ( Visual Studio Online Basic) Free for five users.
Now, in the vein of Test Driven Development (TDD) I am trying to write tests for indicators.
I have hit a brick wall ! As per the below code, I have successfully created the template for a test:
- It has a reference to NinjaTrader.Custom.
- However, IntelliSense is alerting me of an issue when I attempt to add the statement "using NinjaTrader.Custom"
- I am struggling to instantiate an indicator so that I may test its methods.
Any assistance or guidance would be appreciated.
Regards
Shannon
Can you help answer these questions from other members on NexusFi?
To help explain my predicament, please find attached two screenshots.
"NinjaTrader.Indicator.Phase.SmaRepository" which depicts the Indicator "Phase140109" using peak to show the nested helper class "SmaRepository" and one of its methods "AddCross".
"NinjaTrader.Indicator.Phase.Tests" which depicts my attempt at the unit test "AddCrossTest"
There is no error as such aside from the message "Cannot resolve symbol "_smaCollection" when hovering over the line "_smaCollection = new SmaRepository();".
Should it be of assistance, the screenshots include the references of of NinjaTrader.CustomTests.
looks like your class SmaRepository is nested inside Phase140109 class as what gomi points out. at least that is what we see in your screenshot. i don't know but on your screenshot there might be a syntax error (i'm pretty much sensitive on syntax being a programmer myself).
i suggest separating your classes to individual files (.cs files). for example, add a file named SmaRepository.cs containing only the SmaRepository class. this should help make your solution manageable.
try out:
var _smaRepository = new Phase140109.SmaRepository();
You are both correct, the parent class (i.e. Phase140109) is required. Apologies for my oversight.
In addition to the omitting the parent class, it would seem the similarity between the two namespaces (i.e. NinjaTrader.Indicator and NinjaTrader.Indicator.Phase140109.Tests) was causing a conflict. While in my many attempts I did trial "new Phase140109.SmaRepository()", it was unsuccessful. The problem was resolved by changing the test namespace (in addition to including the parent class in the declaration). Tests are now housed in the namespace NinjaTrader.CustomTests.Indicator.
I would love to implement your suggestion but have several concerns:
1. SmaRepository is a helper class of the Phase class (Indicator). It is my understanding, if a class is useful to only one other class, then it is logical to embed it in that class and keep the two together ( Nested Classes). As my list of nested classes grows, I agree the solution becomes more and more unruly.
Where the nested class SmaRepository is separated into its own .cs file, what structure do you implement to highlight it is a helper class the Phase class (Indicator)? Do you alter the namespace housing the newly split out SmaRepository Class to highlight its helper nature? How does the Indicator in question know how to access the helper classes, a using statement, a reference, both)?
2. It is my understanding all .cs files located in the directory ...\NinjaTrader 7\bin\Custom\Indicator will appear in the NT Indicator window (screenshot attached). Where do you file any helper class .cs files so:
1) they do not appear in the NT Indicator window,
2) remain organizationally tied to the Indicator in question (are they filed in an appropriately named folder "Phase helper classes"? Are they or their housing folder filed inside our outside the folder ...\NinjaTrader 7\bin\Custom\Indicator or somewhere completely different?)
I would love to separate out my nested classes and make my solution more manageable, but have no idea how. I am caught between trying to implement what I have read is "best practice" and my lack of experience to know any better. Any insight on the above concerns or approaches to address them would be greatly appreciated.