Thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Insufficient Buying Power
Collapse
X
-
Compute it before you make the trade?Originally posted by kiss987 View PostHello
I meant how can I know by code and not visually that this is the reason.
After the trade it is impossible as the strategy is disabled. No code is going to run.
Comment
-
Hello kiss987,
Thanks for you reply.
Member sledge is correct your strategy will stop on error messages.
There is no internal support for bringing in provider error messages to your strategy. Not all providers use the same messages. All that you would know, in code, is that the order has been rejected.
You can monitor your account in your strategy which includes Buying power: http://ninjatrader.com/support/helpG...countvalue.htm
Comment
-
Not sure I'd completely agree with that statement.Originally posted by NinjaTrader_Paul View PostThere is no internal support for bringing in provider error messages to your strategy
In NT7, I would add the following to Initialize,
Then I check for rejected orders in OnOrderUpdate,Code:// strategy will handle OrderRejected errors itself RealtimeErrorHandling = RealtimeErrorHandling.TakeNoAction;
To further detect the reason for the order rejected error, I look at the string property called NativeError, documented here:Code:if (order.OrderState == OrderState.Rejected) { // handle error here }
The NativeError string property is defined as "A string representing the error message provided directly from the broker".
I was surprised to discover that NT8 no longer provides access to this error message in the 'Order' object. This seemed like a step backwards. However ...
In NT8, I found the NativeError message does still appear to be available -- it is now passed as the last argument to the NT8 OnOrderUpdate method, documented here,
I haven't upgraded my strategies to NT8, yet, but when I do, it looks like my plan of action will be:
1. Set 'RealtimeErrorHandling' to RealtimeErrorHandling.IgnoreAllErrors in State.Configure.
2. If OrderState == OrderState.Rejected in OnOrderUpdate, then interpret the last argument as the error message from the broker (aka NativeError).
I think Paul is being a little pedantic by saying 'no internal support' when he might really be meaning to say 'minimal support' -- I mean, clearly, there is some support, unless I am missing something ...
Paul? Patrick?
Comment
-
Sorry, I didn't follow my point to its logical conclusion.Originally posted by NinjaTrader_Paul View PostThere is no internal support for bringing in provider error messages to your strategy. Not all providers use the same messages. All that you would know, in code, is that the order has been rejected.
My first point was this: When an order is rejected, the error message from his broker is most certainly available. See my previous post.
My second point is this:
OP could do a bit of hard-coding here. I mean, even if the error messages are different from all providers, chances are the error message from his provider for this issue is consistently the same. So, OP should take advantage of that fact, and specifically look for that specific error message.
Unless OP is building a strategy that needs to be multi-provider aware, OP doesn't need to care so much about all the varying error messages -- just the one he sees from his provider.
Comment
-
Hello bltdavid,
Thanks for your replies.
I agree with your posts and thank-you for your clarifications and contributions.
To the OP I would also offer that it is important to understand that setting the real time error handling to "take no action" means that the strategy will no longer: "Default behaviour is to stop the strategy, cancel any remaining working orders, and then close any open positions managed by the strategy by submitting one "Close" order for each unique position."
The helpguide also offers this caution: "Setting this property value to "TakeNoAction" can have *serious* adverse affects on a running strategy unless you have programmed your own order rejection handling in the OnOrderUpdate() method
• User defined rejection handling is advanced and should *only* be addressed by experienced programmers"
Please review the full helpguide section here: http://ninjatrader.com/support/helpG...orhandling.htm
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
562 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