protected override void Initialize() { // Add a 5 minute Bars object which is added to the BarArray // which will take index 1 since the primary Bars object of the strategy // will be index 0 Add(PeriodType.Minute, 5); } protected override void OnBarUpdate() { // Ignore bar update events for the supplementary Bars object added above if (BarsInProgress == 1) return; // Pass in a Bars object as input for the simple moving average method // Checks if the 20 SMA of the primary Bars is greater than // the 20 SMA of the secondary Bars added above if (SMA(20)[0] > SMA(BarsArray[1], 20)[0]) EnterLong(); }
Can I have further clarification on the comment under the OnBarUpdate that if(BarsInProgress == 1) "Ignore bar update events for the supplementary Bars object added above "?
Question #2
Can I simply use "if (SMA(20)[0] > SMA(BarsArray[1], 20)[0])
EnterLong(); " without checking the BarsInProgress as long as I use the proper BarsArray[]? I ask this because I don't have live data currently so I can't check it out myself?
Thanks
Comment