Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Market Analyzer Column closed price on 3min bar?

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

    Market Analyzer Column closed price on 3min bar?

    Hello,
    For Live Market data, how do I display on Market Analyzer Column last closed price bar for 3min interval? and another column for previously closed price bar for 3min interval?

    Thank you,

    #2
    Hello AlwaysOnTop629,

    Set IsDataSeriesRequired to true in State.SetDefaults.


    When adding the column, set the Data Series Type to Minute, and the Value to 3.

    Assign CurrentValue the value of Close[0].


    Or check CurrentBar is greater than 1 and assign CurrentValue the value of Close[1] (of 1 bar ago).
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I'm new to scripting. please help.
      Using NinjaScript Editor, do I create a "New indicator" or "New Market Analyzer Column"?

      Code:
      //This namespace holds MarketAnalyzerColumns in this folder and is required. Do not change it.
      namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
      {
      public class PriceClosedAMarketAnalyzerColumn : MarketAnalyzerColumn
      {
      protected override void OnStateChange()
      {
      if (State == State.SetDefaults)
      {
      Description = @"Enter the description for your new custom Market Analyzer Column here.";
      Name = "PriceClosedAMarketAnalyzerColumn";
      Calculate = Calculate.OnBarClose;
      IsDataSeriesRequired = true;
      }
      else if (State == State.Configure)
      {
      protected override void OnMarketData(Data.MarketDataEventArgs marketDataUpdate)
      
      {
      
      CurrentValue = Close[0] ;
      
      }
      }
      }
      }
      }
      ​

      Comment


        #4
        Hello AlwaysOnTop629,

        You can add an indicator that has a plot to the Market Analyzer by adding an Indicator column.
        I'm trying to expose my variables to the strategy builder so everyone can have better use of the WaveTrend indicator (it has a lot of code). Explain this to me like I am 5 because this isnt the first time I've tried to figure it out and hit a wall. What is Series? I know its like an array that stores bars. Why not just call it



        Or you create the script as a MarketAnalyzerColumn.

        In your first post you suggested you are trying to make a MarketAnalyzerColumn.

        However, if you made an indicator that could be used in the Market Analyzer, on Charts, and can be called from NinjaScript Strategies.

        So it depends, what you do want out of the script?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello,
          I want an indicator to show the closed price of a 3 minutes bar of 1 bar ago and 2 bars ago and
          display that value on Market Analyzer Column A & Column B.
          Column A display "1 bar ago Close Price Value"
          Column B display "2 bar ago Close price Value"

          Thank you, ​

          Comment


            #6
            Hello AlwaysOnTop629,

            You can do that in an indicator. You can do that in a Market Analyzer Column.

            Either will work.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello,
              I created the indicator script and I'm able to display the last close price on a market Analyzer Column.
              Is my code efficiently and not use too much resources?
              Can you help me improve it to be better?

              Thank you,

              Code:
              namespace NinjaTrader.NinjaScript.Indicators
              {
              public class PriceCloseLastPrice : Indicator
              {
              protected override void OnStateChange()
              {
              if (State == State.SetDefaults)
              {
              Description = @"Price Close last bar Price --Close [0]";
              Name = "PriceCloseLastPrice";
              Calculate = Calculate.OnBarClose;
              IsOverlay = false;
              DisplayInDataBox = true;
              DrawOnPricePanel = true;
              DrawHorizontalGridLines = true;
              DrawVerticalGridLines = true;
              PaintPriceMarkers = true;
              ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
              //Disable this property if your indicator requires custom values that cumulate with each new market data event.
              //See Help Guide for additional information.
              IsSuspendedWhileInactive = true;
              AddPlot(Brushes.Red, "ClosePlot");
              }
              else if (State == State.Configure)
              {
              }
              }
              
              protected override void OnBarUpdate()
              {
              Value[0] = Close[0]; //this will draw a line on the close price.
              }
              }
              }
              ​​

              Comment


                #8
                Hello AlwaysOnTop629,

                Add a public Series<double> using XmlIgnore so this can be used in the Market Analyzer and Strategy Builder.

                See the forum post linked in post # 4.

                There is not anything can be be improved performance wise. The script only assigns the Close[0] price to the plot and is set to use Calculate.OnBarClose. That's as simple as it can get.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Yesterday, 05:17 AM
                0 responses
                59 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                134 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                75 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                45 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                50 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X