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

data delay

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

    data delay

    I'm trying to write data to a file using this tutorial:
    https://ninjatrader.com/support/foru...xt-file?t=3477
    when the flag is true
    protected override void Initialize ()
    {
    CalculateOnBarClose = true;
    }
    the data I receive has a 30 minute delay. plus they are not updated. they are loaded once after loading into the indicator window.
    how to get the data of the last bar on closing?
    ps flag by tick(=false) works. it i s demo account

    Click image for larger version  Name:	delay.png Views:	0 Size:	13.2 KB ID:	1119159

    #2
    Hello ansgrecho, thanks for writing in.

    Could you share details on the specifics of how you have coded this? The important parts would be the where the first timestamp is coming from and where the last time stamp is coming from (DateTime.Now? Times[][]?)

    I look forward to hearing from you.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi ChrisL. Thanks for answer.
      Attached Files

      Comment


        #4
        Hello ansgrecho, thanks for your reply.

        The output screen shot seems to be from historical data. If you print out DateTime.Now, it will return the current system time, so you probably ran the script at 7:19:15 and that time stamp is printing for every historical bar.

        Now, if you run the script OnEachTick and you are running the script on a minute bar series, your timestamps will only go down to the minute, even though you are getting multiple OnBarUpdate calls on each bar.

        On a chart, are you seeing the minute bars printing the current time?
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Click image for larger version  Name:	delay2.png Views:	0 Size:	160.7 KB ID:	1119273Click image for larger version  Name:	delay3.png Views:	0 Size:	179.6 KB ID:	1119274
          hi Chris!
          i want to see time correlated data. so I call the current time.
          by calling CalculateOnBarClose with true or false, in the Ninja Output window I get the correct answer with (false and FirstTickOfBar),
          but in the file I have non-correlating data.
          BUT when i delete the indicator from the window of indicators all data correct to upload to file.
          How can I get the correct data in the file at real time?
          OnEachTick. i didn't find this operator in https://ninjatrader.com/support/help..._reference.htm
          Is it hard to make a simple example Right once?
          You made it easier for many traders, and first of all for yourself, and would not answer the same questions over and over again.
          Last edited by ansgrecho; 09-22-2020, 09:43 AM.

          Comment


            #6
            Hello ansgrecho, thanks for your reply.

            I tested with the original example by turning CalculateOnBarClose to false and it is writing each tick to the txt file. Are you seeing the same thing when you just run the original example? Note this causes a very server performance problem when you run the file writing procedure on every tick.

            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Hello Chris!
              Yes if i run original example if works correctly.
              But i don't need EVERY tick. it is very expensive. i want to get only last OHLC bar and upload this data to file.
              How resolve it? it must be very Simple.

              Comment


                #8
                Hello ansgrecho, thanks for your reply.

                When I test the original example, it will print the OHLC of each bar on the chart. Did you modify the original example in any way? What is your output when testing the original script?

                I also linked an alternate example on your last post using a StreamWriter, please test that example as well to contract what might be going wrong.



                Chris L.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Chris.
                  a little magic and i to have gotten it. Thank you for your help.
                  The question is closed.
                  Last edited by ansgrecho; 09-24-2020, 03:31 AM.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Pattontje, Yesterday, 02:10 PM
                  2 responses
                  14 views
                  0 likes
                  Last Post Pattontje  
                  Started by flybuzz, 04-21-2024, 04:07 PM
                  17 responses
                  229 views
                  0 likes
                  Last Post TradingLoss  
                  Started by agclub, 04-21-2024, 08:57 PM
                  3 responses
                  17 views
                  0 likes
                  Last Post TradingLoss  
                  Started by TradingLoss, 04-21-2024, 04:32 PM
                  4 responses
                  43 views
                  2 likes
                  Last Post TradingLoss  
                  Started by cre8able, 04-17-2024, 04:16 PM
                  6 responses
                  56 views
                  0 likes
                  Last Post cre8able  
                  Working...
                  X