View Full Version : Unmanaged Order Submission
NinjaTrader_Ray
10-05-2009, 09:04 AM
Hi All,
As of this post, we have yet to document the new unmanaged order handling in strategies.
This is a quick pointer.
- In Initialize() set "Unmanaged" to a value of "True"
- This will disable all internal order handling rules
- You now "can and must" place orders using the new SubmitOrder() method, all other order entry methods will be ignored
hemlock
10-21-2009, 07:28 AM
With unmanged order submission, what is the best way to modify an existing order? Say I want to change the limit price of an existing limit order.
Thanks.
NinjaTrader_Dierk
10-21-2009, 07:55 AM
Please try the .ChangeOrder() method.
hemlock
10-21-2009, 07:59 AM
Ah, that makes sense. I looked for a ModifyOrder (that's what I call it in my code), never thought to look for ChangeOrder. Thanks Dierk.
NinjaTrader_Josh
10-21-2009, 08:36 AM
Just another pointer, the familiar CancelOrder() method is also used for Unmanaged since unmanaged orders will not auto cancel/expire and will need to be done by your code when desired.
hemlock
10-21-2009, 09:43 AM
Thanks for the pointer Josh.
The unmanaged order submission methods (SubmitOrder() and ChangeOrder()) seem to working nicely. Good job.
Also, thanks for removing the popup dialog at the end of a compile. Greatly appreciated.
trend
10-22-2009, 03:39 PM
Hi is there any special overload on SubmitOrder() for Market Orders?
So that you don't have to post anything for Limit/Stop Prices and "OCO"
L0=SubmitOrder(0,OrderAction.Buy,OrderType.Market, 1,100000,0,"OCO", "L0");
thanks,
NinjaTrader_Ray
10-22-2009, 03:47 PM
Hi is there any special overload on SubmitOrder() for Market Orders?
So that you don't have to post anything for Limit/Stop Prices and "OCO"
L0=SubmitOrder(0,OrderAction.Buy,OrderType.Market, 1,100000,0,"OCO", "L0");
thanks,
No, any value put in I believe is just ignored. Just pass in zero's and empty string for OCO.
Chris_M
10-25-2009, 12:23 AM
"Unmanaged = true" gives an error in initialize. What is the correct spelling?
Regards,
Chris
Hi All,
As of this post, we have yet to document the new unmanaged order handling in strategies.
This is a quick pointer.
- In Initialize() set "Unmanaged" to a value of "True"
- This will disable all internal order handling rules
- You now "can and must" place orders using the new SubmitOrder() method, all other order entry methods will be ignored
NinjaTrader_Dierk
10-25-2009, 04:16 AM
It always helps saving time you and us if you provided error description as exact (!) as possible. Not sure what you mean by "gives an error". Compile error? Runtime error? else?
Anyway: I added this line of a code to a blank strategy compiled it and enabled it on a chart. Worked no problem. No compile nor runtime error.
Unmanaged = true;
Chris_M
10-25-2009, 06:29 AM
I'm receiving compile error CS0103 (Unmanaged unknown), when I call it in the Initialize()-method. Do I have to manually add an include? Mine are
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
Many thanks for your help,
Christian
Edit: Oh, I see this is the bug report thread for version 7, but I'm using 6.5.1000.14. Is it possible to use unmanaged code with this version?
It always helps saving time you and us if you provided error description as exact (!) as possible. Not sure what you mean by "gives an error". Compile error? Runtime error? else?
Anyway: I added this line of a code to a blank strategy compiled it and enabled it on a chart. Worked no problem. No compile nor runtime error.
Unmanaged = true;
NinjaTrader_Dierk
10-25-2009, 09:25 AM
>> possible to use unmanaged code with this version?
No
Aussie2
10-25-2009, 08:59 PM
Hi All,
As of this post, we have yet to document the new unmanaged order handling in strategies.
This is a quick pointer.
- In Initialize() set "Unmanaged" to a value of "True"
- This will disable all internal order handling rules
- You now "can and must" place orders using the new SubmitOrder() method, all other order entry methods will be ignored
Please advise with NT7B2 when Unmanaged=true and therfore internal order handling rules are disabled, whether the SetStopLoss() method is also disabled.
Thanks.
NinjaTrader_Dierk
10-26-2009, 12:44 AM
The SetStopLoss/SetTrailStop/SetProfitTarget methods won't work when your strategy is in Unmanaged=true mode.
Aussie2
10-26-2009, 06:37 AM
The SetStopLoss/SetTrailStop/SetProfitTarget methods won't work when your strategy is in Unmanaged=true mode.
Thanks for this Dierk,
Would you also confirm about the converse in NT7B2 . Namely will SubmitOrder() or ChangeOrder()work when in the Unmanaged=false mode?
NinjaTrader_Ray
10-26-2009, 08:07 AM
Thanks for this Dierk,
Would you also confirm about the converse in NT7B2 . Namely will SubmitOrder() or ChangeOrder()work when in the Unmanaged=false mode?
Will not work.
Aussie2
11-01-2009, 04:32 AM
Another question.
If I have entered a buy limit order with the SubmitOrder()method, and then need it changed to a market order, presumably I could use the ChangeOrder method and set the stopPrice to the current bid and effectively have a market order.
If this is correct what should I set the limitPrice field to in the ChangeOrder() signature? Does a value of 0 mean no limit order is being used as with market orders in the SubmitOrder() method?
Thanks.
NinjaTrader_Dierk
11-01-2009, 06:06 AM
>> If I have entered a buy limit order with the SubmitOrder()method, and then need it changed to a market order
NT would not support changing the order type. You need to cancel and resbumit a new market order.
Aussie2
11-01-2009, 06:21 AM
>> If I have entered a buy limit order with the SubmitOrder()method, and then need it changed to a market order
NT would not support changing the order type. You need to cancel and resbumit a new market order.
Thanks Dierk for your quick response. Much appreciated. Will use the cancel and resubmit market order approach.
Aussie2
11-01-2009, 03:33 PM
Am I correct in assuming that when Unmanaged==true, and OnExecution() code determines an IOrder is ".Filled" or ".Cancelled", then code must be used to reset the IOrder to null as it does not happen automatically?
Thanks.
NinjaTrader_Ray
11-01-2009, 03:49 PM
If you hold a reference to IOrder (variable that holds an IOrder object), you should set it to null if you have logic that checks for null reference.
For example:
if (entryOrder == null)
entryOrder = SubmitOrder(...);
Aussie2
11-01-2009, 04:08 PM
Thanks Ray much appreciated.
NinjaTrader_Josh
11-02-2009, 10:05 AM
Resetting to null is up to you. If you do not reset to null you will continue holding onto the reference for the terminal stated order. If that is something you need you can continue holding onto it. Otherwise resetting it to null will allow you to trade again with logic checks that check for the IOrder to be null.
Aussie2
11-02-2009, 02:47 PM
Resetting to null is up to you. If you do not reset to null you will continue holding onto the reference for the terminal stated order. If that is something you need you can continue holding onto it. Otherwise resetting it to null will allow you to trade again with logic checks that check for the IOrder to be null.
... and presumably if you want to continue holding onto the reference then you could associate the IOrder to a single or multi dimensional "array"
Thanks Josh
NinjaTrader_Josh
11-02-2009, 03:14 PM
Aussie2,
For the most part, after a trade is done I recommend just using the TradeCollection class. Unless you have a specific reason you want to hold onto IOrders?
r2kTrader
11-16-2009, 03:05 PM
Trend,
You could create your own overload so you don't have to put in dummy info each time ;-)
Just put it in your userDefinedMethods file or your own Partial Class.
Set it so that you only have to pass those values that will change as it relates to the way you want to use the method, then pass that to the original method, but with the dummy values pre-filled.
I do something similar with the EnterLongLimit() methods whereby I can pass the stoploss and profit target all in one method sig, this way I don't have to worry about the signal, name etc. as it's all passed in one string and the accompanying Profit/Stop is all linked to the same order ;-)
Simple, and highly effective/clean.
Hi is there any special overload on SubmitOrder() for Market Orders?
So that you don't have to post anything for Limit/Stop Prices and "OCO"
L0=SubmitOrder(0,OrderAction.Buy,OrderType.Market, 1,100000,0,"OCO", "L0");
thanks,
r2kTrader
11-19-2009, 03:32 PM
Support,
Could you please direct me to any references as they may related to the new order handling features.
Aside from a few posts in the forum, I am unable to find anything. Obviously the help can't do much for the time being.
1. Can I assume SubmitOrders are live until cancelled?
2. What is the different between SO and EnterLong, or other Enter methods? Do those go out the windows when Unmanaged = true?
I guess those are two obvious questions, but I would like to know where I can find more info so I can get this class finished. :o
Thank you
NinjaTrader_Austin
11-19-2009, 03:38 PM
1) Yes, SubmitOrders are live until cancelled.
2) It is not possible to mix the standard entry methods after setting Unmanaged = true.
There is a reference sample due to be posted soon, but basically there are only three methods to use with these unmanaged strategies: SubmitOrder(), ChangeOrder(), and CancelOrder().
r2kTrader
11-19-2009, 03:53 PM
Also, thanks for removing the popup dialog at the end of a compile. Greatly appreciated.
But I do find myself checking my email after I compile...:rolleyes:
r2kTrader
11-19-2009, 03:57 PM
1) Yes, SubmitOrders are live until cancelled.
2) It is not possible to mix the standard entry methods after setting Unmanaged = true.
There is a reference sample due to be posted soon, but basically there are only three methods to use with these unmanaged strategies: SubmitOrder(), ChangeOrder(), and CancelOrder().
Austin,
Nice response time!
Ok, just to be clear. If you set Unmanaged = true, then you use SubmitOrders and ChangeOrders, and you would forget about Enter and Set methods, correct? (I think this is much more elegant, I'm fired up because now I can just have a generic entry and change the variable of the entry line to buy sell. It saves me the time to write my own overloads. I think??, lol. What's sad is a wrote a whole class for 6.5 that essentially mimicks what is achieved now with the SubmitOrder dilio :-()
Thanks,
NinjaTrader_Austin
11-19-2009, 04:03 PM
r2kTrader, you are correct in your assumptions.
r2kTrader
11-19-2009, 04:05 PM
Austin,
Something to consider for intellisense. If Unmanaged = True, don't show the non-valid methods? The inverse if False.
Just a suggestion. It would be a tad cleaner. Probably help to avoid a lot of questions as well?? Less strain on support?
r2kTrader, you are correct in your assumptions.
NinjaTrader_Austin
11-19-2009, 04:08 PM
Indeed, that does sound like a good idea. Intellisense is a Microsoft technology, so I'm not sure if this is possible... Either way, I'll forward the request along.