NinjaTrader and VS2010 for Dummies - NinjaTrader Programming | futures io social day trading
futures io futures trading


NinjaTrader and VS2010 for Dummies
Updated: Views / Replies:24,872 / 48
Created: by MXASJ Attachments:13

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
 13  
 
Thread Tools Search this Thread
 

NinjaTrader and VS2010 for Dummies

  #11 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

Remember you can build/compile away in Visual Studio but you need to compile in Ninja Trader itself before things will work properly. Using the good old Search function, I note other users have posted that if you compile one Strategy or Indicator, it recompiles all your NinjaScript objects, so a suggestion was to have a NinjaScript editor window open while you are working in VS, but make sure its NOT the script you are actually editing.

I've created a dummy Indicator called CompileMe which I can keep open and hit compile as I go along. On the Ninja Trader Support forum there was one user who said he wrote a macro to do the same thing. I don't know how to do that. I will at some point, and post it here.

A button in Visual Studio that does that (recompile Ninja natively) would be a cool thing, but while I'm learning, an open NinjaScript editor screen works just fine.

So far this week:

- Using VS as a better editor than the default editor. This is something I want to master in the near term.
- Using VS and Subversion (futures.io (formerly BMT)Codex) for managing a development project. This is something I want to master in the long term.

Related threads:

https://futures.io/ninjatrader-programming/307-what-c-development-platform-do-you-use.html

Compiling Script from Command Line - NinjaTrader Support Forum

Attached Thumbnails
NinjaTrader and VS2010 for Dummies-compileme.jpg  
Reply With Quote
The following 4 users say Thank You to MXASJ for this post:
 
  #12 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

Just a very quick update. 10 days in and I haven't broken anything!

I am very, very happy using the Visual Studio editor instead of the default editor. Little things like the editor remembering my variable names makes things easier.

I have been managing the code for three of my strategies and one of my indicators via VS, and so far so good. I recommend everyone read the link from the Ninja Support Forum in the post just before this to understand how very unsupported compiling outside of the default editor is.

It appears editing/compiling indicators (as opposed to strategies) is where you could create some problems if you are not careful. Indicators have the Forbidden Zone at the bottom where it says "NinjaScript generated code. Neither change or remove" which looks like it is generated on each compile and only generates properly if the default editor is used. Out of my depth, but I'll take their word for it.

My last compile is therefore always the CompileMe indicator in a seperate window


One last though for now... its probably overkill to use Visual Studio just for editing NinjaScript. Personally I'm doing it for professional development reasons and need to get my head around VS as an IDE, and (eventualy!) Subversion as collaboration and source control platform.

There are some good coders here who use VS regularly so feel free to throw me and the community a bone any time .


Last edited by MXASJ; August 3rd, 2010 at 10:09 AM. Reason: Spelling
Reply With Quote
The following 2 users say Thank You to MXASJ for this post:
 
  #13 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 received



MXASJ View Post
(..)
The Intellisense running in this also seems to be a bit more feature-rich than the default editor.
(...)

Interesting point. I agree that the Visual Studio Intellisense is just that bit richer in features, however, what kept me back from using Visual Studio to debug NinjaScript is the missing of the NinjaScript Intellisense, which comes in quite handy when trying to think of the parameters of some arcane indicator. Is there perhaps any way to import this 'NinjaScript Intellisense' in Visual Studio?

Regards,

Reply With Quote
 
  #14 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

Thanks Jura,

If you mean debugging in the real sense of the word as supported by Ninja and you add breakpoints, etc in Visual Studio I'm afraid I can't comment yet as I haven't tried that feature.

For basic coding however, if you have referenced the libraries as outlined above the whole of the Ninja Script universe seems to be at your disposal... both supported and unsupported.

Attached a screenshot that shows how Visual Studio offers to complete MarketPosition, as well as a screenshot of what it wants to do with a custom indicator, in this case ADXVMA. It knows how many overloads, etc and what they are called.

Or did I completely misunderstand your question?

Attached Thumbnails
NinjaTrader and VS2010 for Dummies-intellisense.jpg   NinjaTrader and VS2010 for Dummies-indicator.jpg  

Last edited by MXASJ; August 3rd, 2010 at 09:45 PM. Reason: Spelling
Reply With Quote
The following 2 users say Thank You to MXASJ for this post:
 
  #15 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,366 since Jun 2009
Thanks: 3,573 given, 3,982 received

@Jura: I think you are wrong, Ninja specific intellisense is working fine with VS.
Check the animated .gif included, maybe we're not talking about the same thing...

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Success requires no deodorant! (Sun Tzu)
Reply With Quote
The following 9 users say Thank You to sam028 for this post:
 
  #16 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

That animated gif is a perfect addition to this thread, sam. Thanks.

Reply With Quote
 
  #17 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 received

Thanks MXASJ and sam028 for your thorough responses. Yes, we're talking about the same thing. I guess I did something quite wrong (I'm also a dummy in this area) when connecting Visual Studio to NinjaTrader, because the IntelliSense (as shown in the images) didn't show up on me.

Before I reinstall the various software programs and try to find the source of this 'disappeared IntelliSense', is attaching Visual Studio to NinjaTrader quite handy or more of a 'advanced debug-tool'? I'm asking because I didn't test it thorough, because the IntelliSense was a deal-breaker for me.

Reply With Quote
 
  #18 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 received

Yeah! It works!

I've uninstalled NinjaTrader and Visual Studio, then reinstalled NinjaTrader & Visual Studio, then followed the steps outlined by MXASJ on the first page of this thread to the letter, and it works! I still don't know exactly why it didn't work earlier, but I'm glad it works now. Thanks alot MXASJ and Sam028 for the encouragement and wisdom.


Btw, I received the following error popup and error log...


