Thanks
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Insufficient Buying Power
Collapse
X
-
Hello kiss987,
Thanks for your post.
If there was a lack of margin there would be a pop-up window from NinjaTrader advising you that the order was rejected and why. The error would also appear in the "log" tab of the control center and in the log//trace files of the day.Paul H.NinjaTrader Customer Service
-
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.htmPaul H.NinjaTrader Customer Service
Comment
-
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,
Code:// strategy will handle OrderRejected errors itself RealtimeErrorHandling = RealtimeErrorHandling.TakeNoAction;
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
-
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.htmPaul H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by terofs, Yesterday, 04:18 PM
|
1 response
21 views
0 likes
|
Last Post
by terofs
Today, 10:14 AM
|
||
Started by CommonWhale, Today, 09:55 AM
|
1 response
3 views
0 likes
|
Last Post Today, 10:11 AM | ||
Started by Gerik, Today, 09:40 AM
|
2 responses
7 views
0 likes
|
Last Post
by Gerik
Today, 10:04 AM
|
||
Started by RookieTrader, Today, 09:37 AM
|
2 responses
12 views
0 likes
|
Last Post
by RookieTrader
Today, 10:02 AM
|
||
Started by alifarahani, Today, 09:40 AM
|
1 response
7 views
0 likes
|
Last Post Today, 10:01 AM |
Comment