![]() |
|
|||||||
| Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Apr 2010
Location: San Antonio, Texas
Posts: 315
Thanks: 31
Thanked 2 times in 2 posts
|
In the last few weeks, I have been running into a problem with order rejections from my broker (MBTrading). In discussions with them, it seems to be happening when my strategy tries to reverse a position. The sequence of order submission is placing the new position entry order BEFORE closing the previous position. In my case, I keep a minimum balance and having my pending orders basically doubled/tripled in size triggers a rejection and then disables my strategy.
As part of this event, I also get a note from NT that an overfill has occured. Any suggestions? Thanks.
Last edited by billr; 01-25-2011 at 05:21 AM.
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
|
Bill, overfills usually occur when trading too close to the inside market with multipe working orders changing state - http://www.ninjatrader.com/support/h...d_approach.htm - think of it like the inflight execution concerns.
For the reverse issue with MBT - does it only happen when you're Long?
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Apr 2010
Location: San Antonio, Texas
Posts: 315
Thanks: 31
Thanked 2 times in 2 posts
|
Not sure. this time is was from a long position trying to close and go short.
I don't know enough about the unmanaged topic to understand your reference. Sorry. It is something I can fix without going to unmanaged programming? |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
|
What method sequence are you using? On long equity positions, you for example can't submit an ExitLongLimit() followed by an ExitLongStop() as the second order will be rejected since MBT tags it as an order to reverse your position, the same applies to using SetProfitTarget() and then later on using SetStopLoss().
You do not have to go unmanaged, this link just provides a discussion of the topic of overfills and how to address it - you would need to review the sequence of events leading to the overfill to be able to understand how to improve the strategy. Unmanaged would just provide finer options here for you to selfhandle this situation in code.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Apr 2010
Location: San Antonio, Texas
Posts: 315
Thanks: 31
Thanked 2 times in 2 posts
|
Oh, I didn't know that about the SetProfitTarget and SetStopLoss issue. I have a strategy that uses SetProfitTarget and SetStopLoss initially, then may move StopLoss to new level as Position Profits hit targets. Sort of a very basic version of a one step trailing stop. Could that be causing this?
Thanks Bertrand. |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hi Bill,
Yes, it can happen when there are several working orders close to the market. As part of your stop loss modification, you may consider adjusting the remaining profit target so that both orders aren't near the market. Make sure also that your profit targets and stop losses refer to a specific fromEntrySignal.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Apr 2010
Location: San Antonio, Texas
Posts: 315
Thanks: 31
Thanked 2 times in 2 posts
|
The problem with that is by definition, reversing a position includes several orders that are close to market. If I send you my ninja script, can you tell me whether you see this problem inherent in how my positions are entered?
If not, do you have an example of how to handle closing an open position and entering a new position when strategy wants to reverse an open position? I am not well versed enough in NS to try implementing an unmanaged state. Thanks. |
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
|
Bill, we could take a look at your trace / logs to help you understand what's happening, unfortunately we would not be able to debug / modify the code - overfills and in-flight executions are an inherent risk in electronic trading, for best ways to address them through code the unmanaged mode needs to be used, as it could ignore overfills coming in so the strategy is then not shutdown as part of the strategy error handling.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Apr 2010
Location: San Antonio, Texas
Posts: 315
Thanks: 31
Thanked 2 times in 2 posts
|
I understand you can't de-bug. But I would like to sent you logs/trace to see what you think.
|
|
|
|
|
|
#10 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
|
Sure, I just got them and will take a look into.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Senior Member
Join Date: Apr 2010
Location: San Antonio, Texas
Posts: 315
Thanks: 31
Thanked 2 times in 2 posts
|
Bertrand, did you ever get a chance to check my logs/trace to see what might have been happening?
Thanks. |
|
|
|
|
|
#12 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
|
I believe so and replied to your email - have you checked your inbox? If not, please let me know and I'll try to resend it.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#13 |
|
Senior Member
Join Date: Apr 2010
Location: San Antonio, Texas
Posts: 315
Thanks: 31
Thanked 2 times in 2 posts
|
I don't think I received that email, or accidentally deleted it. (It was the same time you and I had discussed my ranting about MBT, so I may have been mixing them up with delete??
So if you still have it, a re-send would be appreciated. Thanks. Bill |
|
|
|
|
|
#14 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
|
o worries, will see if I can find it still and resend to you.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#15 | |
|
Senior Member
Join Date: Apr 2010
Location: San Antonio, Texas
Posts: 315
Thanks: 31
Thanked 2 times in 2 posts
|
Quote:
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Error: Order rejected for reason: Pending live orders affected order... | neoikon | ATM Strategies (Discretionary Trading) | 1 | 05-24-2010 09:04 AM |
| unrecognized escape sequence due to a "\" | tinkerz | General Programming | 1 | 03-11-2010 10:13 AM |
| Rejected Order - Sell stop limit orders can't be placed.... | TradingDreamer | General Programming | 4 | 12-09-2009 06:59 AM |
| Orders rejected as violating default order settings | tooearly | Strategy Development | 7 | 06-30-2009 10:25 AM |
| Use keyboard keys (or sequence) to enter orders | DoveforUsAll | ATM Strategies (Discretionary Trading) | 3 | 01-22-2006 03:14 PM |