Skip to main content Skip to footer

To create a new BarsType a developer should create couple of classes:

  • First class should be inherited from GeneratedBarsPeriod class. This class defines different parameters for bars creation, for example Period, Size etc. Once class is created a developer must override a property Name to set a name for period.
 public class TestBarsTypePeriod : GeneratedBarsPeriod
{
            [Display(GroupName = nameof(Resource.ScriptDataSeries), Name = nameof(Resource.BarsPeriodTypeNameRange), Order = 2, ResourceType = typeof(Resource))]
            [Range(1, int.MaxValue)]
            public int TestRange { get; set; } = 2;

            protected override string Name => "Test Bars type";
 }
  • Second class should be inherited from GeneratedBarsType<T> class where T is a BarsPeriod class created on the first step. This class defines rules for bars creation. Once class is created a developer must override a method CreateBuilder in which a developer should implement logic of bars building.
internal class TestBarsType:GeneratedBarsType<TestBarsTypePeriod>
{
        #region Overrides of BarsTypeBase

        /// <inheritdoc />
        public override BarsBuilder CreateBuilder(IBarStorage barStorage, TradingHours? tradingHours = null)
        {
            //Write your code here
        }

        #endregion
}

Once new BarsType is developed one can use it on a chart.

Custom bar type
Add custom bar type
Select custom bar type

Cookies Notice

We use cookies to improve your experience, personalize content, and analyze our traffic. By clicking "Accept All Cookies," you agree to the storing of cookies on your device. You can manage your cookie preferences at any time by visiting our Cookie Settings.