Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

indicator values for non-daily bars not consistent with daily bars?

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

    #16
    Hi joemiller,

    Plots show up in the data box. If you'd like a value in the databox, set a plot to this value.

    For example:
    protected override void Initialize()
    {
    Add(new Plot(Color.Orange, "Plot0"));
    }

    protected override void OnBarUpdate()
    {
    Value.Set(SMA(15)[0]);
    }

    This would plot the SMA(15) in the data box.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17

      Add(joeXXOindicator(1));
      is in the initialize region of my strategy

      when I add
      Value.Set(joeXXOindicator(
      1)[0]);
      to the OnBarUpdate region I get an error message saying Value is undefined?

      Must I define Value somewhere?

      Comment


        #18
        Hello joemiller,

        Strategies do plots a little different than indicators.

        The Value object will not be available.

        Please take a look at the SampleStrategyPlot reference sample that shows how to accomplish this.
        http://www.ninjatrader.com/support/f...ead.php?t=6651

        Let me know if you'd like any assistance getting that working.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #19
          The suggested link says
          'This technique has limited functionality. It will NOT work for charts in the Strategy Analyzer during backtesting, but it will work on real-time charts.'

          However, I am working with analyzer backtesting charts so it appears I should not spend time trying to learn how to use the technique described in the link?

          If so, if what I was trying to do will not work in a strategy, can I generate the display of the indicator in the Data Box by doing it somehow from the indicator code?

          Comment


            #20
            Hi joemiller,

            Please take a look at the attached sample strategy code and run the strategy in a chart with the databox open.

            This strategy adds the SMA. The SMA sets a plot. The plot is shown in the data box.
            Attached Files
            Chelsea B.NinjaTrader Customer Service

            Comment


              #21
              Thanks Chelsea.
              However, at this time I am avoiding, if possible, messing with charts. If I can't do this in the Strategy Analyzer I will forgo it for now because it is not all that important.

              Comment


                #22
                Hello joemiller,

                Using a strategy plot does not work in the Strategy Analyzer.

                Adding an indicator that plots using the Add() method does work in the strategy analyzer.

                The sample I provided uses the Add() method.

                This also works in historical on a chart.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #23
                  “Bars.GetDayBar” returning incorrect values ?

                  Hi Chelsea,
                  I am hurriedly getting this sent to catch you in an attempt to generate a reply before you guys leave for the weekend. I can of course send more attachments, etc.

                  May8 day bars: open= 1.3078, high= 1.3193, low= 1.3070, close= 1.3152
                  May8 6 hour bars: open= 1.3075, high= 1.3131, low= 1.3067, close= 1.3078

                  Above is a summary of the results of a strategy analyzer run, suggesting that “Bars.GetDayBar” is returning incorrect values. The day bar values are correct. The 6 hour bar values are different and therefore incorrect.

                  the 2 line summary above is from the following output window display

                  from output window for day bars:
                  indicator 05/08/13 5:00PM//17:00
                  daybars open= 1.3078
                  daybars high= 1.3193
                  daybars low= 1.3070
                  daybars close= 1.3152
                  daybars indicator= 1.3096

                  from output window for 6 hour bars:
                  indicator 05/07/13 11:00PM//23:00
                  minutebars open= 1.3075
                  minutebars high= 1.3131
                  minutebars low= 1.3067
                  minutebars close= 1.3078
                  minutebars indicator= 1.3081
                  indicator 05/08/13 5:00AM//05:00
                  minutebars open= 1.3075
                  minutebars high= 1.3131
                  minutebars low= 1.3067
                  minutebars close= 1.3078
                  minutebars indicator= 1.3081
                  indicator 05/08/13 11:00AM//11:00
                  minutebars open= 1.3075
                  minutebars high= 1.3131
                  minutebars low= 1.3067
                  minutebars close= 1.3078
                  minutebars indicator= 1.3081
                  indicator 05/08/13 5:00PM//17:00
                  minutebars open= 1.3075
                  minutebars high= 1.3131
                  minutebars low= 1.3067
                  minutebars close= 1.3078
                  minutebars indicator= 1.3081

                  Comment


                    #24
                    Hi joemiller,

                    May I have an export of the strategy you are getting this output from?

                    To export your script do the following:
                    1. Click File -> Utilities -> Export NinjaScript
                    2. Enter a unique name for the file in the value for 'File name:'
                    3. Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
                    4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message


                    By default your exported file will be in the following location:
                    • (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>


                    Below is a link to the help guide on Exporting NinjaScripts.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #25
                      strategy you are getting this output from?

                      print to output window code is in the indicator, not the strategy

                      thanks Chelsea
                      Attached Files

                      Comment


                        #26
                        Hello joemiller,

                        Thanks for the updated script.

                        From your code I am seeing that the GetDayBar is matching a Daily bar.
                        I think you are getting confused about the session template. With forex, any bar that comes out after 5:00 PM Eastern will reference the same day it was created while any bar that comes out before 5:00 will reference the previous day.

                        For example:

                        The daily bar output
                        indicator 05/08/13 3:00PM//15:00
                        daybars open= 1.3078
                        daybars high= 1.3193
                        daybars low= 1.3070
                        daybars close= 1.3152
                        daybars indicator= 1.3096

                        The 360 minute bar output
                        indicator 05/08/13 9:00PM//21:00
                        minutebars open= 1.3078
                        minutebars high= 1.3193
                        minutebars low= 1.3070
                        minutebars close= 1.3152
                        minutebars indicator= 1.3101
                        indicator 05/09/13 3:00AM//03:00
                        minutebars open= 1.3078
                        minutebars high= 1.3193
                        minutebars low= 1.3070
                        minutebars close= 1.3152
                        minutebars indicator= 1.3101
                        indicator 05/09/13 9:00AM//09:00
                        minutebars open= 1.3078
                        minutebars high= 1.3193
                        minutebars low= 1.3070
                        minutebars close= 1.3152
                        minutebars indicator= 1.3101
                        indicator 05/09/13 3:00PM//15:00
                        minutebars open= 1.3078
                        minutebars high= 1.3193
                        minutebars low= 1.3070
                        minutebars close= 1.3152
                        minutebars indicator= 1.3101
                        indicator 05/09/13 9:00PM//21:00
                        minutebars open= 1.3152
                        minutebars high= 1.3176
                        minutebars low= 1.3009
                        minutebars close= 1.3041
                        minutebars indicator= 1.3123

                        Notice the only bar not showing yesterday's is the minute bar made after 9:00 PM.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #27
                          are you saying that GetDayBar is always based on a calendar 24 hour day even when the forex day is defined to straddle calendar days? is that correct?

                          in any event, please tell me whatever you can think of to solve the problem.

                          many thanks

                          Comment


                            #28
                            NT is going to be rendered almost useless to me if I cannot use minute bars. If I understand the issue then most or all 24 hour exchanges are equally impacted?

                            I have been so overwhelmed by the power and sophistication of NT that I am surprised [shocked] that they have not addressed the problem as I perceive it.

                            I am aware that I am jumping to conclusions and overreacting ... and it may be a non problem.

                            Comment


                              #29
                              Hello joemiller,

                              The Bars.GetDayBar method uses the session template to find the previous day.

                              A daily bar will also use the session template. With the daily bar though, the bar is already formed using the Forex session template of 5:00 PM Eastern to 5:00 PM Eastern the next day.

                              When using a minute bar this is not done automatically for you. A minute bar that forms at 5:01 PM is going to be the first bar of the day.

                              This is why using get day bar with a minute series will return a different day if used on bar that is part a different session.

                              A minute bar made at 4:59 PM Eastern on 8/12/2013 will be part of the of the 8/11 day bar. A minute bar made at 5:01 PM Eastern on 8/12/2013 will be part of the 8/12 day bar.

                              This means that this is working correctly for what is printing. However, I think you may have some confusion about how session templates work.

                              Please take a look at the following help guide document under the section 'Understanding Session Templates'.
                              http://www.ninjatrader.com/support/h...on_manager.htm
                              Chelsea B.NinjaTrader Customer Service

                              Comment


                                #30
                                I don't question why it happens.

                                My concern is that I cannot test how my indicator strategy based on day bars will perform when tested on a minute by minute basis. Assumptions that have to be made with day bars are eliminated with the minute bars.

                                The way it is now, it is not the same indicator in both cases [ie] day bars and minute bars. The strong implication to me of the Bars.GetDayBar function is that it should do just that, pure and simple. I think programming wise it could be done by NT?

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by argusthome, 03-08-2026, 10:06 AM
                                0 responses
                                119 views
                                0 likes
                                Last Post argusthome  
                                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                                0 responses
                                62 views
                                0 likes
                                Last Post NabilKhattabi  
                                Started by Deep42, 03-06-2026, 12:28 AM
                                0 responses
                                40 views
                                0 likes
                                Last Post Deep42
                                by Deep42
                                 
                                Started by TheRealMorford, 03-05-2026, 06:15 PM
                                0 responses
                                45 views
                                0 likes
                                Last Post TheRealMorford  
                                Started by Mindset, 02-28-2026, 06:16 AM
                                0 responses
                                82 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Working...
                                X