• 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 bmccoard, Today, 06:48 PM
              0 responses
              5 views
              0 likes
              Last Post bmccoard  
              Started by omololu, Today, 05:10 PM
              0 responses
              9 views
              0 likes
              Last Post omololu
              by omololu
               
              Started by fut_practic, Today, 05:01 PM
              0 responses
              7 views
              0 likes
              Last Post fut_practic  
              Started by persoguillermo, Today, 04:38 PM
              0 responses
              4 views
              0 likes
              Last Post persoguillermo  
              Started by localappleseed, Today, 09:59 AM
              1 response
              20 views
              0 likes
              Last Post NinjaTrader_Jermaine  
              Working...
              X