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 11-17-2008, 11:58 AM   #1
spinalwiz
Member
 
Join Date: Oct 2008
Posts: 60
Thanks: 0
Thanked 0 times in 0 posts
Default DateTime as an Integer Error

Hi,

I am getting this error when running my strategy. It complies fine and the strategy runs fine, but when an order is placed I get this error:

Failed to execute DB job 'StrategyUpdateJob' There was an error reflecting typeTrader.StochScalpV3_1. There was an error reflecting property SessionEnd. Member of type Int32 hides base class member StrategyBase.SessionEnd of type System.DateTime. Use XmlElementAttribute or XmlAttribueAttributr to specify a new name.

Here is how I use the variable sessionEnd:

As a parameter:

Code:
        [Description("Session End Time (format HHMMSS)")]
        [Category("Parameters")]
        public int SessionEnd
        {
            get { return sessionEnd; }
            set { sessionEnd = value; }
        }
And then to check the trading hours:

Code:
        private void checkTradingHours() 
        {
            currentTime = ToTime(Time[0]);
            
            if (currentTime <= sessionStart || currentTime >= sessionEnd )  
                withinTradingHours = false;
            
            else withinTradingHours = true;    
        }
Any ideas? Thanks
spinalwiz is offline  
Reply With Quote
Old 11-17-2008, 12:06 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

Please try using a different variable name. SessionEnd may be reserved.
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-18-2008, 05:52 AM   #3
spinalwiz
Member
 
Join Date: Oct 2008
Posts: 60
Thanks: 0
Thanked 0 times in 0 posts
Default

Great, that worked thank you.
spinalwiz 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
backtesting and DateTime.Now andrewbee Strategy Analyzer 3 06-28-2010 09:18 AM
DateTime.Now vs Market Replay ATI user Strategy Development 3 11-15-2008 07:35 PM
Integer Output Faspomy Indicator Development 7 11-03-2008 10:32 AM
Rounding off to an integer? Burga1 General Programming 1 01-02-2008 10:20 PM
error combining ema with an integer Thomas Strategy Development 3 08-16-2007 05:40 AM


All times are GMT -6. The time now is 05:18 PM.