• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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:
          protectedoverridevoid Initialize()
          {
          Add(PeriodType.Day, 1);
          CalculateOnBarClose = true;
          }
          Code:
          protectedoverridevoid OnBarUpdate()
          {
          if (BarsInProgress != 0)
          return; 
           
          ma = SMA(BarsArray[1], 2)[0];
          Print(ma);
           
          }

          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 brian meade, Today, 01:39 PM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by Johnny Santiago, Today, 12:20 PM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Started by NinjaTrader_Brandon, Today, 10:24 AM
            0 responses
            50 views
            0 likes
            Last Post NinjaTrader_Brandon  
            Started by ptertich, Today, 07:56 AM
            2 responses
            15 views
            0 likes
            Last Post Johnny Santiago  
            Started by aslane, Today, 08:24 AM
            1 response
            15 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Working...
            X