NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 11-08-2009, 09:38 PM   #1
r2kTrader
Senior Member
 
Join Date: Sep 2008
Posts: 483
Thanks: 0
Thanked 2 times in 2 posts
Default Undocumented/Unsupported Ninja Tips and Tricks

This thread has been started to see if there is anyone interested in joining me to help start a Development Wiki, devoted to expanding Ninja in areas that are currently not supported or documented.

I will post some undocumented tips and tricks that you may find helpful. If you have one, please post it as well.

The idea is to use this thread as a starting point for the wiki. I may or may not actually do this, it will depend on the interest of the forum and others to help as I am a beginning programmer.

Please state if your tip/trick is for NT7, NT6.5.x or both.

Quote:
Originally Posted by NinjaTrader_Dierk View Post
Just a few words of warning aka disclaimer:
- we appreciate the concept of "users helping users"
- any undocumented feature is exactly that: it's undocumented, meaning we are unable to provide support for it nor are we able to provide any support for issues which ultimately could arise from using undocumented features
- any undocumented feature might be gone as you update/upgrade NT. There is no guarantee that NT might:
* work as expected or
* even start up after upgrading/updating.

Be prepared to experience the unexpected and be ready to resolve the unexpected as you use undocumented features
Thank you,
Last edited by r2kTrader; 11-09-2009 at 12:06 AM.
r2kTrader is offline  
Reply With Quote
Old 11-08-2009, 09:41 PM   #2
r2kTrader
Senior Member
 
Join Date: Sep 2008
Posts: 483
Thanks: 0
Thanked 2 times in 2 posts
Default Auto Load a Workspace from a Strategy - 6.5

Have you ever wanted to load a workspace from within a strategy or when you start a certain strategy? Now you can. Just drop this line in your initialize() and change to your liking.

NinjaTrader.Gui.WorkspaceOptions.SwitchWorkspace("D:\\Documents and Settings\\User\\My Documents\\NinjaTrader 6.5\\workspaces\\123.xml", true);

If anyone is interested, you can use a similar technique to "auto-save" your workspace throughout the day.
r2kTrader is offline  
Reply With Quote
Old 11-08-2009, 10:09 PM   #3
r2kTrader
Senior Member
 
Join Date: Sep 2008
Posts: 483
Thanks: 0
Thanked 2 times in 2 posts
Default FTP - Upload Your Strategy To Your Blog - 6.5

Apparently NT has an FTP class for logging into a server and executing a series of commands.

This could be very useful if you want to provide your signals to a website for your subscribers.

It's found in "NinjaTrader.Cbi.Ftp"

There will need to be more work done on this, but I am going to work on a class that can be used to pump buy/sell signals to a pay for signal website. I know, I know, Collective2 or whatever, but this is your own and would run in wordpress and allow you to personalize the whole experience.

If there is an advanced programmer out there who would like to work with me on this project. Please PM me. I have the Linux boxes and a small hosting company and I know how to use OpenSource solutions to manage the other side of the equation. Namely taking the signal that is FTP'd to the server and putting it up on the website.

Again, please contact me if you want to help. This is a another example of how the development wiki could play a key role in helping provide starting places for people with ideas and needs, but that transcend the current limitations of support.

You probably don't need to use their FTP Class to accomplish this, but I just thought it was interesting. You could just as easily use any SFTP .NET library to poll a File that you streamwrite to, or even have a socket that you write to that is pumped right over.

This is a solution that would be used for a situation where you don't want to run NT on a windows server that also does the hosting. In my case I have Linux boxes (dedicated servers) and I would want to pump signals and results in realtime as well as Graphics images that provide a snapshot of the signal, etc.

You could also run your own little "Collective2" type service.

[UPDATE]
After some further thought, the ftp might be useful for uploading chart snapshots to your website. As far as real time signals, etc., it would probably be best to use a direct connection to a mysql database on your linux server (this post was primarily for those who use linux and want a bridge to get signals and the like from their NT strategies/indicators).
Last edited by r2kTrader; 11-08-2009 at 11:30 PM.
r2kTrader is offline  
Reply With Quote
The following user says thank you to r2kTrader for this post:
Old 11-08-2009, 10:39 PM   #4
r2kTrader
Senior Member
 
Join Date: Sep 2008
Posts: 483
Thanks: 0
Thanked 2 times in 2 posts
Default TimeInForce = Fill Or Kill? NT 6.5

Here are some other options for TimeInForce you might want to play with.

Remember, none of this is supported by Ninja.

TimeInForce = Cbi.TimeInForce.Ioc; // Fill or kill
TimeInForce = Cbi.TimeInForce.Opg; // Order on Open (interesting??)
TimeInForce = Cbi.TimeInForce.Gtd; // Good Till Date (instead of GTC)

I recommend playing with these and of course testing before committing real capital. The one of interest to come clip traders may be the fill or kill.


Enjoy
r2kTrader is offline  
Reply With Quote
Old 11-08-2009, 11:29 PM   #5
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

Just a few words of warning aka disclaimer:
- we appreciate the concept of "users helping users"
- any undocumented feature is exactly that: it's undocumented, meaning we are unable to provide support for it nor are we able to provide any support for issues which ultimately could arise from using undocumented features
- any undocumented feature might be gone as you update/upgrade NT. There is no guarantee that NT might:
* work as expected or
* even start up after upgrading/updating.

