I am still using ninjatrader 6.5 as my data provider provides data for version 6.5 only http://www.globaldatafeeds.in/
This indicator is for version 7 plz tell me what changes should I make that it works with version 6.5
regards
#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.Gui.Chart;
using System.IO;
#endregion
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
[Description("Enter the description of your new custom indicator here")]
public class ExportToMD : Indicator
{
#region Variables
private string symbol = @"NF ##-##";
private string filename;
private string path;
private System.IO.StreamWriter sw;
#endregion
protected override void Initialize()
{
Overlay = true;
filename = symbol + ".txt";
path = Cbi.Core.UserDataDir.ToString() + filename;
}
protected override void OnStartUp()
{
if(File.Exists(path)) File.Delete(path);
}
protected override void OnBarUpdate()
{
try
{
sw = File.AppendText(path);
sw.WriteLine(symbol + "," + String.Format("{0:yyyyMMdd,HHmmss}",Time[0]) + "," + Close[0] + "," + Volume[0]);
sw.Close();
}
catch (Exception e)
{
Log("You cannot write and read from the same file at the same time. Please remove SampleStreamReader.", NinjaTrader.Cbi.LogLevel.Error);
throw;
}
}
protected override void OnTermination()
{
if (sw != null)
{
sw.Dispose();
sw = null;
}
}
#region Properties
[Description(" Symbol Name used in MD")]
[GridCategory("Parameters")]
public string Symbol
{
get { return symbol; }
set { symbol = value; }
}
#endregion
}
}
#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
public partial class Indicator : IndicatorBase
{
private ExportToMD[] cacheExportToMD = null;
private static ExportToMD checkExportToMD = new ExportToMD();
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public ExportToMD ExportToMD(string symbol)
{
return ExportToMD(Input, symbol);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public ExportToMD ExportToMD(Data.IDataSeries input, string symbol)
{
if (cacheExportToMD != null)
for (int idx = 0; idx < cacheExportToMD.Length; idx++)
if (cacheExportToMD[idx].Symbol == symbol && cacheExportToMD[idx].EqualsInput(input))
return cacheExportToMD[idx];
lock (checkExportToMD)
{
checkExportToMD.Symbol = symbol;
symbol = checkExportToMD.Symbol;
if (cacheExportToMD != null)
for (int idx = 0; idx < cacheExportToMD.Length; idx++)
if (cacheExportToMD[idx].Symbol == symbol && cacheExportToMD[idx].EqualsInput(input))
return cacheExportToMD[idx];
ExportToMD indicator = new ExportToMD();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
indicator.Symbol = symbol;
Indicators.Add(indicator);
indicator.SetUp();
ExportToMD[] tmp = new ExportToMD[cacheExportToMD == null ? 1 : cacheExportToMD.Length + 1];
if (cacheExportToMD != null)
cacheExportToMD.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheExportToMD = tmp;
return indicator;
}
}
}
}
// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.ExportToMD ExportToMD(string symbol)
{
return _indicator.ExportToMD(Input, symbol);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.ExportToMD ExportToMD(Data.IDataSeries input, string symbol)
{
return _indicator.ExportToMD(input, symbol);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.ExportToMD ExportToMD(string symbol)
{
return _indicator.ExportToMD(Input, symbol);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.ExportToMD ExportToMD(Data.IDataSeries input, string symbol)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
return _indicator.ExportToMD(input, symbol);
}
}
}
#endregion

Comment