• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

The unpredictable behavior of a function LastPlayback

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

    The unpredictable behavior of a function LastPlayback

    Code:
    foreach (string ss in tmp)
    {
    
                            string[] spl = ss.Split(';');
                            if (ss.Length > 20)
                            {
                                double o = Convert.ToDouble(spl[1].Replace('.', ','));
                                double h = Convert.ToDouble(spl[2].Replace('.', ','));
                                double l = Convert.ToDouble(spl[3].Replace('.', ','));
                                double c = Convert.ToDouble(spl[4].Replace('.', ','));
                                ncl.LastPlayback("$EURUSD", o, 1, Convert.ToDateTime(spl[spl.Length - 2]).ToString("yyyyMMddHHmmss"));
                                ncl.LastPlayback("$EURUSD", h, 1, Convert.ToDateTime(spl[spl.Length - 2]).ToString("yyyyMMddHHmmss"));
                                ncl.LastPlayback("$EURUSD", l, 1, Convert.ToDateTime(spl[spl.Length - 2]).ToString("yyyyMMddHHmmss"));
                                ncl.LastPlayback("$EURUSD", c, 1, Convert.ToDateTime(spl[spl.Length - 2]).ToString("yyyyMMddHHmmss"));
    }
    Each time this code is executed in different ways.
    All the candles should be with volume 4 but some of them (randomly) have a volume 3,5,8
    Data candles fit on top of each other
    Last edited by vladko; 04-09-2017, 02:51 PM.

    #2
    Hello vladko,

    ncl.LastPlayback is not a documented NinjaTrader method.

    Is this a method that was written by you?

    Are you attempting to read values from a text file?
    http://www.ninjatrader.com/support/f...ead.php?t=3476

    Are you trying to print the open, high, low, and close?
    Try:
    Code:
    Print(string.Format("{0} | Open: {1}, High: {2}, Low: {3}, Close: {4}", Time[0], Open[0], High[0], Low[0], Close[0]));
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello vladko,

      ncl.LastPlayback is not a documented NinjaTrader method.

      Is this a method that was written by you?

      Are you attempting to read values from a text file?
      http://www.ninjatrader.com/support/f...ead.php?t=3476

      Are you trying to print the open, high, low, and close?
      Try:
      Code:
      Print(string.Format("{0} | Open: {1}, High: {2}, Low: {3}, Close: {4}", Time[0], Open[0], High[0], Low[0], Close[0]));
      It's yours method.

      Quote from Help:

      int LastPlayback(string instrument, double price, int size, string timestamp)

      Sets the last price and size for the specified instrument for use when synchronizing NinjaTrader playback with an external application playback. A return value of 0 indicates success and -1 indicates an error. The timestamp parameter format is "yyyyMMddhhmmss".

      Comment


        #4
        Hello vladko,

        Are you writing a NinjaScript or are you attempting to call data through the NinjaTrader API from your own external program?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello vladko,

          Are you writing a NinjaScript or are you attempting to call data through the NinjaTrader API from your own external program?
          External program

          Comment


            #6
            Any help?
            Thank you.

            Comment


              #7
              Hello vladko,

              I've taken some time to create an external test script and test the LastPlayback method from the API interface.

              I was not able to reproduce any issues and this does appear to be working as expected.

              Below is a link to a video of the test.
              https://www.screencast.com/t/iYSXTTSdG8

              Please let me know if I have performed this test correctly.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Of course it work's good with
                Code:
                DateTime.Now.ToString("yyyyMMddHHmmss")
                try my code:

                Code:
                DateTime dt = new DateTime(2017, 4, 11, 9, 0, 0);
                            for (int i = 0; i < 300; i++)
                               ncl.LastPlayback("$EURUSD", 10 + i * 0.0001, 1,dt.AddSeconds(i).ToString("yyyyMMddHHmmss"));
                And you will see that each time you run this code the volume of each of the 5 bars will be different

                Comment


                  #9
                  See the video
                  https://yadi.sk/d/QqZRJFpp3GsgN3

                  Comment


                    #10
                    NinjaTrader_ChelseaB
                    What you think?

                    Comment


                      #11
                      Hello vladko,

                      Thanks for your note.

                      I was able to reproduce the behavior.
                      https://www.screencast.com/t/FwdHTzxtHyj

                      The issue appears to be how NinjaTrader is generating the time based bars and not with the LastPlayback function directly.

                      Using a 50 Tick chart, the bars are always exactly the same.

                      I'm wondering if this is related to the limitation with timestamps and second granularity that was improved to millisecond granularity in NinjaTrader 8.
                      http://ninjatrader.com/support/helpG...meFrameObjects

                      I'm asking our development about this and I will post once I have more information.
                      Last edited by NinjaTrader_ChelseaB; 04-13-2017, 10:07 AM.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Ok, will wait.

                        Originally posted by NinjaTrader_ChelseaB View Post
                        Hello vladko,
                        I'm wondering if this is related to the limitation with timestamps and second granularity that was improved to millisecond granularity in NinjaTrader 8.
                        With NT8 same thing

                        Comment


                          #13
                          NinjaTrader_ChelseaB
                          Any news?

                          Comment


                            #14
                            Hello vladko,

                            There has been no update from development at this time.

                            We appreciate your patience.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Hello vladko,

                              I have received a tracking ID for this behavior.

                              For future reference, this item where bars building from data received from API -> LastPlayback is building inconsistenly is being tracked with ID #NTEIGHT-11580.

                              Please wait for a future version of NinjaTrader 8 to be released before checking the release notes for this item.
                              http://ninjatrader.com/support/helpG...ease_notes.htm
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by tvaughan4, 12-13-2019, 10:46 PM
                              2 responses
                              13 views
                              0 likes
                              Last Post tvaughan4  
                              Started by digibob, 12-13-2019, 10:01 PM
                              3 responses
                              11 views
                              0 likes
                              Last Post digibob
                              by digibob
                               
                              Started by ldissinger, Yesterday, 12:55 PM
                              1 response
                              12 views
                              0 likes
                              Last Post ldissinger  
                              Started by pstrusi, Yesterday, 09:06 AM
                              1 response
                              24 views
                              0 likes
                              Last Post marcus2300  
                              Started by vpzdcv, Yesterday, 02:31 AM
                              0 responses
                              13 views
                              0 likes
                              Last Post vpzdcv
                              by vpzdcv
                               
                              Working...
                              X