Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Opening and Last Close

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

    Opening and Last Close

    How do I access the data in Market Analyzer's columns Opening and Last Close in code?

    #2
    Hello,

    Thank you for your forum post.

    The best way to do this is to use the indicator CurrentDayOHL() to get the open/high/low values.



    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Thank you.

      What about yesterday's close?

      Comment


        #4
        For this, PriorDayOHLC() would be the way to go - http://www.ninjatrader-support.com/H...orDayOHLC.html

        Comment


          #5
          Thanks,

          Would Close(0) also work, assuming it was loaded?

          Comment


            #6
            Hello,

            Yes this would get yo the latest close price.

            Let me know if I can be of further assistance.
            BrettNinjaTrader Product Management

            Comment


              #7
              How do I get a static daily close SMA? When I use SMA(Close, periods)[0] I seem to get a constanly changing value thru the day.

              Comment


                #8
                Wow I am starting to think NinjaTrader is not for me.

                I am trying to do something very simple.

                Get yesterday's close.
                Get a moving average of daily closes.
                Get today's open.

                These are static values thru the day, yet I seem to be getting dynamic values. I have tried Open[0], CurrentDayOHL.Open[0] & CurrentDayOHL.CurrentOpen[0] to get a static Open and nothing seems to work.

                I have tried Close[0], PreviousOHLC.Close[0] & PreviousOHLC.PreviousClose[0] for a simple yesterday close but these don't work either.

                What is the deal?

                Comment


                  #9
                  Hello,

                  When you run the indicator/strategy or apply the indicator to your chart in the parameters insure that Calculate On Bar Close = True. I suspect you have changed this to False.

                  When this is set to false the indicator will calculate on every tick recieved. If you set this to True it will calculate only at the end of the bar therefor giving you your static SMA value.

                  Let me know if I can be of further assistance.
                  BrettNinjaTrader Product Management

                  Comment


                    #10
                    I set CalculateOnBarClose = true;

                    Data should only update at the Close of day.

                    Data still changes.

                    Comment


                      #11
                      Hello,

                      What time frame chart do you have this attached too? It will only update on each bar close, if you have this applied to a 1 minute chart it will update every 1 minute for example?

                      If you want this to only update per day please run this on a daily chart.

                      If you need daily SMA value on a 1 minute chart please let me know and I can follow up with more detailed instructions on MultiSeries NinjaScript programming which would be required to do this. This is supported for indicators in NinjaTrader 7 only and only supported for strategies in NinjaTrader 6.5.

                      I look forward to assisting you further.
                      BrettNinjaTrader Product Management

                      Comment


                        #12
                        The indicator is a column in the Market Analyzer
                        Indicator/Data Series/Type = Day

                        Comment


                          #13
                          Hello,

                          It would be best at this point if you would post the code your using so that I may assist you with this.

                          Please send this code to support at ninjatrader dot com attn: Brett or post to this forum.

                          To post it please export it by going to File->Utilities->Export NinjaScript.

                          I look forward to assisting you further.
                          BrettNinjaTrader Product Management

                          Comment


                            #14
                            protected override void Initialize()
                            {
                            Overlay = false;
                            CalculateOnBarClose = true;
                            }

                            /// <summary>
                            /// Called on each bar update event (incoming tick)
                            /// </summary>
                            protected override void OnBarUpdate()
                            {
                            Print(Instrument.FullName.ToString());
                            Print(CurrentDayOHL().CurrentOpen[0].ToString());
                            Print(PriorDayOHLC().PriorClose[0].ToString());
                            Print(SMA(Close, Periods)[0].ToString());
                            }

                            Comment


                              #15
                              Thanks, Occam. Can you let us know which data provider you're using as well as if you're evaluating this on 6.5 or 7?
                              Ryan M.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              571 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              331 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              101 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              549 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              550 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X