Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Live trading, Backtesting, Market reply

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

    Live trading, Backtesting, Market reply

    Hi,

    I've backtested and done market replay testing for a strategy. They are fairly close as far as results and trade execution are concerned. Backtesting was done on minute and tick data. Market replay was done using the market replay download.

    I want to mimic the similar results in backtesting and market replay in live trading.

    COBC=true;

    The strategy = true. As my understanding is that even though COBC=true in backtesting the results are only calculate on close of the bar. Right?

    All in all i would prefer to execute live trading as similar as possible with backtesting results. Is there a template out there that tries to execute the trades similarly the way backtesting system does.. but in live trading?

    also in your opinion, is tick value 1 more closer to real time or market replay data?
    Last edited by staycool3_a; 10-13-2014, 07:32 PM.

    #2
    for example; if testing is done on 1min data with COBC=false. in backtesting the entries and exited are still being executed on COBC=true.

    so if i change my COBC to true in live testing and my trades are executed on 1 min data. shouldnt my results be close?

    one of the variables that is very important is that the strategies is a multi instrument strategies, and it calculates the profit and loss.. so in backtesting the exits and based on COBC=true; but in live trading if my profit/loss is XYZ.. my trades will exit based on live performance. or will they? if COBC=true .. will profit/loss be calculated after each minute data bar has closed?

    Comment


      #3
      Hello calhawk01,

      Thank you for your post.

      In real-time trading, even with CalculateOnBarClose = True, the orders are executed on the tick and not on the close of the bar. The orders themselves will be submitted when the bar closes but the executions occur in real-time.

      In backtesting, the calculations are performed on the bar close, and the orders are executed on the close of the bar as well.

      Rather than trying to push real-time towards backtesting type fills (which is not something that can truly be achieved), you would want to push executions of orders in backtesting towards real-time fills.
      Use an additional series in the code that is smaller such as 1 Tick and then set the orders to execute on the secondary bar series index. This idea is detailed in the reference sample at the following link: http://www.ninjatrader.com/support/f...ead.php?t=6652

      For more information on the discrepancies between real-time and historical testing please visit the following link: http://www.ninjatrader.com/support/h...ime_vs_bac.htm

      Please let me know if I may be of further assistance.

      Comment


        #4
        Originally posted by NinjaTrader_PatrickH View Post
        Hello calhawk01,

        Thank you for your post.

        In real-time trading, even with CalculateOnBarClose = True, the orders are executed on the tick and not on the close of the bar. The orders themselves will be submitted when the bar closes but the executions occur in real-time.

        In backtesting, the calculations are performed on the bar close, and the orders are executed on the close of the bar as well.

        Rather than trying to push real-time towards backtesting type fills (which is not something that can truly be achieved), you would want to push executions of orders in backtesting towards real-time fills.
        Use an additional series in the code that is smaller such as 1 Tick and then set the orders to execute on the secondary bar series index. This idea is detailed in the reference sample at the following link: http://www.ninjatrader.com/support/f...ead.php?t=6652

        For more information on the discrepancies between real-time and historical testing please visit the following link: http://www.ninjatrader.com/support/h...ime_vs_bac.htm

        Please let me know if I may be of further assistance.

        thanks, agreed.

        please answer below questions, thanks in advance.

        1) in real time if i have COBC= true, will my orders be submitted based on 1 min data and executed based on tick data. correct?

        2) in real time if COBC = true and my data is 1 min, and one of my variable is "Positions[0].GetProfitLoss, Performance > 100" i believe NT will execute my order as soon as profit > 100 (based on tick data) even thought my data is 1 min. How can i make "Positions[0].GetProfitLoss, Performance > 100" be calculated based on 1 min data?

        for example; if my secondary instrument data in the strategy is 1 min. and my variable is combined pnl of both instruments > XYZ, in real time trading, will the strategy wait until the combined pnl for both instrument is > XYZ based on 1 min data or tick data? i think its going to be tick data? how can i make it 1 min

        3) in your opinion what is closer to real time ... 1 tick value or market replay data? my market replay data vs 1 tick value backtesting is substantially different. any opinion on that? is something wrong with my code? my tick data is from cgq.. last, bid & ask

        4) essentially i'm very much in testing my strategy. i have previously always tested my strategies on market replay data as i've heard the downfalls of backtesting in NT. but now I have 1 tick values. And i want to speed up the process of testing as market replay process is taking a lot longer.

        5) also if my secondary symbol in the strategy code is "GC 12-14" and primary symbol is DX #### (continuous contract).. during backtesting, does NT know how to convert GC 12-14 to continuous contract if my backtesting range is larger than current contract? or should i add "GC ####" in strategy code?
        Last edited by staycool3_a; 10-13-2014, 07:50 PM.

        Comment


          #5
          Hello calhawk01,

          Thank you for your response.

          1. Correct, the calculations would be done on the close of the bar and thus the orders sent when the bar closes. The executions will occur base don the real-time tick by tick market.

          2. The check for "Positions[0].GetProfitLoss, Performance > 100" will occur depending on where it is placed. Is it placed in OnBarUpdate()? If so and CalculateOnBarClose is set to True, then this will calculate on the bar close.

          3. Market Replay would be the closer of the two to real-time trading. Backtesting can only simulate intra-bar fills with a smaller bar series. Market Replay is a play back of the real market as it occurred.

          5. NinjaTrader will use the Merge Policy set under Tools > Options > Data to determine if the current contract will be treated as a continuous contract. Using MergeBackAdjusted or MergeNonBackAdjusted would treat the current contract as a continuous contract.
          For information on Merge Policies please visit the following link: http://www.ninjatrader.com/support/h...rical_data.htm

          Please let me know if you have any questions.

          Comment


            #6
            Originally posted by NinjaTrader_PatrickH View Post
            Hello calhawk01,

            Thank you for your response.

            1. Correct, the calculations would be done on the close of the bar and thus the orders sent when the bar closes. The executions will occur base don the real-time tick by tick market.

            2. The check for "Positions[0].GetProfitLoss, Performance > 100" will occur depending on where it is placed. Is it placed in OnBarUpdate()? If so and CalculateOnBarClose is set to True, then this will calculate on the bar close.

            3. Market Replay would be the closer of the two to real-time trading. Backtesting can only simulate intra-bar fills with a smaller bar series. Market Replay is a play back of the real market as it occurred.

            5. NinjaTrader will use the Merge Policy set under Tools > Options > Data to determine if the current contract will be treated as a continuous contract. Using MergeBackAdjusted or MergeNonBackAdjusted would treat the current contract as a continuous contract.
            For information on Merge Policies please visit the following link: http://www.ninjatrader.com/support/h...rical_data.htm

            Please let me know if you have any questions.
            thanks Pat

            2. The check for "Positions[0].GetProfitLoss, Performance > 100" will occur depending on where it is placed. Is it placed in OnBarUpdate()? If so and CalculateOnBarClose is set to True, then this will calculate on the bar close.

            This is placed within OBU. So it should be calculated based on data series. Thanks

            3. Market Replay would be the closer of the two to real-time trading. Backtesting can only simulate intra-bar fills with a smaller bar series. Market Replay is a play back of the real market as it occurred.

            But shouldnt tick data be exactly as market replay? as each tick is being preserved?

            Comment


              #7
              Hello calhawk01,

              Thank you for your response.

              If you are comparing a 1 Tick backtest to a 1 Tick Market Replay, then yes they should match.

              Comment


                #8
                I think this is similar problem that I have.

                I run a strategy. This is based in day order. Or in close or in open.

                If I run a strategy in Strategy Analyser is ok and the strategy will say be close SPY in 23 jan.
                But if I check the box in tab "Strategies" or execute the strategy in choose in graph... I have this:
                "order... can't be submitted: instrument type 'Stock' is not supported by any provider connected affected..."

                This happen if I connect Simulated Data Feed or Kintick.
                But if is based the strategy in Close price, there be executed or at least appear that executed.
                There are some default parameters that I have change?

                Can you suggest the parameter to appear that if I execute the strategy today, example, they have in history executed... because she should have been performed in last days.

                Thanks

                Comment


                  #9
                  Hello jmagaia,

                  Thank you for your post.

                  Please send me your log and trace files for today so that I may look into what occurred.

                  You can do this by going to the Control Center-> Help-> Mail to Platform Support.

                  Please place this thread in the subject line: "http://www.ninjatrader.com/support/forum/showthread.php?t=69426"

                  Comment

                  Latest Posts

                  Collapse

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