OrderAction orderAction = OrderAction.NONE;
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
All NT API enums should have a NONE value...
Collapse
X
-
All NT API enums should have a NONE value...
I'm sure I'm not the first to say this... but it would be really nice if all enums in the NT API had a NONE (not set) type value to act as a null indicator.
Code:Tags: None
-
Hello defa0009,
There is not a None enum because that would not make for a valid order action from an order. The order actions are based on the valid selection that the brokers use which are
OrderAction.Buy
OrderAction.BuyToCover
OrderAction.Sell
OrderAction.SellShort
This is not a NinjaTrader specific decision, these represent the only available options for the brokers api's.
If you want to do something else in your script that requires a none action you would need to make your own enum that has that value and then use your enum logically to set the appropriate OrderAction enum where that will be used.
-
Brokers don't use the Ninjascript API... your backend converts it into the appropriate Broker's API value. Why would a developer send a OrderAction.NONE to your backend? And if they did send it by mistake your backend should handle it like it already handles any other mis-formed order (ie. sending an order with a quantity of 0, or sending an invalid price, etc.)
Would a Broker accept what you already have in your API... Ninjatrader.Cbi.OrderType.Unknown or Ninjatrader.Cbi.OrderState.Unknown? Just add Ninjatrader.Cbi.OrderAction.Unknown and Ninjatrader.Cbi.OrderType.Unknown.
'Unknown' or 'None' who cares... it makes the code design more flexible. Your backend handles all the translations before going to the Broker.
If you're always going to argue your point of view on every suggestion Ninja users make (which you do) they'll stop making suggestions and NinjaTrader will miss out on some good suggestions. In the future I suggest you make it easier on yourself and just say "Thanks for your suggestion. We will take it under consideration". End of conversation.
Comment
-
Hello defa0009,
The NinjaScript api is modeled after the brokers api and events and what they accept for parameters.
There is no None action, that would not make a valid order. Brokers require the order action to be specified when placing a trade. The events they send back also require to have a order action specified so we know what type of order it is.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
560 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
325 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
547 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment