Your interactive trading laboratory!
 • 
18 users online

Quantacula Help

How-To
C# API Reference
Extensions
Development Blog
API-Extensions
Indicator Spotlights

QCommunity Extensions
The open-source GitHub repository of source code for the QCommunity Extensions library. Contains indicators and other extensions submitted by the Quantacula Community. Look for QCommunity indicators when you create a Building Block model, mark the "QCommunity" library check box to expose them.

TASC-Extensions
The open-source GitHub repository of source code for the TASCExtensions Quantacula extension. Contains indicators and other extensions adapted from the Traders' Tips articles in Technical Analysis of Stocks & Commodities magazine.
HistoryScale
Namespace: Quantacula.Core
Parent: Object

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

Constructor

HistoryScale
public HistoryScale(HistoryScales scale, int interval = 0)

The HistoryScale constructor takes a scale parameter of type HistoryScales 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 Quantacula.Backtest;
using System;
using Quantacula.Core;
using Quantacula.Indicators;
using Quantacula.ChartWPF;
using System.Drawing;
using System.Collections.Generic;

namespace Quantacula
{
    public class MyModel : UserModelBase
    {
        //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)
        {
        }
    }
}

Interval
public int Interval

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

Example Code
using Quantacula.Backtest;
using System;
using Quantacula.Core;
using Quantacula.Indicators;
using Quantacula.ChartWPF;
using System.Drawing;
using System.Collections.Generic;

namespace Quantacula
{
    public class MyModel : UserModelBase
    {
        //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.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 Quantacula.Backtest;
using System;
using Quantacula.Core;
using Quantacula.Indicators;
using Quantacula.ChartWPF;
using System.Drawing;
using System.Collections.Generic;

namespace Quantacula
{
    public class MyModel : UserModelBase
    {
        //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!", Color.Red);
        }

        public override void Execute(BarHistory bars, int idx)
        {
        }
    }
}

Scale
public HistoryScales Scale

Denotes what kind of scale this HistoryScale represents, as a HistoryScales enum. Possible values are Daily, Weekly, Monthly, Quarterly, Yearly, Tick, Second, and Minute.

Example Code
using Quantacula.Backtest;
using System;
using Quantacula.Core;
using Quantacula.Indicators;
using Quantacula.ChartWPF;
using System.Drawing;
using System.Collections.Generic;

namespace Quantacula
{
    public class MyModel : UserModelBase
    {
        //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.Scale);
			DrawHeaderText("Bar Interval = " + bars.Scale.Interval);
        }

        public override void Execute(BarHistory bars, int idx)
        {
        }
    }
}

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

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