public static int GetWeekNumber(this Bars bars, int bar)public int GetWeekNumber( Bars bars, int bar )
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators;namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { for(int bar = 1; bar < Bars.Count; bar++) { if( Bars.GetWeekNumber( bar ) > Bars.GetWeekNumber( bar-1 ) ) { // Color the background if today is the first day in a new week SetBackgroundColor(bar, Color.LightBlue); } } } } }
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using Community.Components; /*** Requires installation of Community.Components Extension from www.wealth-lab.com > Extensions ***/namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // Create an instance of the Calculate class that contains the GetWeekNumber function // Pass it a WealthScript object Calculate calc = new Calculate( this ); for(int bar = 20; bar < Bars.Count; bar++) { if( calc.GetWeekNumber( Bars, bar ) > calc.GetWeekNumber( Bars, bar-1 ) ) { // Color the background if today is the first day in a new week SetBackgroundColor(bar, Color.LightBlue); } } } } }