Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi-timeframe strategy w/daily bars not running

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

    Multi-timeframe strategy w/daily bars not running

    Ninjas,
    I've created a copy of the 'SampleMultiTimeFrame' Strategy with 1-minute bars as the primary timeframe and I've tried to add daily bars to this strategy without success.

    --I'm testing on the ZN 09-08 contract. In the Log file , the strategy initializes but no trades occur. When I remove the daily timeframe several trades occur.
    --The only change that I've made to the canned NT strategy is the following line, no other changes have been made:
    In Initialize() I've added the following:
    Add(PeriodType.Day, 1);
    --The primary timeframe is 1 minute bars. The strategy will run when I add tick or minute timeframes, it's only the daily timeframe that is the problem.
    --My data provider is IQFeed and I'm able to chart daily data for any given instrument.

    Question:
    1) Are there any known problems when trying to add a Daily timeframe to a strategy? With or without IQFeed?
    2) Can you try to replicate this problem using a copy of the canned'SampleMultiTimeFrame' Strategy ?

    Thanks,
    Lou

    #2
    There are no reports of anything wrong with adding a daily time frame. I have tested it on my end with the stock SampleMultiInstrument and I have no problems. Please check your Control Center logs for any errors. Also find attached my test sample.
    Attached Files
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh,
      I was able to get the daily data to work using my version of the strategy. Apparently, the problem was that I was only using 8 days of daily data since that's all the tick data I had for the other timeframes. Once I increased the period to about 1+ months I was able to get the daily data to work properly.

      Also, I have a related question but I think it realtes more to different data providers so I'll post it in the Miscellaneous section of the forum.

      Thanks,
      Lou

      Comment


        #4
        Great. Glad you got it sorted out.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Based on what is written previously in this thread, the following code should work. Specifically I'm using 1 minute data (only) and I'm trying to get the daily (2 day) moving average to print out its values. Nothing at all is output and there are no error messages in the log. (By the way, variable ma is declared as a double).

          What do I need to do to get the daily time series from 1 minute?


          Code:
          [FONT=Courier New][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]override[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Initialize()[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
          [FONT=Courier New][SIZE=2]Add(PeriodType.Day, [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]);[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]CalculateOnBarClose = [/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2];[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
          Code:
          [FONT=Courier New][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]override[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] OnBarUpdate()[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
          [FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] (BarsInProgress != [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2])[/SIZE][/FONT]
          [FONT=Courier New][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]; [/SIZE][/FONT]
           
          [SIZE=2][FONT=Courier New]ma = SMA(BarsArray[[/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]], [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]2[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2])[[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]];[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]Print(ma);[/FONT][/SIZE]
           
          [FONT=Courier New][SIZE=2]}[/SIZE][/FONT]

          Comment


            #6
            You just run it on a 1min chart and access BarsArray[0]. To output you need daily chart data. Please ensure you have data.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by algospoke, Yesterday, 06:40 PM
            2 responses
            19 views
            0 likes
            Last Post algospoke  
            Started by ghoul, Today, 06:02 PM
            3 responses
            14 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            45 views
            0 likes
            Last Post jeronymite  
            Started by Barry Milan, Yesterday, 10:35 PM
            7 responses
            20 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by AttiM, 02-14-2024, 05:20 PM
            10 responses
            181 views
            0 likes
            Last Post jeronymite  
            Working...
            X