Parent: Object
The HistoryScale class represents a data time scale, for example daily, weekly, or 5-minute intraday scales.
The HistoryScale constructor takes a scale parameter of type Frequency which is an enumerated type. Possible values are Daily, Weekly, Monthly, Quarterly, Yearly, Tick, Second, and Minute. The interval parameter is the interval for Tick, Second or Minute scales.
Returns a description of the scale.
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using WealthLab.ChartWPF; using System.Drawing; using System.Collections.Generic; namespace WealthLab { public class MyStrategy : UserStrategyBase { //display the scale of the chart public override void Initialize(BarHistory bars) { DrawHeaderText("The current scale is: " + bars.Scale.Description); } public override void Execute(BarHistory bars, int idx) { } } }
Denotes the frequency of data the HistoryScale represents, as a Frequency enum. Possible values are Daily, Weekly, Monthly, Quarterly, Yearly, Tick, Second, and Minute.
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using WealthLab.ChartWPF; using System.Drawing; using System.Collections.Generic; namespace WealthLab { public class MyStrategy : UserStrategyBase { //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { DrawHeaderText("Bar Scale = " + bars.Scale); DrawHeaderText("Bar Interval = " + bars.Scale.Interval); } public override void Execute(BarHistory bars, int idx) { } } }
Represents the time interval for Minute, Second and Tick scales.
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using WealthLab.ChartWPF; using System.Drawing; using System.Collections.Generic; namespace WealthLab { public class MyStrategy : UserStrategyBase { //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { DrawHeaderText("Bar Scale = " + bars.Scale); DrawHeaderText("Bar Interval = " + bars.Scale.Interval); } public override void Execute(BarHistory bars, int idx) { } } }
Returns true if this HistoryScale represents an intraday scale. Intraday scales are Tick, Second, and Minute.
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using WealthLab.ChartWPF; using System.Drawing; using System.Collections.Generic; namespace WealthLab { public class MyStrategy : UserStrategyBase { //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { if (bars.Scale.IsIntraday) DrawHeaderText("Intraday Chart!", WLColor.Red); } public override void Execute(BarHistory bars, int idx) { } } }
This collection of static variables can be referenced as shortcuts to commonly used scales.