the way it works is. If ur dailytimeframe closes it will then add together the last X (60 in your case) minute bars.
i hope that should finally be what ur looking for. .cs included
EDIT: Note that u wont get any intradayupdates for that days volume. only after the close of the daily you will get the update for that day.
NOTE: as u can see, the way you present what you wanna do actually makes a great diffrence how you(or anybody) will tackle the problem of gettin it done in code. if you had provided all the information in the first place it wouldve been much easier (and less timeconsuming) to help you. so try next time and always to be as specific as possible when tryin to describe what u actually want or need the indicator to do.
if you find an error or something is not the way u want it to, still feel free to ask tho
using System.Collections.Generic; using System.Linq; namespace NinjaTrader.Indicator { [Description("")] public class VolumeSum : Indicator { #region Variables private List<double> volumelist = new List<double>(); private int period = 60; #endregion protected override void Initialize() { Add(new Plot(Color.Green, "VolumeRange")); Overlay = false; BarsRequired = 1; Add(PeriodType.Minute, 1); CalculateOnBarClose = true; } protected override void OnBarUpdate() { if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired) return; if (BarsInProgress == 1){ volumelist.Add(Volume[0]); } } if (BarsInProgress == 0){ double volumesum = volumelist.Skip(volumelist.Count-period).Take(period).Sum(); Value.Set(volumesum); } } #region Properties [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove [GridCategory("Timeframe"), Description("")] public int LookBackPeriod { get { return period; } set { period = value; } } [Browsable(false)] public DataSeries Default { get { return Values[0]; } } #endregion } }
Comment