Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Playback connection Time and Low seems to be from a different date.

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

    Playback connection Time and Low seems to be from a different date.

    I'm connected to the playback connection. Specifically ES 03-22 at 8:53 AM (central) on 12/20/2021.

    When I print the low of the current bar (using Low[0]) and when I print the time (using Time[0]) I'm getting data from 12/14/2021 at 5:15 PM.

    When the strategy places orders, the orders appear where I would expect on the chart, according to where I have the playback connection set to. The date/time that the playback connection is set to matches up with the orders so that all looks fine - the problem is when I print the time and the low I'm getting data from 12/14.

    I discovered this issue while debugging. I noticed the stop was not being placed because of calculation issues, which I traced back to the fact that the data being pulled using Time[] and Low[] are from a totally different date.

    I don't want to fill this post up with unnecessary info and I'm not sure what else to share to ask for help, so if I'm leaving out needed info please let me know and I'll be happy to share.

    #2
    Hello WalterSkinner,

    May I have a screenshot of the playback controller and the output window with the print?

    Take this screenshot after a bar closes and a new print appears.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello WalterSkinner,

      May I have a screenshot of the playback controller and the output window with the print?

      Take this screenshot after a bar closes and a new print appears.
      Thank you so much for taking the time to reply on a Sunday evening.

      Here is the annotated screenshot, I hope this has everything you need.

      One thing to note is that I'm using a custom buy/sell button based on the WPF button example with the red and green buttons that is out there. The data from the 14th is pulled from within the WPF button click event.

      Edit:
      The first box in blue (from 8:53:00) was not from onbarupdate that was from clicking the button. Only the second box in blue was from onbarupdate.
      Click image for larger version  Name:	1226.png Views:	0 Size:	1.26 MB ID:	1183102
      Attached Files
      Last edited by WalterSkinner; 12-26-2021, 06:39 PM.

      Comment


        #4
        Hello WalterSkinner,

        If the print is in a click event and not in OnBarUpdate() are you using TriggerCustomEvent to synchronize the series first?


        TriggerCustomEvent must be used from all non-data-driven methods.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello WalterSkinner,

          If the print is in a click event and not in OnBarUpdate() are you using TriggerCustomEvent to synchronize the series first?


          TriggerCustomEvent must be used from all non-data-driven methods.

          I am not, thank you so much!

          I'll read up on this and get it implemented at first glance it looks like it may be over my head.

          Are you aware of any other examples I can look at that might help me understand?

          If this is overly complex perhaps it would be simpler to calculate on each tick rather than on bar close, and move the order entry and stop placement to onbarupdate.

          What I'm doing is creating my own buy/sell buttons that place entry orders, and then my trade management is then handled by the strategy. Basically so I can enter manually and then use the strategy to systematically handle scales and various exit conditions.


          Comment


            #6
            Hello WalterSkinner,

            Below are links to an examples that use TriggerCustomEvent().
            https://ninjatrader.com/support/foru...18#post1126818
            https://ninjatrader.com/support/foru...445#post496445
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChelseaB View Post
              Hello WalterSkinner,

              Below are links to an examples that use TriggerCustomEvent().
              https://ninjatrader.com/support/foru...18#post1126818
              https://ninjatrader.com/support/foru...445#post496445
              This is unbelievable!

              Thank you so so much

              Comment


                #8
                Originally posted by NinjaTrader_ChelseaB View Post
                Hello WalterSkinner,

                Below are links to an examples that use TriggerCustomEvent().
                https://ninjatrader.com/support/foru...18#post1126818
                https://ninjatrader.com/support/foru...445#post496445
                Hi Chelsea (or anyone else willing to help),

                Using the examples provided I was able to resolve the issue and it's working like a dream.

                There is one part of the code that uses this:
                Code:
                o =>
                which I've not yet come across.

                The C# documentation says:

                The => token is supported in two forms: as the lambda operator and as a separator of a member name and the member implementation in an expression body definition.
                At this point I figured it would be best to ask which (if either) of these is relevant for this part of the code before I waste a bunch of time.

                This is how I used the examples. This is in the click event part of the code:

                Code:
                TriggerCustomEvent( o =>
                {
                     StopLossPrice = MIN(Low,5)[0] - 3*TickSize;
                }, null);

                Comment


                  #9
                  Hello WalterSkinner,

                  That is a delegate using Linq.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NullPointStrategies, Yesterday, 05:17 AM
                  0 responses
                  63 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  139 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  75 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  45 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  50 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X