NexusFi: Find Your Edge


Home Menu

 





NinjaTrader and VS2010 for Dummies


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one MXASJ with 17 posts (90 thanks)
    2. looks_two sam028 with 4 posts (14 thanks)
    3. looks_3 Jura with 4 posts (13 thanks)
    4. looks_4 baruchs with 3 posts (10 thanks)
      Best Posters
    1. looks_one MXASJ with 5.3 thanks per post
    2. looks_two sam028 with 3.5 thanks per post
    3. looks_3 Jura with 3.3 thanks per post
    4. looks_4 baruchs with 3.3 thanks per post
    1. trending_up 38,065 views
    2. thumb_up 134 thanks given
    3. group 30 followers
    1. forum 48 posts
    2. attach_file 13 attachments




 
Search this Thread

NinjaTrader and VS2010 for Dummies

  #21 (permalink)
 fluxsmith 
Santa Maria
 
Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker: Mirus/Zen-Fire
Trading: ES
Posts: 290 since May 2010
Thanks Given: 97
Thanks Received: 322


baruchs View Post
I use VS only for debugging. I don't see any advantages in editing in it...

I don't like it any better for an editor either, but I followed the instructions in this thread and got it working for editing just fine. My real goal was to use the debugger, and I still had no source-level debugging capability, I'd appreciate more information on how you pull that off!

Thank you.

Visit my NexusFi Trade Journal Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
Exit Strategy
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Diary of a simple price action trader
26 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
22 thanks
My NQ Trading Journal
16 thanks
HumbleTraders next chapter
9 thanks
  #22 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009

