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

    #31
    Hi joemiller,

    The Bars.GetDayBar(1) call will return the day bar for the previous session. On a day bar this is straight forward as each bar is a complete session and will always return the previous session. On a minute bar this is not as straight forward because a minute bar could be part of different sessions depending on when the bar is made.

    If you would like this to work differently with a minute bar and not reference the previous session how would you suggest this works?

    Regarding your script, we can modify this so that it is working the way you would like.

    If a bar comes out after 5 PM Eastern you can ignore that bar, or you can have it reference the second previous session to match the call made by bars before 5..

    For example:
    Code:
    if (ToTime(Time[0]) < 170000)
    {
    Print(Bars.GetDayBar(1);
    }
    else
    {
    Print(Bars.GetDayBar(2);
    }
    This may not be exactly what you need, however, this shows that you can change the logic so that minute bars are returning the data you desire.

    If a bar is after 5 PM, what would you like to see from it? The current session starting at 5, the previous session starting at 5 the previous day, or the session before that starting at 5 2 days previous?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #32
      I clearly understand what the problem is…that is not the issue.
      To me a day bar has a high, open, low, close. If a simulation of that day bar does not simulate the day bar, then it is not a valid simulation and is useless as a day bar.

      Yes I would like it to work differently. I would like it to simulate the day bar when it says it is simulating the day bar....simulation meaning exact same values of OHLC , not an approximation. that is the day bar I need.

      I would suggest it works in the manner you suggest. NT software is great at doing such calculations for such situations. . . That’s why I am so impressed by NT. I don’t have time to mickey mouse around doing it myself, especially when it would have to be tailored for different instruments. The situation is what it is. Get Day Bar does not do what I hoped it would do. it is what it is.

      Comment


        #33
        Hello joemiller,

        Please look back at my post #26.

        http://www.ninjatrader.com/support/f...5&postcount=26

        In this I am comparing the open high low close of a daily bar that is preformed by the data provider, and a 60 minute bar.

        Notice the open high low close values. I am showing these as exactly the same whether using High[0] as with daily bars or Bars.GetDayBar(1).High as with the 60 minute bar.

        I am still uncertain of the issue.

        Could you provide me data and highlight (or embolden) the descrepancies?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #34
          I am painfully aware that I can be dead wrong...so thanks for your continued help.

          run the strategy with the indicator I have attached and I think you will see that the 60 minute bar redline indicator values are not the same as for those day bars.
          Attached Files

          Comment


            #35
            Hello joemiller,

            The PlotXXO plot is different for minute and daily bars because you are using two different values to calculate this.

            For minute bars you use this to calculate the XXOpen:
            XXOpen=((XXCloseyest+Bars.GetDayBar(1).Open)*0.5);

            For day bars you use:
            XXOpen=((XXCloseyest+PlotXXO[1])*0.5);

            The minute bars use the open of the previous session open to calculate the XXOpen. The day bars use the previous value of PlotXXO. These are two very different values and will give very different results.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #36
              Chelsea,

              The problem you identified in the previous post must be fixed. Thank you for that.

              However, focusing on just the ‘getdaybar’ function, it still appears that ‘getdaybar’ is not returning yesterday’s OHLC values consistent with yesterday’s actual day bar. If that is correct then the indicator will not be the same for minute bars and their day bar counterparts.

              The day bar values shown in the output window are the same as for the bars shown on the analyzer chart.

              Please run the attached indicator/strategy for day bars and 60 minute bars and take a look at the output window, and let me know what you think.

              p.s. Why does the info in the output windows repeat?

              Attached Files

              Comment


                #37
                Hello joemiller,

                I am not getting any prints when backtesting this with day bars.

                This is because you are only allowing the prints if the time of the bar is 5 or 6 on 8/12 or 8/13.

                Even so, using the $EURUSD my prints for the hours bars are:

                from joeXXOindicator 08/12/13 5:00PM//17:00
                ***MINUTE BARS***
                GetDayBar open= 1.3313
                GetDayBar high= 1.3343
                GetDayBar low= 1.3276
                GetDayBar close= 1.3299
                from joeXXOindicator 08/12/13 6:00PM//18:00
                ***MINUTE BARS***
                GetDayBar open= 1.3313
                GetDayBar high= 1.3343
                GetDayBar low= 1.3276
                GetDayBar close= 1.3299
                from joeXXOindicator 08/13/13 5:00PM//17:00
                ***MINUTE BARS***
                GetDayBar open= 1.3297
                GetDayBar high= 1.3316
                GetDayBar low= 1.3232
                GetDayBar close= 1.3261
                from joeXXOindicator 08/13/13 6:00PM//18:00
                ***MINUTE BARS***
                GetDayBar open= 1.3297
                GetDayBar high= 1.3316
                GetDayBar low= 1.3232
                GetDayBar close= 1.3261

                Looking at a daily chart I am seeing the following:

                8/12:
                Open: 1.3313
                High: 1.3343
                Low: 1.3276
                Close: 1.3299

                8/13:
                Open: 1.3299
                High: 1.3316
                Low: 1.3232
                Close: 1.3261


                The bar for the 13th actually has a 2 tick discrepancy. This is because the minute data is showing the first tick (from the first trade of the day). The daily bar is showing the open price that is controlled by the broker.

                To see this difference, please open a 1440 minute $EURUSD chart and a daily interval with the same instrument on another chart. Be sure to use the same session template for both.

                Compare the open high low close values of these charts.

                I am attaching a screenshot of how this looks for me.
                Attached Files
                Last edited by NinjaTrader_ChelseaB; 08-15-2013, 01:46 PM.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #38
                  Chelsea,

                  Attached are:
                  1 the indicator, updated to display 5 days instead of 3 in the output window
                  2 the strategy
                  3 the output window
                  4 an Excel spreadsheet for the output window [not yet attached]
                  I haven't been able to attach the Excel file yet. I am running out of time - please tell me how to do it. maybe a zip file?

                  The output is for 5 days, wed aug7 thru tue aug13.
                  In the Excel spreadsheet yellow high lites show OHLC, shifted for days vs non-days, to be the same. Red high lite values at the end broke the yellow pattern?

                  The hourly bar indicator red line continues to be well behaved [a straight line for each 24 hour set] and correct for the wrong values it was given to calculate its value.
                  Strange that my results and your results were not the same last time?
                  There is no 6 pm for Friday august9 [marked in red] because the Forex market shuts down for the weekend at 5pm.

                  I want to get this into your hands. Meanwhile I will try to make sense of it. Looks like the problem may be solvable if I can pick up values a day later [or earlier]?
                  Attached Files

                  Comment


                    #39
                    Attached is the Excel zipped file referred to in the previous post.

                    The following repeats what was said in the previous post about the spreadsheet:
                    The output is for 5 days, wed aug7 thru tue aug13.
                    In the Excel spreadsheet yellow high lites show OHLC, shifted for days vs non-days, to be the same. Red high lite values at the end broke the yellow pattern? [but not by much [ie] the open is slightly different].
                    There is no 6 pm for Friday august9 [marked in red] because the Forex market shuts down for the weekend at 5pm.

                    p.s. Why does the info in the output windows repeat?
                    Attached Files
                    Last edited by joemiller; 08-16-2013, 02:39 AM.

                    Comment


                      #40
                      Hello joemiller,

                      This info is all correct.

                      Our time zones are making things confusing.

                      From the data you have in the text files you have sent I am seeing that you are on the east coast.

                      Currently, I am writing you from Denver Colorado, in mountain time.

                      The 5:00 PM bar for you ends the session and is included with the day bar of the same date.

                      For me the Forex session ends at 3:00 PM (5:00 PM eastern). My local 5:00 PM bar print is part of the session ending on the next day.

                      Your data prints are correct however.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #41
                        So now, per the Excel spread sheet, if I can get to the correct getdaybar values I am probably home free. But how do I do that? I have experimented with a few coding changes but no success so far.

                        Second question: Why does the info in the output windows repeat?

                        Comment


                          #42
                          Hi joemiller,

                          Sorry I forgot to address that second question.

                          I am not seeing this repeating.. in my prints and in the files you have given me I am not seeing any duplicate prints.

                          Can you provide a new output file showing these duplicates.

                          Also, with the information you have what actions do you want your strategy to take for a 5:00 PM bar and for a 6:00 PM bar knowing these will print different days?
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #43
                            The output for dates Aug7 thru Aug13 In the Notepad file attached to Post 38 is repeated for both the day and the minute bars.

                            One set of dates for the day and minute bars are then moved to the Excel file for hopefully easier analysis.

                            bottom line, I want to have NT plot the correct red line in the analyzer chart for the non-day bars ... which is a function of the values returned by getdaybar.

                            Comment


                              #44
                              Hi joemiller,

                              I still am not able to replicate the duplicates.

                              Are you running a backtest or optimization?

                              May I have a screenshot of the parameters in the Strategy Analyzer?

                              To send a screenshot press Alt + PRINT SCREEN to take a screen shot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.

                              For detailed instructions please visit the following link
                              http://take-a-screenshot.org/
                              Chelsea B.NinjaTrader Customer Service

                              Comment


                                #45
                                it is a backtest.

                                screen shot is attached.

                                Run it once, clear the output window, then run the backtest again. I think maybe I've seen that make it happen...not sure.

                                the double output is a problem I can live with. the other is much more important to me.
                                Attached Files

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by NullPointStrategies, Today, 05:17 AM
                                0 responses
                                41 views
                                0 likes
                                Last Post NullPointStrategies  
                                Started by argusthome, 03-08-2026, 10:06 AM
                                0 responses
                                124 views
                                0 likes
                                Last Post argusthome  
                                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                                0 responses
                                64 views
                                0 likes
                                Last Post NabilKhattabi  
                                Started by Deep42, 03-06-2026, 12:28 AM
                                0 responses
                                41 views
                                0 likes
                                Last Post Deep42
                                by Deep42
                                 
                                Started by TheRealMorford, 03-05-2026, 06:15 PM
                                0 responses
                                46 views
                                0 likes
                                Last Post TheRealMorford  
                                Working...
                                X