Popup
The Add Reference Dialogue could not be shown due to the error: Null Reference.


Error Log
5-8-2010 10:05:05
System.ArgumentException: The path is not of a legal form.
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
at System.IO.Path.GetDirectoryName(String path)
at Microsoft.VSProjectPlus.AddReferenceDialog..ctor(IVsHierarchy projectHierarchy, DTE2 applicationObject)
at Microsoft.VSProjectPlus.AddReferencePackage.ShowAddReferenceDialogOnIdle(IdleComponent idleComponent)

With this step:


MXASJ View Post
(...)
Remove the references for NinjaTrader.Core and WilsonORMapper.

Add references for NinjaTrader.Core and WilsonORMapper by navigating to the NT7 directory in Program Files.
(...)

It turns out that this error was generated by the "Productivity Power Tools" extension. Disabling this extension removed the error and made it possible to add the references. After adding the references this extension can be re-activated and, as far as I know, works then okay.

Regards,

Edit:
I came across this NinjaTrader Support Forum-topic and, according to the NinjaTrader guys, gets the code (besides compiled) also (partly) re-written by NinjaTrader (thus: using Visual Studio will 'break' NinjaScript indicators?). That seems a little bit odd to me. What is your take on this?


Last edited by Jura; August 5th, 2010 at 05:41 AM. Reason: expanded post
Reply With Quote
 
  #19 (permalink)
Elite Member
Israel
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: pfg
Favorite Futures: eminis
 
Posts: 323 since Jun 2009
Thanks: 6 given, 206 received

I use VS only for debugging. I don't see any advantages in editing in it. Can someone give some examples?
Some times when I want to distribute my strategy in restricted form I obfuscate and compile it.
Also I write only strategies. Not indicators. There are too many already. The only problem I have is that I can't put a conditional break point. The correct statement should be that I can put it, but then it takes ages to get to it. What I need is to break on a specific bar/time. Anyone else has this problem? My solution is to add a debug time parameter and put a break when true.

Baruch

Reply With Quote
 
  #20 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 received

Autohotkey tricks


@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 and NinjaTrader.

I find the steps to work with Visual Studio alongside NinjaTrader quite cumbersome and annoying, so I went looking for a way to 'automate' this. So, I experimented what with AutoHotKey (www.autohotkey.com), a light-weight custom short-cut program. Please note, I'm not an "AutoHotKey-expert", but I would like to share some scripts which I use to work quicker with Visual Studio. If you look at the AutoHotKey documentation you'll see that the possibilities are endless, so this is just a primer.

This is my AutoHotKey script:
 
Code
; Save & Compile
#s::
IfWinActive, NinjaTrader.Custom - Microsoft Visual Studio
{
 Send ^s
 ControlSend,, {F5}, Indicator - CompileMe
}
#s (Windows button + s) activates this script. First, the Visual Studio window is saved, and then the 'CompileMe' indicator is compiled in the background. The sound (from NinjaTrader) after compiling let's me know that compiling went successful.

 
Code
; Save, compile, then bring up strategy analyzer
#z::
IfWinActive, NinjaTrader.Custom - Microsoft Visual Studio
{
 Send ^s
 ControlSend,, {F5}, Indicator - CompileMe
 SetTitleMatchMode 2
 WinActivate, Strategy Analyzer
}
Windows key + Z saves the Visual Studio file I'm working on, compiles the CompileMe indicator in the background, and pop-ups the Strategy Analyzer to backtest the strategy.

 
Code
; Save, compile, Clear NinjaTrader output window, bring up Strategy Analyzer, Run a backtest, Show output window
#a::
IfWinActive, NinjaTrader.Custom - Microsoft Visual Studio
{
 Send ^s
 ControlSend,, {F5}, Indicator - CompileMe
 SetTitleMatchMode 2
 WinActivate, Strategy Analyzer
 Sleep, 3000
; clear & show ninjatrader output window
 ControlClick, x21 y45, Output,, R
  ControlSend,, {Down}, Output
  ControlSend,, {Enter}, Output
 Sleep, 1000
; Run the backtest
 ControlClick, Run Backtest, Strategy Analyzer
}
This script (under Windows key + A) does the following:
Save current Visual Studio file,
Compile the CompileMe indicator in the background,
Popup the Strategy Analyzer window,
Wait 3 seconds to ensure that the strategy is compiled in NinjaTrader,
Popup Output Window & clear this from the output from previous backtests,
Run the backtest.

As you can see, AutoHotKey is a great (& free ) way to automate frequent tasks.

Good luck!

Useful websites:
Hotkeys list - Hotkeys (Mouse, Joystick and Keyboard Shortcuts)
The ControlSend command - ControlSend / ControlSendRaw
The Send command - Send/SendRaw/SendInput/SendPlay/SendEvent: Send keys & clicks
The ControlClick command - ControlClick


Last edited by Jura; August 5th, 2010 at 07:59 AM. Reason: typo's
Reply With Quote
The following 13 users say Thank You to Jura for this post:

Reply



futures io > > > > > NinjaTrader and VS2010 for Dummies

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
DENNIS MILLER: MIDDLE EAST FOR DUMMIES tigertrader Off-Topic 0 October 16th, 2010 12:32 PM
Central Banking For Dummies ntsst3 Off-Topic 0 October 14th, 2010 11:43 PM
Can NinjaTrader data be stored other than \My Documents\NinjaTrader 6.5 tc12357 NinjaTrader 4 December 15th, 2009 02:55 PM
Programming for dummies - Help Ausy Mick NinjaTrader Programming 9 September 21st, 2009 01:33 PM


All times are GMT -4. The time now is 12:56 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-14 in 0.18 seconds with 20 queries on phoenix via your IP 54.221.93.187