Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

tick data export indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    tick data export indicator

    Hi I want to use this indicator with ninjatrader 6.5 to export tick data real time .
    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
    HTML Code:
    #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

    #2
    Slash,

    I would suggest installing the indicator manually, then compiling to see where the errors come from. It will pinpoint what lines need to be changed. Most often I believe you would just need to change some indicator calls, and some method names there.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_AdamP View Post
      Slash,

      I would suggest installing the indicator manually, then compiling to see where the errors come from. It will pinpoint what lines need to be changed. Most often I believe you would just need to change some indicator calls, and some method names there.
      ERROR:The type or namespace name 'GridCategory' could not be found (are you missing a using directive or an assembly reference?)
      Code:CS0246
      Line:73
      Column:10
      regards

      Comment


        #4
        Slash,

        I didn't come on when NT 6.5 was in use, so I am not totally sure here, however the "GridCategory" is an XML user interface item. I would suggest looking at some NT 6.5 code to see how these are defined there to find out how it needs to be changed.

        Specifically :
        Code:
          #region Properties
        
                [Description(" Symbol Name used in MD")]
                [GridCategory("Parameters")]
                public string Symbol
                {
                    get { return symbol; }
                    set { symbol = value; }
                }
                #endregion
        This is XML for a user defined input.

        If you need assistance converting this, I would suggest perhaps a NinjaScript consultant as they could do it for you.

        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Ok can anyone else from Customer Service who is familiar with ninjtrader 6.5 ,can help me plz ?
          Originally posted by NinjaTrader_AdamP View Post
          Slash,

          I didn't come on when NT 6.5 was in use, so I am not totally sure here, however the "GridCategory" is an XML user interface item. I would suggest looking at some NT 6.5 code to see how these are defined there to find out how it needs to be changed.

          Specifically :
          Code:
            #region Properties
          
                  [Description(" Symbol Name used in MD")]
                  [GridCategory("Parameters")]
                  public string Symbol
                  {
                      get { return symbol; }
                      set { symbol = value; }
                  }
                  #endregion
          This is XML for a user defined input.

          If you need assistance converting this, I would suggest perhaps a NinjaScript consultant as they could do it for you.

          http://www.ninjatrader.com/partners#...pt-Consultants

          Comment


            #6
            Slash,

            Unfortunately we wouldn't necessarily support converting NT 7 indicators to NT 6.5. The process could be time consuming and affect our ability to support other customers equally. If you need assistance here further, I would suggest either looking at NT 6.5 indicators to see how you need to change the line I referenced or contact a NinjaScript consultant.
            Adam P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by junkone, Today, 11:37 AM
            2 responses
            15 views
            0 likes
            Last Post junkone
            by junkone
             
            Started by frankthearm, Yesterday, 09:08 AM
            12 responses
            44 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by quantismo, 04-17-2024, 05:13 PM
            5 responses
            35 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by proptrade13, Today, 11:06 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by love2code2trade, 04-17-2024, 01:45 PM
            4 responses
            36 views
            0 likes
            Last Post love2code2trade  
            Working...
            X