NinjaTrader_Josh
08-03-2009, 08:47 AM
Reference sample for NinjaTrader 6.5.xxxx.x or greater.
An essential element of any trader's strategies or indicators is time. You may find yourself wanting a high and low marker for a certain timeframe or you might want something drawn on your charts during those choppy lunch hours. DateTime objects are included in the .NET framework, and they can be used to do any time related action, like limiting trading hours or finding the highest high between 9:30AM and 10:30AM.
This reference sample demonstrates the following concepts:
Common manipulation of DateTime objects Important methods and properties used include:
DateTime (http://msdn.microsoft.com/en-us/library/system.datetime.aspx)
DateTime.Add() (http://msdn.microsoft.com/en-us/library/system.datetime.add.aspx)
DateTime.Compare() (http://msdn.microsoft.com/en-us/library/system.datetime.compare.aspx)
DateTime.Now (http://msdn.microsoft.com/en-us/library/system.datetime.now.aspx)
DateTime.TryParse() (http://msdn.microsoft.com/en-us/library/system.datetime.tryparse.aspx)
TimeSpan (http://msdn.microsoft.com/en-us/library/system.timespan.aspx) Other methods and properties of interest include:
DateTime.ToString(string) (http://msdn.microsoft.com/en-us/library/zdtaw1bw.aspx)
string.Format() (http://msdn.microsoft.com/en-us/library/system.string.format.aspx) Import instructions for NinjaTrader 6.5.XXXX.X or greater:
Download the file contained in this thread to your PC desktop
From the Control Center window, select the menu File > Utilities > Import NinjaScript
Select the downloaded file
An essential element of any trader's strategies or indicators is time. You may find yourself wanting a high and low marker for a certain timeframe or you might want something drawn on your charts during those choppy lunch hours. DateTime objects are included in the .NET framework, and they can be used to do any time related action, like limiting trading hours or finding the highest high between 9:30AM and 10:30AM.
This reference sample demonstrates the following concepts:
Common manipulation of DateTime objects Important methods and properties used include:
DateTime (http://msdn.microsoft.com/en-us/library/system.datetime.aspx)
DateTime.Add() (http://msdn.microsoft.com/en-us/library/system.datetime.add.aspx)
DateTime.Compare() (http://msdn.microsoft.com/en-us/library/system.datetime.compare.aspx)
DateTime.Now (http://msdn.microsoft.com/en-us/library/system.datetime.now.aspx)
DateTime.TryParse() (http://msdn.microsoft.com/en-us/library/system.datetime.tryparse.aspx)
TimeSpan (http://msdn.microsoft.com/en-us/library/system.timespan.aspx) Other methods and properties of interest include:
DateTime.ToString(string) (http://msdn.microsoft.com/en-us/library/zdtaw1bw.aspx)
string.Format() (http://msdn.microsoft.com/en-us/library/system.string.format.aspx) Import instructions for NinjaTrader 6.5.XXXX.X or greater:
Download the file contained in this thread to your PC desktop
From the Control Center window, select the menu File > Utilities > Import NinjaScript
Select the downloaded file