Be prepared to experience the unexpected and be ready to resolve the unexpected as you use undocumented features
NinjaTrader_Dierk is offline  
Reply With Quote
Old 11-09-2009, 12:27 AM   #6
r2kTrader
Senior Member
 
Join Date: Sep 2008
Posts: 483
Thanks: 0
Thanked 2 times in 2 posts
Default FlattenEverything() Programmatically - NT 6.5

This is a nifty little snippet.

Did you ever have the need to "Flatten Everything". All strategies, and all open orders. Just get flat!

NinjaTrader.Gui.SuperDom.SuperDom.FlattenEverythin g();

I tested it and it seems to work ok. It killed all my strategies and got me flat on any orders that work working. I mean it took me FLAT! And fast.

Test and use at your own risk.
r2kTrader is offline  
Reply With Quote
Old 11-09-2009, 01:26 PM   #7
MicroAl
Senior Member
 
Join Date: Jan 2008
Posts: 183
Thanks: 0
Thanked 1 time in 1 post
Default Windows Forms

Folls came up with a way of launching a windows form using a
windows strategy

http://www.ninjatrader-support2.com/...+Studio&page=2

I understand the form construction etc but can anyone show how to get information from ninja eg from a variable to the form. From what I can see Ninja is launching the form but no information is being transmitted.

What I am looking for is a way for ninja to produce a result from the on bar update method, and to transmit it to the form.

I am not expecting detailed code but an idea in principle would be welcome.

Great Thread but think the Ninja people should make it into a main thread,
ie underneath General Programming etc
MicroAl is offline  
Reply With Quote
Old 11-09-2009, 01:30 PM   #8
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

MicroAl,

Since it is an old thread we will be leaving it there so people looking back for it won't get confused.
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-09-2009, 01:43 PM   #9
MicroAl
Senior Member
 
Join Date: Jan 2008
Posts: 183
Thanks: 0
Thanked 1 time in 1 post
Default Undocumented/Unsupported Ninja Tips and Tricks

Sorry Josh some confusion I meant having a main Undocumented/Unsupported Ninja Tips and Tricks thread at the top of the directory so to speak.

You may find that Ninja gets extended in ways that even you people
never thought of
MicroAl is offline  
Reply With Quote
Old 11-09-2009, 01:46 PM   #10
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Thanks for the suggestion.
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-09-2009, 07:30 PM   #11
r2kTrader
Senior Member
 
Join Date: Sep 2008
Posts: 483
Thanks: 0
Thanked 2 times in 2 posts
Default

Micro,

That was the purpose of this thread, so thank you for your comments.

Thanks,




Quote:
Originally Posted by MicroAl View Post
Folls came up with a way of launching a windows form using a
windows strategy

http://www.ninjatrader-support2.com/...+Studio&page=2

I understand the form construction etc but can anyone show how to get information from ninja eg from a variable to the form. From what I can see Ninja is launching the form but no information is being transmitted.

What I am looking for is a way for ninja to produce a result from the on bar update method, and to transmit it to the form.

I am not expecting detailed code but an idea in principle would be welcome.

Great Thread but think the Ninja people should make it into a main thread,
ie underneath General Programming etc
r2kTrader is offline  
Reply With Quote
Old 11-10-2009, 07:31 AM   #12
eDanny
Senior Member
 
eDanny's Avatar
 
Join Date: Jul 2008
Location: East Rochester, NY
Posts: 899
Thanks: 0
Thanked 19 times in 17 posts
Default

I believe this thread should be linked/included here.

Using GDI+ methods to draw anything.

http://www.ninjatrader-support2.com/...ad.php?t=21935
Last edited by eDanny; 05-13-2010 at 11:46 AM.
eDanny is offline  
Reply With Quote
Old 11-11-2009, 07:22 AM   #13
eDanny
Senior Member
 
eDanny's Avatar
 
Join Date: Jul 2008
Location: East Rochester, NY
Posts: 899
Thanks: 0
Thanked 19 times in 17 posts
Default

Checking for the existence of a file with System.IO

http://www.ninjatrader-support2.com/...676#post126676
Last edited by eDanny; 11-26-2009 at 06:39 PM.
eDanny is offline  
Reply With Quote
Old 11-11-2009, 03:30 PM   #14
r2kTrader
Senior Member
 
Join Date: Sep 2008
Posts: 483
Thanks: 0
Thanked 2 times in 2 posts
Default

eDanny,

Thank you for contributing. Could you please leave a brief note in the TITLE or preceding the link so people know what is is for?

Thanks!
Quote:
Originally Posted by eDanny View Post
r2kTrader is offline  
Reply With Quote
Old 11-20-2009, 06:49 AM   #15
eDanny
Senior Member
 
eDanny's Avatar
 
Join Date: Jul 2008
Location: East Rochester, NY
Posts: 899
Thanks: 0
Thanked 19 times in 17 posts
Default

Although not unsupported info, here is a discussion on serialization which can be helpful.
http://www.ninjatrader-support2.com/...884#post128884
eDanny is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tips using Alert() anothertoy Strategy Analyzer 3 10-26-2009 08:56 AM
Need tips for a strategy barrosco Miscellaneous Support 2 02-20-2009 01:01 PM
Unsupported instrument astrolobe Connecting 1 02-03-2009 03:29 AM
some tips when using vista qwert12 Installation and Licensing 1 06-30-2008 11:29 PM
Unsupported Instrument astrolobe Historical NinjaTrader 6.5 Beta Threads 7 03-29-2008 07:50 PM


All times are GMT -6. The time now is 04:43 PM.