![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
Hi,
I just turned on XML serialization for some of my objects (using XmlSerializer), because I'm trying to feed some run-time data into a different program. This worked fine in strategy analyzer, but when I tried to run real time... NT popped up a mysterious message box warning me serialization failed while writing to database, etc, etc. (I'll try to screen capture next time.) I'm guessing what's happening is that NinjaTrader uses the same .NET classes to serialize our strategy state...? And my custom-written attributes, etc... are some how interfering with that process? Can I get a confirmation that's the case from someone (Dierk?)? If so, I guess the solution is to probably make the fields that are tied to my serializer private.. right? |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
Oh, here's the actual message (captured in log):
3/12/2009 8:48:35 AM Default Failed to execute DB job 'StrategyUpdateJob': There was an error reflecting type 'NinjaTrader.Strategy.ProtectDownMulti'.: There was an error reflecting field 'states'.: There was an error reflecting type 'Chon.Utilities.SimpleState'.: Cannot serialize member 'Chon.Utilities.SimpleState.config' of type 'Chon.Utilities.SimpleConfiguration', see inner exception for more details.: Chon.Utilities.SimpleConfiguration cannot be serialized because it does not have a parameterless constructor. ... simple enough, I'll just add the parameterless constructor. |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
Here's the next error message in the series that I can't get rid of:
3/12/2009 9:11:00 AM Default Failed to execute DB job 'StrategyUpdateJob': There was an error reflecting type 'NinjaTrader.Strategy.ProtectDownMulti'.: There was an error reflecting field 'states'.: There was an error reflecting type 'Chon.Utilities.SimpleState'.: There was an error reflecting field 'longOrder'.: There was an error reflecting type 'Chon.Utilities.SimpleOrder'.: Cannot serialize member 'Chon.Utilities.SimpleOrder.Order' of type 'NinjaTrader.Cbi.IOrder', see inner exception for more details.: Cannot serialize member Chon.Utilities.SimpleOrder.Order of type NinjaTrader.Cbi.IOrder because it is an interface. ... I think I just need to find a way for it not to try to serialize "states". I assume declaring it private will do the trick. |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Glad you figured it out.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Unfortunately this is beyond the scope we could provide support for.
Hints: As you experienced there would be multiple issues needed to be considered with XML serialization: - parameter less constructor or no constructor at all - marking public properties as non-serializable (XmlIgnore) - many more... Please consult the MS doc for a full list
Dierk
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Strategy doesn't run in realtime | rcossey73 | Strategy Development | 3 | 01-07-2009 07:37 AM |
| NOOB Best Practice Q:How to run a strategy | shiptastic | Automated Trading | 1 | 11-13-2008 09:29 AM |
| Run strategy from chart and from strategy tab | gaiusparx | Strategy Development | 1 | 06-30-2008 11:03 AM |
| Difference between strategy run on Chart and one run from Control Center | richa61416 | Strategy Analyzer | 6 | 09-23-2007 05:07 AM |
| NT6beta11 crashes - can't run any strategy any more | plipa | Miscellaneous Support | 13 | 04-17-2007 12:06 AM |