I am trying to print data to the output window.
My code is as follows:
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class CSVPrinter : Strategy
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = true;
}
protected override void OnStartUp()
{
//Print your header
Print("Date,Time,Open,High,Low,Close");
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Print your data for each bar
Print("," + Time[0] + "," + Open[0] + "," + High[0] + "," + Low[0] + "," + Close[0]);
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}
However I get this as my printout:
Date,Time,Open,High,Low,Close
29/12/2011 21:00:00,1.2937,1.2965,1.2937,1.2964
29/12/2011 22:00:00,1.2963,1.2964,1.2958,1.2961
29/12/2011 23:00:00,1.2961,1.2962,1.2948,1.2951
30/12/2011 00:00:00,1.2951,1.2955,1.2942,1.2953
But I am trying to get this:
Date,Time,Open,High,Low,Close
29/12/2011, 21:00:00,1.2937,1.2965,1.2937,1.2964
29/12/2011, 22:00:00,1.2963,1.2964,1.2958,1.2961
29/12/2011, 23:00:00,1.2961,1.2962,1.2948,1.2951
30/12/2011, 00:00:00,1.2951,1.2955,1.2942,1.2953
How do I get it to print the comma between the data and the time.?
Any help will be appreciated. Thank you in advance.
aafwintb
Comment