Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi-timeframe aggregation help

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

    Multi-timeframe aggregation help

    hi guys,

    I have a 4500 tick chart (main data series....BarsInProgress = 0) and added a 1 minute data series to my strategy script (BarsInProgress = 1).

    I simply want to capture and count how many bars from the 1m exceeded volume by a certain level while my 4500 tick data series was still open. Any thoughts and guidance would be greatly appreciated.

    My strategy is set to CalculateOnBarClose = true, so I'm fine with waiting until after the main data series closes.

    -Mike

    #2
    Hello successfulmike,

    Thank you for the post.

    This type of logic could be achieved by using an int, you can see this visually and store its value using a Plot.

    Here is an example of accumulating a value and then plotting it, after being plotted the value is reset. You don't need to use a Plot specifically this is just for demonstration purpose.

    Code:
    int barCount;	
    protected override void Initialize()
    {
        Add(PeriodType.Minute, 1);
        Add(new Plot(Color.Red, PlotStyle.Bar, "Plot0"));
    }
           
    protected override void OnBarUpdate()
    {
    	if(CurrentBars[0] < 1 || CurrentBars[1] < 1) return;
    	if(BarsInProgress == 0)
    	{
    		Value.Set(barCount);			
    		barCount=0;
    	} 
    	else if (BarsInProgress == 1)
    	{
                    //do some volume check in here and increment barCount if criteria matched
    		barCount++;
    	}
    }
    I look forward to being of further assistance.
    Last edited by NinjaTrader_Jesse; 03-25-2017, 10:45 AM.

    Comment


      #3
      thanks Jesse, this works perfectly! The only issue that I'm having now is that I'm receiving error when compiling the code where it's not detecting "Value" from that plot line you added. Error says:

      -------------
      Argument '1': cannot convert from 'NinjaTrader.GUI.Chart.Plot' to 'NinjaTrader.Indicator.IndicatorBase'
      The name 'Value' does not exist in the current context
      -------------

      I tested the code by removing the Plot line you added, but I would like to get it working since it does give me a quick visual without relying on the Output Window.

      Thanks for your help. As a reminder, this is a Strategy script not an indicator so I'm not sure if there are other classes that are required but I do have the NinjaTrader.Indicator and NinjaTrader.GUI.CHart class already added.

      Comment


        #4
        Hello successfulmike,

        Thank you for the reply.

        Value is an inherited property of an indicator, the reason for this error is that strategies in NT7 cannot plot. This is a feature that was added in NT8, but you can still accomplish plotting in NT7. A dummy indicator is required. Please see the following example that passes a value from a strategy to a dummy indicator which plots the value: http://ninjatrader.com/support/forum...ead.php?t=6651

        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

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