Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Jumping from backtest to real-time test

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

    Jumping from backtest to real-time test

    Hallo,

    I am about to test my 2-timeframes strategy in realtime (however papertrding). This is the first time I do it so for sure it won´t work. Here are my concerns:

    1) For backtesting, I used txt files. One is called ER2 ##-## (with 4 years of daily bars) and the other txt is called ER2 06-08, and has 4 years of 30min bars.

    I am going to use IB for papertrading. If I leave the code like that, IB won´t know what is "ER2 ##-##", right?? so shall I change the code into
    ¿¿Add(PeriodType.Day, 1
    ) without indicating nothing else??
    I need a fairly long daily historical, for I use a SMA of 250 daily bars. The current ER2 06-08 contract surely has not 250 daily bars in it. So my SMA won´t be calculated correctly, am I right?? How can I fix this??

    Thanks for any help

    Juan Rivera

    #2
    Correct with your Add() syntax. The only resolution is to use a broker/market data vendor that offers sufficient number of historical days that your system requires.
    RayNinjaTrader Customer Service

    Comment


      #3
      i am new to trading, so I have really simple questions...

      If I am going to apply my strategy to the current traded contract ER2 06-08, the method Add(PeriodType.Day, 1) will calculate the daily bars of that contract. Will it have 250 daily bars? I doubt it, so I would like to calculate the SMA(250) on a "merged" contract (if such thing exists: The merge of the current 06-08 contract with the previous 03-08 and maybe the 12-07. The way to merge these, I do not know...)

      I do not know if I you can see what I mean, it is hard for me to write it in English.

      Thanks
      Juan Rivera

      Comment


        #4
        Yes, you can get data for 03-08, 06-08, and each contract before that and use our merge function to merge this data.

        You may run into limitations with IB, I am not sure which is why I suggested to consider a real-time data feed with historicald data that meets your requirements.

        - eSignal
        - IQFeed
        - OpenTick (this is free)

        are some vendors we support.

        Information on merging - http://www.ninjatrader-support.com/H...eV6/Merge.html
        RayNinjaTrader Customer Service

        Comment


          #5
          Hallo,

          Now I have a 4 years-long 30min bar for the ER2 06-08 contract (starting 05/01/2004). I connect it to IB and gets real time allright. So its 4 years long and gets new 30min bars. Great-

          But if I backtest my strategy against the ER2 06-08, which has a line like Add(PeriodType.Day, 1) and then a SMA of 200 days, I thought:

          1) NT will take my 4 years-long 30min bar for the ER2 06-08 contract, somehow compact it into days, wait for 200 days in order to calculate the required SMA, and then compare the 30min bars with that SMA...

          2) So the first trade in the backtest should be around november 04.

          But no, the first trade is around july 2007. Any ideas why? Is it a limitation within IB, as you suggested before, because NT is not taking into consideration the 4 long years contract I built, but the actual one?

          For that reason, for backtest I use the ER2 ##-##. What when I go realtime IB says ER2 ##-## is not a valid instrument.

          How can I test my strategy in real time and have it calculate an SMA of 200 bars?

          Thanks!
          Juan Rivera

          Comment


            #6
            Well on your ER2 06-08 contract are you able to pull up daily charts? Or are you only able to pull up 30min charts? If you can't pull daily charts that would be the problem.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Exactly, I cannot pull up daily charts but the 30min is ok, gets real time ok...

              Is that is the problem, what is the solution?

              Regards,

              Juan Rivera

              Comment


                #8
                Could be that IB Paper Trade does not support historical daily bars?
                RayNinjaTrader Customer Service

                Comment


                  #9
                  Well, I do the following while not connected to IB:

                  - I open a new chart of ER2 06-08 in 30min bars from 2004 to 2008. It opens ok.

                  - Then I change the resolution to daily bars and it is only from 19/06/2007. Where have all the other years gone??

                  Does NT only support one year of daily bars?

                  Comment


                    #10
                    30 minute bars are built/compressed from 1 minute data bars. Daily bars use daily bars, not minute bars thus you only have 1 year of daily bars available since this is likely the limitation of your data source?
                    RayNinjaTrader Customer Service

                    Comment


                      #11
                      Ok, In that case how would you advice me to build a 2-timeframe strategy with daily and 30min bars taking into account the following restrictions:

                      1) The strategy has to calculate a SMA (250 days) of a merged ER2 06-08 contract.
                      2) It must also calculate a SMA (150) of 30min bars. For a number of days, it also need a merged contract.

                      Should the daily bars be the primary bar object??? And the 30min bars the secondary?
                      What if I need a weekly check??

                      Is this feasible at all?? For me, checking the trend in very different timeframes is my setup, so I need NT to do this properly.

                      Thanks for your help.

                      Comment


                        #12
                        1st start off with a data feed that suppports historical minute and daily bars.

                        Then you can create multi-time frame strategies with the required data set you need.

                        Then (if you have not already) review this - http://www.ninjatrader-support.com/H...struments.html
                        RayNinjaTrader Customer Service

                        Comment


                          #13
                          So, what you are saying is that a minute chart and a daily chart are two different separate things....

                          My only dateset is a 4 year long 30min bar ER2 06-08 and it does not contain information of daily bars??

                          This is new to me, with my old software I was used to pulling up daily charts from 30min charts and viceversa never had a problem.

                          I just do not get it.

                          Thanks anyway for your help

                          Comment

                          Latest Posts

                          Collapse

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