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

Column calculation for market analyzer

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

    Column calculation for market analyzer

    Hi

    My problem is that I want to generate a number which is a weighted against the close values going back 30 days, the result of which is placed in the column entry of the market analyzer for subsequent sorting. I cannot see how to get access to the close array in the market analyzer and there does not seem to be any examples in the NT7 package or indeed on the web that are relevant. Is there any document which gives a full definition of the objects parameters and methods that are available?

    Any help would be greatly appreciated.

    #2
    Hello johnda,
    Welcome to the forum and I am happy to assist you.

    To clarify further are you trying to display via values by custom coding an indicator or a column (as in cs codes in ~\Documents\NinjaTrader 7\bin\Custom\MarketAnalyzer\)
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      I am trying to write a ninjascript code to analyse close() data and to display the result as a single number in a colomn of the market analyzer.

      Comment


        #4
        Hello johnda,
        If you are trying to display the value via an indicator then you can choose the Price type as shown in the attached screenshot.
        Attached Files
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Hi
          I don't think this is it - I want to write my own script to analyse historic data for ranking many many stocks, so market analyser is the right tool but I need to access close data over time for a the selected (row) stock for the calculation.

          Comment


            #6
            Hello johnda,
            Thanks for the clarification.

            If you want the values of other instruments then you have to create a multi series code to do it. Please refer to our help guide to know more about it
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              Hello Joydeep

              Thanks for the input but I do not see the way forward ... the code I have is below where the close() I need access to is for closing price for the last 3 days for the current instrument in the Market Analyzer list.

              Also, coming back to my earlier point, is there a document detailing the object hierarchy, methods and parameters?


              //
              // Simple average of last 3 closes -> column
              //

              #region Using declarations
              using System;
              using System.ComponentModel;
              //using System.Drawing;
              using NinjaTrader.Cbi;
              using NinjaTrader.Data;
              using NinjaTrader.MarketAnalyzer;
              #endregion

              // This namespace holds all market analyzer column definitions and is required. Do not change it.
              namespace NinjaTrader.MarketAnalyzer
              {
              public class JohnPrice : NinjaTrader.MarketAnalyzer.Column
              {
              /// This method is used to configure the market analyzer column and is called once before any event mathod is called.

              protected override void Initialize()
              {
              CalculateOnBarCloseConfigurable = false;
              RequiresBars = false;
              }

              /// Called on each incoming market data tick.
              /// <param name="e"></param>
              protected override void OnMarketData(MarketDataEventArgs e)
              {
              double sum = 0;
              if (e.MarketDataType != MarketDataType.Last)
              return;

              for (int i = 0; i < 3; i++)
              { sum = Close[i];} //sum + e.MarketData.Last.Price }
              Value = sum /3;
              }

              #region Miscellaneous

              protected override string Format(double value)
              { return Instrument.MasterInstrument.FormatPrice(value); }
              #endregion
              }
              }

              Comment


                #8
                Hello johnda,
                Unfortunately we do not officially support creating Columns in the Market Analyzer neither it is documented.

                I would suggest creating an indicator and adding it to as a column in the Market Analyzer.
                JoydeepNinjaTrader Customer Service

                Comment


                  #9
                  I am sorry the distinction is too subtle for me - perhaps you could show the way with a simple average of the last 10 close prices (using close[] specifically rather than SMA) and getting this into a market analyser column.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by andrewtrades, Today, 04:57 PM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by chbruno, Today, 04:10 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post chbruno
                  by chbruno
                   
                  Started by josh18955, 03-25-2023, 11:16 AM
                  6 responses
                  436 views
                  0 likes
                  Last Post Delerium  
                  Started by FAQtrader, Today, 03:35 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post FAQtrader  
                  Started by rocketman7, Today, 09:41 AM
                  5 responses
                  19 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Working...
                  X