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 09-02-2008, 10:09 AM   #1
tradefaz
Senior Member
 
Join Date: Aug 2008
Posts: 109
Thanks: 0
Thanked 0 times in 0 posts
Default There seems to be two ways of doing order protection

There is the SetStopLoss and SetProfitTarget, which are sort of the easy way as I see it. Then as the sample shows there is the advanced way by using OnExecution and handling it yourself.

Would it be fair to say the most advanced implementations would use OnExecution?

My questions is if that's true, I take it you'd also have to handle scaling on your own in that event as well since the sample that shows scaling makes use of SetStopLoss, SetProfitTarget and SetTrailingStop().
tradefaz is offline  
Reply With Quote
Old 09-02-2008, 10:21 AM   #2
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

Correct. If you opt for using IOrders to manage your trade you will basically want to manual everything. It allows you the most flexibility in how you want to trade, but requires much more coding. If you feel the Set() methods provide enough functionality for your strategy then I would recommend just using those and save yourself the headache from the added complexity of IOrders.
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-02-2008, 12:38 PM   #3
tradefaz
Senior Member
 
Join Date: Aug 2008
Posts: 109
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Josh View Post
Correct. If you opt for using IOrders to manage your trade you will basically want to manual everything. It allows you the most flexibility in how you want to trade, but requires much more coding. If you feel the Set() methods provide enough functionality for your strategy then I would recommend just using those and save yourself the headache from the added complexity of IOrders.
So can the order protection sample be converted to do the same thing with the helper functions? Or will I need to do it manually? Like the breakeven, that is possible with the helper functions, I think you would just handle OnExecution, like in the sample?
tradefaz is offline  
Reply With Quote
Old 09-02-2008, 12:52 PM   #4
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

It is up to you which method you wish to use. You can still do things like breakeven with Set() methods as demonstrated in this reference: http://www.ninjatrader-support.com/v...ead.php?t=3222

The OnOrderUpdate()/OnExecution() example is there just to show you some basic functionality. I believe it can be done with Set() also. The purpose of the OnOrderUpdate() and other advanced methods is for people who wish to control their orders in different ways.
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-02-2008, 01:51 PM   #5
tradefaz
Senior Member
 
Join Date: Aug 2008
Posts: 109
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Josh View Post
It is up to you which method you wish to use. You can still do things like breakeven with Set() methods as demonstrated in this reference: http://www.ninjatrader-support.com/v...ead.php?t=3222

The OnOrderUpdate()/OnExecution() example is there just to show you some basic functionality. I believe it can be done with Set() also. The purpose of the OnOrderUpdate() and other advanced methods is for people who wish to control their orders in different ways.
So basically I guess you can still use those events, but with the Set() methods to make it easier. Sounds good. Thx.
tradefaz is offline  
Reply With Quote
Old 09-02-2008, 02:16 PM   #6
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

Right. Just keep in mind that Set() do not produce IOrder objects.
NinjaTrader_Josh 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
Best ways to trade live with 2 broker connection/account? pipal Connecting 13 07-22-2008 05:58 AM
protection level error on compile ATI user General Programming 11 03-08-2008 01:38 PM
Password protection ct Suggestions And Feedback 14 01-28-2008 02:53 AM
Protection Level goldfly Strategy Development 2 06-09-2007 11:30 AM
Submit Limit Entry Order and Stop Loss Order at same time? aspTrader Miscellaneous Support 2 10-04-2006 02:40 AM


All times are GMT -6. The time now is 02:57 PM.