Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using new DataSeries in multi-time frame strategy question

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

    Using new DataSeries in multi-time frame strategy question

    Hi NT team

    I am calculating a new DataSeries. How do I use it within a multi-time frame strategy? I run the strategy on weekly bars and add daily bars.
    I have done the following:

    Code:
    private DataSeries myMTMCumPnl;    
    
    protected override void Initialize()
    {
    Add(PeriodType.Day, 1); // BIP 1
    myMTMCumPnl = new DataSeries(this);
    }
    
    protected override void 
    {
    // code
    
    if (BarsInProgress == 1)
    {
    // 
    MTMPLCum = Position.GetProfitLoss(Closes[1][0], PerformanceUnit.Currency) + Performance.AllTrades.TradesPerformance.Currency.
    myMTMCumPnl.Set(MTMPLCum); // this is where I would like to set the  myMTMCumPnl dataseries to daily cumulated PnL
    PLDay = myMTMCumPnl[0]-myMTMCumPnl[1]; // this is where I would like to access the PLDay for the daily bars
    }
    
    }
    Somehow this works for single time frame strategies, but not for multi-time frame strategies. Could you help please how I use BarsArray[1] correctly to access/set the daily dataseries?

    Thank you
    whotookmynickname

    #2
    Hello whotookmynickname,

    Thank you for your post.

    Is this example the multi-time frame strategy that is not working? What is failing in your strategy?

    It appears you are making the proper use of the secondary bar series with Closes[1][0], no need to use BArsArray[1] unless accessing an indicator method.

    Comment


      #3
      Hi

      I am printing the calculated PLDay using
      if (BarsInProgress == 1)
      {
      if (PLDay != 0) Print(PLDay);
      }

      However, if I add all the printed PLDay up, it will not match the total P&L for the strategy. So either it is printing the wrong values or it skips bars. So there has to be a mistake. When I access myMTMCumPnl should I use myMTMCumPnls[1][0] instead or something like this?

      All else equal, it works perfectly if I run it on daily bars. The discrepancy only shows up if I am working with weekly bars.

      Thank you
      whotookmynickname
      Last edited by whotookmynickname; 10-15-2013, 12:16 PM.

      Comment


        #4
        Hello whotookmynickname,

        Thank you for your response.

        There is no need to use the [1][0] index reference with your own DataSeries as it will be set to the CurrentBar you use, so it should properly be updating for the daily bar series versus the weekly bar series.

        Can you provide the full code used in your testing? I would like to test on my end with your exact and full code.

        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
        574 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X