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

Question regarding using data from day chart on intraday chart

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

    Question regarding using data from day chart on intraday chart

    I don’t have the luxury to monitor the markets full-time, so for at least part of the day, I rely on offline historical charts. Due to these limitations, I am experiencing a problem with intraday charting.

    My current data provider is BarChart. There are often minor discrepancies between intraday-data and day-data. For instance on Friday (Aug 31, 2018) AMZN had the following open data:

    On a 1-day chart, the open was: $2007.00
    On a 15-minute intraday chart, the open was: $2009.82

    To illustrate the difficulty I’m having, I’ve written a sample indicator that plots the current day’s open on an intraday chart. The indicator has one additional data series in addition to the chart series (see attachment for indicator):

    Code:
    AddDataSeries(BarsPeriodType.Day, 1); //Day Data.  Opens[1][x], Highs[1][x], etc.
    During the trading session, the value Opens[1][0] corresponds to the previous session open, and not the current session open. When the trading session finishes, the value Opens[1][0] corresponds to the open of the current session. This is, of course, the expected behavior (see Multi-Time Frame & Instruments in the NT Help Guide - https://ninjatrader.com/support/helpGuides/nt8/en-us/?multi-time_frame__instruments.htm)

    On days where there is no discrepancy between day and intraday data, the solution is to use CurrentDayOHL(BarsArray[0]).CurrentOpen[0]; However on days when there are discrepancies between day and intraday data, is there any way to retrieve the open price as shown on a day-bar chart, and use that data for plotting values on an intraday chart?


    Please see attachments for clarification and the indicator.
    Attached Files
    Last edited by h1000; 09-01-2018, 05:19 PM.

    #2
    yes use that chart successful with Dianabol that data for plotting values on an intraday chart
    How To cut weight
    sarms cycle
    where to buy sarms
    sarms online
    testogen gnc
    Legal steroids for sale – How it works? Legal steroids GNC
    Last edited by CynthiaAA; 10-09-2021, 02:28 AM.

    Comment


      #3
      Hello h1000,

      Thank you for your note.

      This discrepancy can be caused by some data providers providing an open/close value based on electronic trading hours vs regular trading hours as well as adjusted opens/closes.

      In your code, where you set DayDataOpen = Opens[1][0];, since you are running the script with Calculate set to OnPriceChange, Opens[1][0] should correspond with the current day bars opening price. If you comment out,

      Code:
      if (BarsInProgress == 0)
      Does the daily open correctly plot?

      I look forward to your reply.
      Alan P.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_AlanP View Post
        If you comment out,

        Code:
        if (BarsInProgress == 0)
        Does the daily open correctly plot?
        Alan, yes it does. Thanks for the solution. Simply commenting out the part you suggested creates a line that only extends one bar to the left of the last bar on the chart. I solved this with some extra code (see MyOpen2, attached).

        Moving the draw.line outside of the if (BarsInProgress == 0) may have some implications in regard to how some dataseries are processed, but I will have to get back to you in a few days on that matter--if it is indeed a problem and I can't solve it.

        Thanks again for the solution.
        Attached Files

        Comment


          #5
          Alan, as I suspected, there is a problem in how the current code works with dataseries/plots.

          I have attached a screenshot and an updated indicator (MyOpen3). As you can see, the plot (in Magenta) is only accurate on the final bar of the session (similar to my original code using draw.line).

          There is probably something quite simple that I'm overlooking, but thus far all remedies I've tried have not solved the problem.
          Attached Files

          Comment


            #6
            Hello h1000,

            Thank you for your patience.

            I wrote a loop which will set a plot equal to the current days open according to the daily series, not the minute series.

            Please let us know if you need further assistance.
            Attached Files
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              Alan, that’s an interesting way of doing things -- the "secret" to it working appears to be the Values[x][x] -- something I've not used with plots thus far.

              In the looping code you provided, I noticed that the final bar of any trading session gets a plot value corresponding to the next session’s open (See attached screenshot). As I could not understand why this was the case, I tweaked the code using BarsSinceNewTradingDay (See attached indicator). This corrects the problem.

              You’ve been a great help in getting this sorted out, and managing plots with Values[x][x] clears up some limitations that have long been an issue for me.

              Many thanks.
              Attached Files

              Comment


                #8
                Thanks NinjaTrader this is very helpful info

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by pkefal, 04-11-2024, 07:39 AM
                11 responses
                36 views
                0 likes
                Last Post jeronymite  
                Started by bill2023, Yesterday, 08:51 AM
                8 responses
                44 views
                0 likes
                Last Post bill2023  
                Started by yertle, Today, 08:38 AM
                6 responses
                25 views
                0 likes
                Last Post ryjoga
                by ryjoga
                 
                Started by algospoke, Yesterday, 06:40 PM
                2 responses
                24 views
                0 likes
                Last Post algospoke  
                Started by ghoul, Today, 06:02 PM
                3 responses
                16 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X