Search Framework:
HistoryScale
Namespace: WealthLab.Core
Parent: Object

The HistoryScale class represents a data time scale, for example daily, weekly, or 5-minute intraday scales.

Constructors
HistoryScale
public HistoryScale(Frequency scale, int interval = 0)

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.



Members
Description
public string Description

Returns a description of the scale.

Example Code
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)
        {
        }
    }
}

Frequency
public Frequency Frequency

Denotes the frequency of data the HistoryScale represents, as a Frequency enum. Possible values are Daily, Weekly, Monthly, Quarterly, Yearly, Tick, Second, and Minute.

Example Code
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)
        {
        }
    }
}

Interval
public int Interval

Represents the time interval for Minute, Second and Tick scales.

Example Code
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)
        {
        }
    }
}

IsIntraday
public bool IsIntraday

Returns true if this HistoryScale represents an intraday scale. Intraday scales are Tick, Second, and Minute.

Example Code
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)
        {
        }
    }
}

Static Helpers
public static HistoryScale Daily = new HistoryScale(Frequency.Daily)
public static HistoryScale Weekly = new HistoryScale(Frequency.Weekly)
public static HistoryScale Monthly = new HistoryScale(Frequency.Monthly)
public static HistoryScale Quarterly = new HistoryScale(Frequency.Quarterly)
public static HistoryScale Yearly = new HistoryScale(Frequency.Yearly)

This collection of static variables can be referenced as shortcuts to commonly used scales.