Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicators not showing on last bar

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

    #16
    Chelsea,

    I'm just not seeing how you can divorce the fundamental element of time from your definition of synchronization. Imagine two military units synchronizing their efforts, and then showing up on different days, which is what is happening here between the price bar and the indicators. Do we only record the landing of plane at an airport at the moment when the plane next takes off?

    Your statement in your last post that "The bar is not closed after the end of the session" is exactly the issue I'm concerned about. I don't know any traders who perceive the "end of the session" to mean anything other than the "close of the session." To claim that the opening of the next session is the same as the closing of the prior session begs the question then of why we need both an opening price and a closing price for a bar.

    I think the mystery may have some resolution in what looks to be a high ratio of day traders using NT. In this case, with one bar instantly following another with no delay, the notion of updating the last bar when the current one starts is genuinely equivalent. But a swing trader, such as myself, uses the time between sessions to analyze swing movements, and the presence of timely indicator data, synchronized with session closure, is critical. I suspect the original system designers had mostly intraday trading in mind.

    While I have now developed a scheme to work around the situation, I encourage NT to develop an indicator update option which supports the needs of those not trading intraday. A good way to think of this is that any instrument which has a session close with significant time up until the next session open would need support. Although even 24/7 instruments take brakes on the weekends (maybe they are 24/5?), I'm sure that I am not the only trader who looks at charts on the weekend. And it sure would be nice if the indicators on those charts were synchronized with the bars closing on Friday.

    Like I said, I now have a work-around solution to meet my own needs, so I will leave you be on this subject. I will soon be activating a live account after using the NT no-cost developmental option. It has taken me some time to learn the NT software structures, and I am happy to report that I am able to typically code up strategies and indicators with only one quarter the number of lines of code that it takes in some other languages.

    I do appreciate your responding to my questions, and wish you the best.

    MSG

    Comment


      #17
      Hi MrSmartGuy,

      NinjaScript is event driven. Meaning there has to be received ticks to drive things like closing bars and opening new bars, or placing orders, triggering OnMarketData and the other NinjaScript event methods, etc.

      Try placing an order to the Sim101 after the session has closed or when you are disconnected. This will result in an error that there is no market data to drive the simulation engine.

      Code in a script is able to process in real time when Calculate on bar close is set to false or when a timer is used. What we are trying to highlight is how c# and NinjaTrader works internally and how you can write the proper code to work accordingly.

      A tick is needed to drive the event that closes the bar that opens the new bar. If no new bar is opened, the current bar is still the current bar.

      If you need information from a bar before the bar closes, then your script will have to run the calculation and set the plot before the bar closes. So you can check this on every tick in between bars, or you can use a timer and check when ever you would like and set the plot.

      In other words, if you need your script to behave in this way, the script needs to be coded to behave in this way. You will code to run before information stops being received or you will need to have a timer. Both will work fine, and your script with the proper logic will be able to have a plot that plots for the current day.

      Try setting the script to Calculate on bar close false so that it runs in real time. This may give you a better idea of why this will plot for the current day on a daily chart.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        I'm not sure if MrSmartGuy ever got this issue resolved, but I understand what he is saying. And I'm looking for the same kind of answers he is looking for. Maybe let me try to rephrase the question. ChelseaB says:

        Originally posted by NinjaTrader_ChelseaB View Post
        As I mentioned in post #6, the bar is closed when the new bar opens. That means that a bar will not be closed until there is a new building bar on the chart.
        What I want to know, and what I think MrSmartGuy wanted to know, is why can't Ninjatrader simply close out a bar at the end time for that bar? Why does it have to wait for another tick OUTSIDE that bar to occur? E.g. if you're building a day bar, once that day is over ALL the information needed for that bar is available. So what's the point of waiting for the next tick, especially if that next tick might not come for hours (or days if weekend starts). If his bars closed at the time he expected them, then his indicator would run when he expected it to, and his issue would be solved.


        Do you understand what I mean? And if you do, the question becomes: is there a way to have a bar close out once it's time span has ended, without waiting for an unnecessary tick to occur in the next bar?
        Last edited by YD777; 08-03-2016, 02:10 PM.

        Comment


          #19
          Hello YD777,

          These events are data driven. If no ticks come in, there is nothing to trigger OnBarUpdate or OnMarketData. NinjaTrader can't know for sure that the bar is closed until a tick with a time stamp of the new bar comes in.
          For example lets say 10 ticks come in at the end of the bar all with the exact same time stamp. NinjaTrader could capture the first and ignore the other 9 since the first has a timestamp of the last millisecond of the bar. But then the volume for that bar would be incorrect and those last 9 ticks would be lost.
          So, by waiting until the first tick of the next bar, we can be certain that the ticks for the most recently built bar are correct.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Thanks, that makes sense. I don't think it's perfect for people who trade low volume stocks, but I figured a few ways around it.
            Last edited by YD777; 08-04-2016, 12:22 AM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bortz, 11-06-2023, 08:04 AM
            47 responses
            1,607 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            9 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            19 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            6 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            15 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X