Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom columns to operate on EOD data

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

    Custom columns to operate on EOD data

    Hi,

    I would like to add 3 custom columns which would show the close price, volume, and price x volume in order to filter out instruments that do not meet certain conditions.
    I am currently using the free Yahoo EOD data connection for the ASX market.

    Unfortunately, the Last Close column will not populate with Yahoo EOD data, and I remember reading that this is due to absence of a real-time data connection (Even though historical data shows that daily OHLCV data is being pulled from Yahoo). I am aware that it is possible to use SMA(1) indicator to give me the last close price. However, I would like to avoid doing this in order to further familiarize myself with creating custom ninjascript (I have some experience in C programming). Additionally, it seems that there is no way to operate on the output shown in columns (excel-style), without creating a custom indicator.

    Therefore, my question is: what would be the best approach to attain the above-mentioned 3 columns for my EOD data?

    #2
    Hello Acheron,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    If you are using NinjaTrader 7 you can create custom indicators that you add to the Market Analyzer as Columns > Indicator. Then use work arounds such as the SMA(1) for the values you need. For example: MyPlot.Set(SMA(Close, 1)[0]); and MyPlot.Set(SMA(Volume, 1)[0]);

    In NinjaTrader 8 you can create custom columns but likely would still need a custom indicator to pull the values on EOD data.
    Last edited by NinjaTrader_PatrickH; 08-17-2016, 01:35 PM.

    Comment


      #3
      Thanks Patrick.

      Due to several vital improvements (as well as some "quality of life" additions) of NT 8beta over the NT 7, I am solely using NT 8beta.
      To pull the EOD close price for each instrument within the Market Analyzer I tried the following for the NinjaTrader.NinjaScript.MarketAnalyzerColumn:

      Code:
      namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
      {
      	public class CustomClosePriceColumn : MarketAnalyzerColumn
      	{
      		protected override void OnStateChange()
      		{
      			if (State == State.SetDefaults)
      			{
      				Description = @"Output the close price of last bar.";
      				Name = "CustomClosePriceColumn";
      				Calculate = Calculate.OnPriceChange;
      				IsDataSeriesRequired = true;
      			}
      			else if (State == State.Realtime)
      			{
      				if (Instrument != null && Instrument.MarketData != null && Instrument.MarketData.LastClose != null)
      					CurrentValue = Instrument.MarketData.LastClose.Price;
      			}
      		}
      		
      		protected override void OnBarUpdate()
      		{
      			CurrentValue = Close[0];
      		}
      	}
      }
      Code:
      Similarly, to achieve the same with the  NinjaTrader.NinjaScript.Indicator I did the following:
      
      namespace NinjaTrader.NinjaScript.Indicators
      {
      	public class CustomClosePriceIndicator : Indicator
      	{
      		protected override void OnStateChange()
      		{
      			if (State == State.SetDefaults)
      			{
      				Description = @"Output the close price of last bar.";
      				Name = "CustomClosePriceIndicator";
      				Calculate = Calculate.OnPriceChange;
      				IsSuspendedWhileInactive	= true;
      			}
      		}
      
      		protected override void OnBarUpdate()
      		{
      			Value[0] = Close[0];
      		}
      	}
      }
      Within column properties, I have configured both to use Daily Close price as input data series.
      Unfortunately, although the MarketAnalyzerColumn seems to populate, the Indicator column is full of "...". Is there any reason for that?
      Last edited by Acheron; 08-17-2016, 01:02 PM.

      Comment


        #4
        Hello Acheron,

        I am not sure what the reason is that the indicator's will not plot on the EOD data until an update is received. I am checking with development and will follow up here.

        Comment


          #5
          Hello Acheron,

          Thank you for your patience.

          The Market analyzer is is based on real-time tick data. There must be a tick in real-time for the indicator or column to calculate. End Of Day feeds would not receive ticks through out the day.

          I have forwarded this to development for consideration to allow accessing the last closed value in the Market Analyzer.

          Comment


            #6
            The suggestion has been assigned if SFT-1574.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by wzgy0920, 04-20-2024, 06:09 PM
            2 responses
            27 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, 02-22-2024, 01:11 AM
            5 responses
            32 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, 04-23-2024, 09:53 PM
            2 responses
            49 views
            0 likes
            Last Post wzgy0920  
            Started by Kensonprib, 04-28-2021, 10:11 AM
            5 responses
            193 views
            0 likes
            Last Post Hasadafa  
            Started by GussJ, 03-04-2020, 03:11 PM
            11 responses
            3,235 views
            0 likes
            Last Post xiinteractive  
            Working...
            X