Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Market Replay - Time machine?

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

    Market Replay - Time machine?

    Hi,

    With Calculate on bar close = false

    i had deals entering before the bar had closed, and my strategy calls for the end of the 5min bar to be outside the range. It entered as soon as it ticked outside the range.

    With it set to True it waited for the bar to close then went back in time and entered a Short Trade at the high of the bar and closed it out at the close. Until the next trade when it went hey lets enter whenever.

    Is this typical of Market Replay? Thus far it seems to be a different system to NinjaTrader backtest.

    Any general tips? Or strategies need t be rewritten from scratch to run in replay?

    Willthis be the same for Live, or is there a 3rd process to learn?

    Cheers

    #2
    Originally posted by Aussiemike View Post
    Hi,

    With Calculate on bar close = false

    i had deals entering before the bar had closed, and my strategy calls for the end of the 5min bar to be outside the range. It entered as soon as it ticked outside the range.

    With it set to True it waited for the bar to close then went back in time and entered a Short Trade at the high of the bar and closed it out at the close. Until the next trade when it went hey lets enter whenever.

    Is this typical of Market Replay? Thus far it seems to be a different system to NinjaTrader backtest.

    Any general tips? Or strategies need t be rewritten from scratch to run in replay?

    Willthis be the same for Live, or is there a 3rd process to learn?

    Cheers
    Unless your data is somehow corrupt, MarketReplay should play cleanly, as it has a definite streaming data source. Run the Replay at 1x speed near where you think that there is a problem, and see if there really are wonky entries.

    Comment


      #3
      Hi,

      I have tried that. I rewind it to just before the entry, and then have been making changes and running through.

      I can get the entry ok now, by looking at 1 bars ago, So it doesn't enter until the start of the next bar, but i can't get the exit. I've tried saying BarsSinceEntry, but that is always 0 in the output?

      I'm using 5min main time, and have tried Tick and Second subtime which is what the exits are under Barsinprogress ==1. Now i'm throwing BarsArrays, and whatever so i dont recognise my strategy anymore.

      Between dodgy entries, and a $2 Short trading limit on Replay account i'm frustrated with the Market Replay behaviour.


      Any ideas? Perhaps i can message you some examples?

      Comment


        #4
        Here is an example.

        I've entered a Long, but i cant get out of it. I use 5min as the main time, and have
        Add(PeriodType.Second,1);
        CalculateOnBarClose = false;

        I need to use barsSinceentry. If i dont then the trade does some ridiculous time travel maneuver. Unfortunately does not even use it's knowledge to execute in my favour, or i might just consider switching it on :-)

        I have this debug code:

        if (Position.MarketPosition == MarketPosition.Long)
        {
        Print(Time[0].ToString());
        Print("Bars :" + BarsInProgress);
        Print("BarsSinceEntry 0:" + BarsSinceEntry(0,"",0));
        Print("BarsSinceEntry 1:" + BarsSinceEntry(1,"",0));


        I get this in Output window

        The moment i enter the Trade.
        02/01/2013 11:05:00
        Bars :1
        BarsSinceEntry 0:0
        BarsSinceEntry 1:0

        1 second later i get...
        02/01/2013 11:05:01
        Bars :1
        BarsSinceEntry 0:0
        BarsSinceEntry 1:0 ***.......would i not expect to see the BarsSince Entry change...?

        Even allowing that bars since entry looks for whole bars in between....

        02/01/2013 11:05:01
        Bars :1
        BarsSinceEntry 0:0
        BarsSinceEntry 1:0
        02/01/2013 11:05:02
        Bars :1
        BarsSinceEntry 0:0
        BarsSinceEntry 1:0
        02/01/2013 11:05:03
        Bars :1
        BarsSinceEntry 0:0
        BarsSinceEntry 1:0 ***... By now i would've hoped to see something.

        Comment


          #5
          Correction...Wishful thinking and half off the chart i assumed the numbers were about the entry level.

          Looked more closely. The entry is still a bag of Rubbish as well. More Intrabar Time Travel....

          Comment


            #6
            Short and Long execution is different. Mutli-time series does not work in Replay

            I let it run for a while see if anything will happen. IT never exited the Long, but i dont have a position.

            It may have secretly exited while it was executing a separate Short transaction which has since exited itself, although no evidence of the long exit.

            The Bars Since Entry output works for short. Not sure why this is as the code...looks the same to me...

            if (Position.MarketPosition == MarketPosition.Short)
            {
            Print(Time[0].ToString());
            Print("BarsSinceEntry 0:" + BarsSinceEntry(0,"",0));
            Print("BarsSinceEntry 1:" + BarsSinceEntry(1,"",0));

            ************************************************** **************************
            if (Position.MarketPosition == MarketPosition.Long)
            {
            Print(Time[0].ToString());
            Print("Bars :" + BarsInProgress);
            Print("BarsSinceEntry 0:" + BarsSinceEntry(0,"",0));
            Print("BarsSinceEntry 1:" + BarsSinceEntry(1,"",0));


            But here it is "Working"

            It registers a Bar since entry on the 2nd data series which is 1 Second time frame.

            02/01/2013 12:29:55
            BarsSinceEntry 0:0
            BarsSinceEntry 1:0
            02/01/2013 12:30:03
            BarsSinceEntry 0:1
            BarsSinceEntry 1:1


            That 1 Second lasts for 5mins...?
            .
            02/01/2013 12:34:59
            BarsSinceEntry 0:1
            BarsSinceEntry 1:1
            02/01/2013 12:34:59
            BarsSinceEntry 0:1
            BarsSinceEntry 1:1
            02/01/2013 12:35:00
            BarsSinceEntry 0:2
            BarsSinceEntry 1:2


            So from what i see..... why is the secondary time series not working at all?
            Is Second time frame valid? I only started using it as Tick was rubbish too.
            And why is there different behaviour between long and Short? This would tie in with the issue where i can't short more than $1 worth of Ccy.

            Cheers

            Comment


              #7
              Originally posted by Aussiemike View Post
              ...
              That 1 Second lasts for 5mins...?
              .
              02/01/2013 12:34:59
              BarsSinceEntry 0:1
              BarsSinceEntry 1:1
              02/01/2013 12:34:59
              BarsSinceEntry 0:1
              BarsSinceEntry 1:1
              02/01/2013 12:35:00
              BarsSinceEntry 0:2
              BarsSinceEntry 1:2


              So from what i see..... why is the secondary time series not working at all?
              Is Second time frame valid? I only started using it as Tick was rubbish too.
              And why is there different behaviour between long and Short? This would tie in with the issue where i can't short more than $1 worth of Ccy.

              Cheers
              From the NT Help on the BarsSinceEntry topic:
              "Note: When working with a multi-series strategy the BarsSinceEntry() will return you the elapsed bars as determined by the first Bars object for the instrument specified by the barsInProgressIndex."

              Which jibes with what you see, and yes, that seems to make it pretty useless as a measure to me. It looks like you will have to code to count your own barsSinceEntry.

              Comment


                #8
                Thanks.

                So It's always going to be the 5min bars since entry (in this charts case). That's kind of ok, as you see it will prevent an immediate exit during the entry bar anyway.

                Big problem still is this time travel rubbish. Check this test out...Screentprints showing an entry of this code.

                I use [1] Bars ago to try and stop it from entering on the decision bar, but it doesn't help.

                This is with COBC = False

                if (Position.MarketPosition == MarketPosition.Flat
                && Close[1] < Bollinger(BollDev, bollDays).Lower[1])


                Crazy_entry2 is the entry with the same code if i put COBC = true

                That picks an entry price that never existed....again not in my favour....at least if it was i could give it credit for trying...
                Attached Files

                Comment


                  #9
                  Originally posted by Aussiemike View Post
                  Thanks.

                  So It's always going to be the 5min bars since entry (in this charts case). That's kind of ok, as you see it will prevent an immediate exit during the entry bar anyway.

                  Big problem still is this time travel rubbish. Check this test out...Screentprints showing an entry of this code.

                  I use [1] Bars ago to try and stop it from entering on the decision bar, but it doesn't help.

                  This is with COBC = False

                  if (Position.MarketPosition == MarketPosition.Flat
                  && Close[1] < Bollinger(BollDev, bollDays).Lower[1])


                  Crazy_entry2 is the entry with the same code if i put COBC = true

                  That picks an entry price that never existed....again not in my favour....at least if it was i could give it credit for trying...
                  You are only showing your entry conditions. What is your actual entry code?
                  Last edited by koganam; 01-27-2013, 07:43 PM.

                  Comment


                    #10
                    Hey Koganam,

                    I've sorted this for now i think. I've got the Longs working thus far. I'd left out a BarsArrays reference in a couple of the long decisions, and that seems to be working now.

                    I still have the unusual issue of being able to trade large sizes long, but not short. That is what added to the confusion, but then in producing a trimmed strategy fro NT to test i poured through what criteria to send them and noticed the BarsArrays...

                    So i guess i'll just see what they say after testing that.

                    Thanks as always for your help

                    Comment


                      #11
                      This thread has me concerned a bit. My understanding of Market Replay is that each tick is time stamped just as recorded from live market and should replay accordingly. The 'time machine' effect that happens in Backtesting is something that I want to avoid at all costs. Is it possible for NT to peek forward or have the backward execution of the time machine effect when running a strategy on Market Replay?

                      My understanding is that Market Replay will stream the tick by tick data just as recorded from the live market. I also understand live market conditions can affect the execution and also that a single tick variance in when the chart starts to build can have an effect. But short of these obvious variables, are there some programming limitations built-in to the Market Replay mechanism that could produce problems like the 'time machine' effect?

                      Thanks.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      639 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      366 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      107 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      569 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      572 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X