Test Driven Development - NinjaTrader Programming | futures io social day trading
futures io futures trading


Test Driven Development
Updated: Views / Replies:890 / 7
Created: by shansen Attachments:3

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Test Driven Development

  #1 (permalink)
Elite Member
Melbourne, Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: ES
 
Posts: 16 since Aug 2013
Thanks: 1 given, 4 received

Test Driven Development

futures.io (formerly BMT) Forum,

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 (https://futures.io/ninjatrader-programming/4781-ninjatrader-vs2010-dummies.html#post52463)
2) Construct an AutoHotKey script to easily compile in NT from VS2013 (https://futures.io/ninjatrader-programming/4781-ninjatrader-vs2010-dummies-2.html#post54642)
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.

 
Code
namespace NinjaTrader.Indicator.<IndicatorName>.Tests
{
  [TestClass()]
  public class <InnerClassNameTests>
  {
    [TestMethod()]
    public void <MethodNameTest>()
    {
      //-- Arrange
        //  Struggling to instantiate <IndicatorName> or <InnerClassName>      
        //  e.g. var instance = new NinjaTrader.Indicator.<IndicatorName>();       
      //-- Act
      //-- Assert       
    }
  }
}
Any assistance or guidance would be appreciated.
Regards
Shannon

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Manila, Philippines
 
Futures Experience: Beginner
Platform: CQG,Bookmap,Sierra Chart
Broker/Data: CQG
Favorite Futures: BUND
 
jerbersoft's Avatar
 
Posts: 55 since Apr 2014
Thanks: 46 given, 17 received


hi shannon, what is the exact error message? maybe i might be able to help.

"You are only as good as the decisions you make."
Reply With Quote
 
  #4 (permalink)
Elite Member
Melbourne, Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: ES
 
Posts: 16 since Aug 2013
Thanks: 1 given, 4 received

jerbersoft,

Thanks for your response.

To help explain my predicament, please find attached two screenshots.
  1. "NinjaTrader.Indicator.Phase.SmaRepository" which depicts the Indicator "Phase140109" using peak to show the nested helper class "SmaRepository" and one of its methods "AddCross".
  2. "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.

Any assistance would be greatly appreciated.

Thanks again
Shannon

Attached Thumbnails
Test Driven Development-ninjatrader.indicator.phase.smarepository.png   Test Driven Development-ninjatrader.indicator.phase.tests.png  
Reply With Quote
 
  #5 (permalink)
Elite Member
Paris
 
Futures Experience: None
Platform: NinjaTrader
 
Posts: 1,173 since Oct 2009
Thanks: 227 given, 4,090 received

try
using NinjaTrader.Indicator;

and instantiating Phase140109.SmaRepository()

your class is nested in another class..


Last edited by gomi; July 3rd, 2014 at 09:44 AM.
Reply With Quote
The following user says Thank You to gomi for this post:
 
  #6 (permalink)
Elite Member
Manila, Philippines
 
Futures Experience: Beginner
Platform: CQG,Bookmap,Sierra Chart
Broker/Data: CQG
Favorite Futures: BUND
 
jerbersoft's Avatar
 
Posts: 55 since Apr 2014
Thanks: 46 given, 17 received

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();

hope we have helped.

"You are only as good as the decisions you make."
Reply With Quote
The following user says Thank You to jerbersoft for this post:
 
  #7 (permalink)
Elite Member
Melbourne, Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: ES
 
Posts: 16 since Aug 2013
Thanks: 1 given, 4 received

gomi & jerbersoft,

Thank you for your input.

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.

Thanks again
Shannon

Reply With Quote
 
  #8 (permalink)
Elite Member
Melbourne, Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: ES
 
Posts: 16 since Aug 2013
Thanks: 1 given, 4 received

jerbersoft,

I am very interested in your suggestion:

jerbersoft View Post
...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.

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.

Regards
Shannon

Attached Thumbnails
Test Driven Development-indicator-window.png  
Reply With Quote

Reply



futures io > > > > > Test Driven Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Test Driven Development shansen NinjaTrader 0 June 30th, 2014 07:29 AM
Charting The Unprecedented 'HFT-Driven' Rise In Intraday-Trading Volatility kbit News and Current Events 0 August 30th, 2012 09:18 PM
Bankster Fraud Has Driven 100 Million Into Poverty, Killing Many kbit News and Current Events 0 August 13th, 2012 07:15 AM
How to Trade This Headline Driven Stock Market Quick Summary News and Current Events 0 November 7th, 2011 09:00 PM
Europe Stocks to Continue Debt Deal-Driven Rally Quick Summary News and Current Events 0 October 28th, 2011 02:40 AM


All times are GMT -4. The time now is 01:51 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-13 in 0.13 seconds with 20 queries on phoenix via your IP 54.92.201.232