NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 04-17-2012, 08:46 AM   #1
wyatt376
Member
 
Join Date: Feb 2012
Posts: 39
Thanks: 0
Thanked 0 times in 0 posts
Default Error " An over fill was detected "

Hi all,

i'm receiving a lotof this error: "An over fill was detected on order...",

in my strategy i enter on market with EnterLong()

set stoploss "intratrade" with SetStopLoss()

and close my position if i reached the stoploss or if i get the exit condition (my exit code is ExitLong() in this case)....

What is the cause of the error "An over fill was detected..."??
Beacause i use both SetStopLoss() and ExitLong() ?

thanks to all that answer to me!

wyatt
wyatt376 is offline  
Reply With Quote
Old 04-17-2012, 09:03 AM   #2
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
Default

Wyatt,

You can try the following : http://www.ninjatrader.com/support/h...reoverfill.htm

However it may cause a condition that isn't desired.

If you could post your code I would be happy to look over it an identify perhaps why an overfill is occurring.
NinjaTrader_AdamP is offline  
Reply With Quote
Old 04-18-2012, 12:37 AM   #3
wyatt376
Member
 
Join Date: Feb 2012
Posts: 39
Thanks: 0
Thanked 0 times in 0 posts
Default

an example, this is what's happen..



http://imageshack.us/photo/my-images/690/imageqbh.jpg/

there is both "StopLoss" reached and "Buy To Cover" for ExitShort... so, an over fill exception was throwed...

Any ideas?
wyatt376 is offline  
Reply With Quote
Old 04-18-2012, 07:37 AM   #4
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
Default

wyatt,

You probably have two exits being called at the same time due to two sets of conditions possibly occuring at the same time.

You could try to use If / Else if statements to separate your code logic into mutually exclusive conditions/actions, or you can try adding extra conditions into your if statements to make it so the two exits don't occur at the same time.

For example, suppose Condition1 and Condition2 could possibly happen at the same time.

Code:
if( Condition1 )
{
     // do action 1
}
else if ( Condition2 )
{
    // do action 2
}
This would make action1 and action2 impossible to happen at the same time, however if you have calculate on bar close = false it may still happen 1 tick later and you would need to account for that.

Please note that if you are in a long position for example, and you call EnterShort() and ExitLong() very shortly after it could possibly result in an overfill. This is just an example, not necessarily your case here. I would need to see how you are doing you order management in code to identify the precise reason here.
Last edited by NinjaTrader_AdamP; 04-18-2012 at 07:39 AM.
NinjaTrader_AdamP is offline  
Reply With Quote
Old 04-18-2012, 08:01 AM   #5
wyatt376
Member
 
Join Date: Feb 2012
Posts: 39
Thanks: 0
Thanked 0 times in 0 posts
Default

for that issue with your indication i found a way to solution,
but another problem was presented:



http://img811.imageshack.us/img811/9...nuovocaso2.jpg

in this image i retrieve another "over fill" error because i had a stoploss order with an exitlong order at the same time...
but i "launch" entrylong order in the first black circle... but is filled in the second black circle, just 4-5-6 candles after...

is there a solution for this error (not "over fill" but to much shifting of an order)??

thanks!
wyatt376 is offline  
Reply With Quote
Old 04-18-2012, 08:25 AM   #6
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
Default

Quote:
Originally Posted by wyatt376 View Post

in this image i retrieve another "over fill" error because i had a stoploss order with an exitlong order at the same time...
but i "launch" entrylong order in the first black circle... but is filled in the second black circle, just 4-5-6 candles after...

is there a solution for this error (not "over fill" but to much shifting of an order)??

thanks!
In the first instance, you would need to ensure this doesn't happen either with my previous suggestion, some order flags, or you could use OnExecution() and OnOrderUpdate() to help filter out certain trades for example, as these methods let you check order states.

As far as the second issue, I am not sure why that would happen. Are you using strictly "EnterLong"?

If you are reluctant to share code in the forum, you can send a support request to support at ninjatrader dot com with ATTN : Adam in the message body and a link to this thread. We don't share our customers code as this is treated strictly confidential.

Essentially, I would be able to offer much more specific advice if I could see the code.
NinjaTrader_AdamP is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Line inclination changes when I move it even "Snap Mode" set to "Disabled" IkerCB Miscellaneous Support 10 04-07-2011 01:46 PM
"ERROR: HISTBACKFILL "$INDU" Hdr: 400 Service FAILED " trader_rick1234 Version 7 Beta General Questions & Bug Reports 1 05-24-2010 08:01 AM
option to remove "buy ask" and "sell bid" on chart trader leontancfa Charting 1 07-01-2009 01:23 PM
summary of "strategy realized" is not equal "account performance, total net profit"" Fragolino Miscellaneous Support 1 02-19-2009 04:12 AM
Please add "Calmar" and "Sterling" ratios to Performance._Trades.TradesPerformance Elliott Wave Suggestions And Feedback 2 06-10-2008 09:57 PM


All times are GMT -6. The time now is 04:07 AM.