NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

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.

Reply
 
Thread Tools Display Modes
Old 01-09-2009, 01:15 PM   #1
kiwibird
Member
 
Join Date: Sep 2007
Posts: 88
Thanks: 0
Thanked 0 times in 0 posts
Default Exception Trapped

any idea why this happened.
here is the log and trace file.
do i need to restart ninja after this?
1/9/2009 10:31:02 AM|1|32|Order='5292803/26294!Dorman!Dorman' Name='External' New State=Cancelled Instrument='GC 02-09' Action=Buy Limit price=0 Stop price=864 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
1/9/2009 10:50:25 AM|1|1|AT, 'PLACE;Sim101;ES 03-09;SELL;1;LIMIT;892.00;0;DAY;oco1clightES;idname1; clightes;stratidclightES1' processing



2009-01-09 10:31:02:928 (PETER) Cbi.OrderStatusEventArgs.Process: Order='5292803/26294!Dorman!Dorman' Name='External' New State=Cancelled Instrument='GC 02-09' Action=Buy Limit price=0 Stop price=864 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
2009-01-09 10:50:25:288 in OnUnhandledApplicationException
2009-01-09 10:50:25:288 ********* exception trapped *********
2009-01-09 10:50:25:288 Item has already been added. Key in dictionary: 'Sim101' Key being added: 'Sim101'
2009-01-09 10:50:25:288 System.ArgumentException: Item has already been added. Key in dictionary: 'Sim101' Key being added: 'Sim101'
at System.Windows.Forms.Control.MarshaledInvoke(Contr ol caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at NinjaTrader.Cbi.SynchronizeInvoke.Invoke(Delegate method, Object[] args)
at NinjaTrader.Cbi.AutoTrade.OnFswChanged(Object sender, FileSystemEventArgs e)
at System.IO.FileSystemWatcher.OnChanged(FileSystemEv entArgs e)
at System.IO.FileSystemWatcher.NotifyFileSystemEventA rgs(Int32 action, String name)
at System.IO.FileSystemWatcher.CompletionStatusChange d(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* overlappedPointer)
at System.Threading._IOCompletionCallback.IOCompletio nCallback_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Objec t userData)
at System.Runtime.CompilerServices.RuntimeHelpers.Exe cuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(Exec utionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading._IOCompletionCallback.PerformIOCo mpletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
kiwibird is offline  
Reply With Quote
Old 01-09-2009, 01:28 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

What did you happen to be doing when this occurred?
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-09-2009, 01:33 PM   #3
kiwibird
Member
 
Join Date: Sep 2007
Posts: 88
Thanks: 0
Thanked 0 times in 0 posts
Default

a oif order ws written and that caused the crash.
the order should have been similar to this one below
(generated thought the oif generator)
PLACE;SIM101;ES 03-09;SELL;1;LIMIT;899.00;0;DAY;oco1bclightES;idname5 ;clightes;stratidclightes1b

this line below was written via tradestation file write.
it causes the crash again.
PLACE;Sim101;ES 03-09;SELL;1;LIMIT;898.75;0;DAY;oco1clightES;idname2; clightes;stratidclightES2
the ts code used is below
vars:ep(0),gmt(0),
StrategyName("clightes"),Contractname("ES"),stratid(1),atm("clightes");
ep=close+10;
gmt=time*100;
fileappend("t:\OIF-Se-"+numtostr(oifNo,0)+"-" +NUMTOSTR(DATE,0)+"-"+ NUMTOSTR(GMT,0)+"se"+StrategyName+Contractname+".t xt",
"PLACE;"+ninjaaccount+";"+ninjaSymbol+";SELL;1;LIM IT;"+numtostr(ep,2)+";0;DAY;oco1"+StrategyName+con tractname+";idname"+numtostr(stratid,0)+";"+atm+"; stratid"+StrategyName+CONTRACTname+numtostr(strati d,0)+newline);
later note, in comparing the lines they are idential in function.

Last edited by kiwibird; 01-09-2009 at 02:23 PM.
kiwibird is offline  
Reply With Quote
Old 01-09-2009, 01:40 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

I have forwarded this to development. They should respond by Monday. Have a good weekend.
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-09-2009, 02:24 PM   #5
kiwibird
Member
 
Join Date: Sep 2007
Posts: 88
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi Josh,
i added more to me 233pm post.
I put in more ts code, and compared the lines of text.
they are identical in function.
the filename will be something like
OIF-Se-1-1090109-153204seclightES.txt
Last edited by kiwibird; 01-09-2009 at 02:33 PM.
kiwibird is offline  
Reply With Quote
Old 01-09-2009, 02:26 PM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Thank you kiwibird. Development is off for the day already. They will respond after the weekend.
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-09-2009, 02:41 PM   #7
kiwibird
Member
 
Join Date: Sep 2007
Posts: 88
Thanks: 0
Thanked 0 times in 0 posts
Default

later note.
i tested this again from tradestation, and it worked perfectly.
so i have only been able to reproduce the problem once
kiwibird is offline  
Reply With Quote
Old 01-12-2009, 08:41 AM   #8
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

kiwibird,

We will need a reproducible scenario before we can proceed. If you manage to find one please let us know. Thank you.
NinjaTrader_Josh 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
Editor exception guy Indicator Development 8 12-06-2009 10:43 AM
Help with Exception Logic shawnj General Programming 6 12-08-2008 06:21 AM
Strange exception TheChingachgook Strategy Development 3 10-31-2008 09:45 AM
Unhandled Exception adrian Installation and Licensing 6 03-13-2008 12:49 PM
Unhandled Exception HudsonTrader Miscellaneous Support 5 02-04-2005 09:50 AM


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