Some coding practices when using VS with NinjaTrader - NinjaTrader | futures io social day trading
futures io futures trading


Some coding practices when using VS with NinjaTrader
Updated: Views / Replies:506 / 3
Created: by BMMA14 Attachments:0

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
 

Some coding practices when using VS with NinjaTrader

  #1 (permalink)
Elite Member
Montreal,Quebec/Canada
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex
 
Posts: 17 since Jun 2014
Thanks: 5 given, 15 received

Some coding practices when using VS with NinjaTrader

Hi everyone

I have recently joined BigMike's forum and I would like to contribute some of my experiences in using Visual Studio along with NinjaTrader. Some of these have been possibly mentioned by other forum users before, nevertheless if so I hope that's ok.

I have been experimenting with Ninjatrader for a short while. My aim was to be able to call a class library from NT script. By error & trial(note that I used some forum discussions and tips as well), I came upon some steps that needs to be taken carefully, in order for a script to work properly. Below I would like to share the conclusions of some of my experiences.

1-Always compile your class libraries into c>users....>MyDocuments>NinjaTrader7>bin>Custom. If compiled somewhere else, it works sometimes but not all the time. I don't know the internals of NT well enough to explain this.
2-Place your project under the same directory. (I am using Win7 pro)
3-Use Net 3.5 for your class library.
4-Create the template of your indicator always in NT (NT creates bunch of extra C# code)
5-When adding your indicator into VS project add it as "Link"

These are the ones coming into my mind at the moment. Feedback/corrections are welcome and I hope it may help others.

Reply With Quote
The following 3 users say Thank You to BMMA14 for this post:
 
  #2 (permalink)
Elite Member
Portland Oregon, United States
 
Futures Experience: Beginner
Platform: Ninjatrader®
Broker/Data: CQG, Kinetick
Favorite Futures: Gameplay Klownbine® Trading of Globex
 
Zondor's Avatar
 
Posts: 1,327 since Jul 2009
Thanks: 1,246 given, 2,635 received

Applications?

Would be very interested in learning about some of your applications of these techniques.

I don't know if this would be one, but I would like to be be able to use an object that is just like the DataSeries object, but has a fixed, user defined number of elements - with a fixed element count, it could be based on the C# array, rather than the list.

This would be perfectly adequate for many places where the DataSeries is used, with a big reduction in memory and CPU consumption since the number of elements to be managed would often be much less than 256, and much less than the number of bars on the chart.

Another worthy goal would be the ability to create an object that works just like an instrument but is based on the weighted sum of more than one instrument. Yes, this can be done in an indicator, but having something that behaves just like a regular instrument would have some advantages.

(While I am good at making Ninjatrader indicators run efficiently, my mastery of C# is narrow and limited.)

"If we don't loosen up some money, this sucker is going down." -GW Bush, 2008
“Lack of proof that something is true does not prove that it is not true - when you want to believe.” -Humpty Dumpty, 2014
“The greatest shortcoming of the human race is our inability to understand the exponential function.”
Prof. Albert Bartlett
Reply With Quote
 
  #3 (permalink)
Elite Member
Montreal,Quebec/Canada
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex
 
Posts: 17 since Jun 2014
Thanks: 5 given, 15 received

Follow Up on Experimentations with VS


For anyone reading this thread, there is another thread which I would like to re-iterate here. The thread is called NT & VS for Dummies and includes very useful information. Check it out (https://futures.io/ninjatrader-programming/4781-ninjatrader-vs2010-dummies.html)

Secondly, I managed to crash today NT completely. Well, this may be one of the side effects of using Visual Studio. You got to be very careful, especially with NT DLLs (like .Core), meaning where you place them etc. I am planning to write a thorough document for myself, in order to follow it up at the next crash. I will post it here as well, for anyone willing to use it as a first aid reference. Coming back to today's crash. I was copying some existing classes into my class library (the one I am using in my indicator). The classes I imported required NT DLLs as reference. As sson as I imported the DLLs into th reference of the library project, boom sth. happened and the next time I hit F5, NT wasn't launching. I couldn't even launch NT standalone. Error log was directing me to NinjaTrader.Core.DLL. I had to totally scrap NT from my computer (yes, uninstalling first thru windows and then completely erasing all leftover NT Folders from Windows Explorer). My assumption is that possibly I have referenced a copy of the NT Core DLL which was residing somewhere else in my computer (It dawned on me, after I wiped out NT though). So the lesson learned is: When using NT along with VS, one should be extremely tedious and keep all the references in a VS solution same (meaning you only use one NT DLL location). Tomorrow I will go through the process again to link NT back to my class library (following the post listed above).
Tomorrow I will also try to use a static class within my class library to see if it works. The reason being is that I would like to pass variables to and from my main C# business model to NT without the need of class instantiation. That would remove the need of passing class object reference. Well, I'll see how it will work.

Reply With Quote
The following user says Thank You to BMMA14 for this post:
 
  #4 (permalink)
Elite Member
Montreal,Quebec/Canada
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex
 
Posts: 17 since Jun 2014
Thanks: 5 given, 15 received


Zondor View Post
Would be very interested in learning about some of your applications of these techniques.

I don't know if this would be one, but I would like to be be able to use an object that is just like the DataSeries object, but has a fixed, user defined number of elements - with a fixed element count, it could be based on the C# array, rather than the list.

This would be perfectly adequate for many places where the DataSeries is used, with a big reduction in memory and CPU consumption since the number of elements to be managed would often be much less than 256, and much less than the number of bars on the chart.

Another worthy goal would be the ability to create an object that works just like an instrument but is based on the weighted sum of more than one instrument. Yes, this can be done in an indicator, but having something that behaves just like a regular instrument would have some advantages.

(While I am good at making Ninjatrader indicators run efficiently, my mastery of C# is narrow and limited.)

Once in VS, anything can be done (well that what I assume at the moment at least). My approach is to use NT script with minimum code and use class libraries to do what I would like to do. So NT Script is just a front end which provides some basic info to my business model running in the background. I will only post some annotations on chart display reflecting the computed outcome of the background machine. Therefore I need a very stable link in between my VS Class libs and NT.

Reply With Quote

Reply



futures io > > > > Some coding practices when using VS with NinjaTrader

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
Some Basic NinjaTrader Coding Questions -- IDataSeries Crow NinjaTrader Programming 7 October 15th, 2017 04:49 AM
Coding Multi Time Frame (MTF) Indicators with NinjaTrader Fat Tails NinjaTrader 411 June 28th, 2016 08:34 AM
Auto Trading Best Practices pbailey19 Elite Automated NinjaTrader Trading 4 May 7th, 2014 10:53 PM
Coding NinjaTrader with F# AstralTrader NinjaTrader Programming 5 October 22nd, 2012 03:00 PM
Best Practices for Scaling In/Out with Ninja DOM HJay Traders Hideout 1 August 8th, 2009 04:19 PM


All times are GMT -4. The time now is 02:39 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-12 in 0.10 seconds with 19 queries on phoenix via your IP 54.90.207.75