Debugging in VS. Very easy and I don't see how it can be done without VS.
I write only strategies, so my explanation is for them. (Don't understand people who write indicators. Why?)
1. Open source code in NT.
2. Right click and check the box to allow debug mode. You need to do it only once and from now on you we be in debug mode.
3. Open VS and open the cs file in it too.
4. In NT compile the code. Very important!! Each time after you load VS and cs file go back to NT and compile it. This creates some kind of linkage.
5. In VS in debug menu choose "attach to..." and pick NT from the list of processes.
6. On left margin of code in VS click on the row you want to break on. It will add a dot and in runtime it will stop there. One click on the dot and it will remove the break.
7. Run back test in NT and you will be stooped at the break you put in VS. F5 - continue. F10 - step.
Now you can take any variable and move it to watch window and you will see its value on each interaction.
When you find a bug stop debugging in VS. Correct it in NT. Recompile and run again.

Baruch
p.s.
I write it from memory so I hope the explanation is complete.

Reply With Quote
  #23 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629



baruchs View Post
Debugging in VS. Very easy and I don't see how it can be done without VS.
I write only strategies, so my explanation is for them. (Don't understand people who write indicators. Why?)
1. Open source code in NT.
2. Right click and check the box to allow debug mode. You need to do it only once and from now on you we be in debug mode.
3. Open VS and open the cs file in it too.
4. In NT compile the code. Very important!! Each time after you load VS and cs file go back to NT and compile it. This creates some kind of linkage.
5. In VS in debug menu choose "attach to..." and pick NT from the list of processes.
6. On left margin of code in VS click on the row you want to break on. It will add a dot and in runtime it will stop there. One click on the dot and it will remove the break.
7. Run back test in NT and you will be stooped at the break you put in VS. F5 - continue. F10 - step.
Now you can take any variable and move it to watch window and you will see its value on each interaction.
When you find a bug stop debugging in VS. Correct it in NT. Recompile and run again.

Baruch
p.s.
I write it from memory so I hope the explanation is complete.

The explanation for debugging is already here, without VS, but it's exactly the same thing.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #24 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009


Quoting 
The explanation for debugging is already here, without VS, but it's exactly the same thing.

Why couldn't you post it 6 minutes before and save me the trouble?

Reply With Quote
  #25 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800

My weekend reading:

Amazon.com: Professional Visual Studio 2010 (Wrox Programmer to Programmer) (9780470548653):…

Not a book on how to program, but instead a book on how to use the features included in Visual Studio 2010 Pro and an introduction to some of the tools found in the higher-end editions.

Started this thread Reply With Quote
Thanked by:
  #26 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800

Some things I learned after some RTFM time:

Task List: View > Task List. You can drop reminders in your code such as //TODO: Check for divide by zero, and when you view your task list you will see them there for all the code in your Project. You can add custom items on the task list (BUILD_VER is one I made, for example) using the Tool >Options > Environment > Task List dialog.

Toolbox: You can drag and drop code into the Toolbox panel. Personally I prefer Code Snippets but they do need to be created by the user. Drag and drop to/from the Toolbox panel is quick and easy.

I'm sure that is very basic stuff for some of the users here!

I've also had look at how much I don't know courtesy of the book mentioned above. My list of known unknowns just got a whole lot bigger...

Attached Thumbnails
Click image for larger version

Name:	TODO.JPG
Views:	355
Size:	200.3 KB
ID:	18240   Click image for larger version

Name:	Options.JPG
Views:	393
Size:	224.0 KB
ID:	18241   Click image for larger version

Name:	Toolbox.JPG
Views:	359
Size:	208.1 KB
ID:	18242  
Started this thread Reply With Quote
Thanked by:
  #27 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800

Ran into my first hiccup today, but it was more of a Subversion problem than a VS/Ninja problem. Basically I was being a little bit too clever, and would love to hear of a better way to do this:

By following the steps in this thread one is building all ones VS work in the NT7>bin>Custom directory. I have an online SVN that some of my friends can access, and I share that whole project. All works, all is well.

Eight hours ago I decided I wanted a "private" folder in the SVN. Thats where it got messy. I ended up creating then deleting then creating again two seperate SVN repos. The project on my VS2010 was linked to a repos that no longer exists, and I could find no way to unbind it and kill any references to the original repos.

Deleted ankhsvn and installed a 30-day trial of VisualSVN but still no joy. The whole process was a PITA.

Luckily Beta 20 was released so I had an excuse for a clean install, which I have just done, and added that project as in my earlier posts. All is well again... BUT... I'm not putting it in the SVN until I know what I am doing .

What would be the best way to share different Ninja projects that compile in situ in VS using SVN. I recognise only one project can be open at a time in Visual Studio, but I'm sure I'm missing some basic work flow set up paradigm.

Basically I'd like to share ProjectX with Bill and Sue in one repos, and ProjectY with Tom and Lisa in another repos. I know how to set up the repos in SVN, its getting VS and Ninja to play nicely withthe SVN that is frustrating me.

I am open to suggestions!

Started this thread Reply With Quote
  #28 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629

Sorry, I don't have the answer, but my advice is KISS .

This is what I'm doing:
- I use my own repository, or the BMCodex one, and the files I'm working on are in specific directories, not the NT default directory for indicators/strategies/types/...
- for editing the code and writing the "skeleton" of the code, I use Notepad++, which is much better than the NT editor when you have more than 100 lines to play with
- when this code doesn't look too bad, I'm doing the initial commit to the repository
- then, I have to copy the code in the NT directory, edit it with NT, see if the compile is ok or not, do the modifications needed, and when it works like it should, I copy it back this file to my repository directory, and update it with SVN

I know this is a bit "heavy", but I didn't find a good solution for having my NT directories managed by two different repositories, and I don't think it's possible.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
Thanked by:
  #29 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800

The more I learn the more I learn what I don't know. I decided to tackle a basic stand-alone WinForms app that uses NT7 as an API. This is probably where I want to be in the long run... I have a platform I can work with that works to a trading API. Keep my ideas portable.

Anyway. The SampleCSharp app that shipped with NT6.5 is broken in NT7, so I started from scratch and just added some of that apps GUI before I try to add its functionality.

If anyone is interested post back and post some code here.

Attached a screen grab of where I stand. All the middle bits work.

VS2010 is rocking my world. I have not touched WPF yet but it seems the next step...

Attached Thumbnails
Click image for larger version

Name:	APITest.JPG
Views:	427
Size:	198.2 KB
ID:	21464  
Started this thread Reply With Quote
Thanked by:
  #30 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,440 since Jun 2009
Thanks Given: 33,207
Thanks Received: 101,599


I have a generic question for you.

We all know NT's C# abilities make it very open and powerful. But, can you tell me specifically how your trading is benefiting from all your work in Visual Studio? I believe its a fundamental type question, how you perceive the markets and your ability to make money in them.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote




Last Updated on February 4, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts