Untitled

mail@pastecode.io avatarunknown
plain_text
a month ago
1.8 kB
18
Indexable
Never
public class SampleChartManaging : Indicator
{
	private decimal _barsSpacing = 1;
	private decimal _barsWidth = 1;
	private ChartVisualModes _modes;
	private FootprintVisualModes _visualMode;
	private FootprintContentModes _contentMode;

    public decimal BarsSpacing
	{
		get => _barsSpacing;
		set
		{
			_barsSpacing = value;
			ChartInfo?.PriceChartContainer?.SetCustomBarsSpacing(_barsSpacing);
			RedrawChart();
		}
	}

	public decimal BarsWidth
	{
		get => _barsWidth;
		set
		{
			_barsWidth = value;
			ChartInfo?.PriceChartContainer?.SetCustomBarsWidth(_barsWidth, false);
			RedrawChart();
		}
	}

	public ChartVisualModes ChartMode
	{
		get => _modes;
		set
		{
			_modes = value;

			if (ChartInfo != null)
				ChartInfo.ChartVisualMode = value;

			RedrawChart();
		}
	}

	public FootprintContentModes FootprintContentMode
    {
		get => _contentMode;
		set
		{
			_contentMode = value;

			if (ChartInfo != null)
				ChartInfo.FootprintContentMode = value;
        }
	}

	public FootprintVisualModes FootprintVisualMode
	{
		get => _visualMode;
		set
		{
			_visualMode = value;

			if (ChartInfo != null)
				ChartInfo.FootprintVisualMode = value;
        }
	}

	private FootprintColorSchemes _colorScheme;

	public FootprintColorSchemes FootprintColorScheme
    {
		get => _colorScheme;
		set
		{
			_colorScheme = value;

			if (ChartInfo != null)
				ChartInfo.FootprintColorScheme = value;
        }
	}

    protected override void OnCalculate(int bar, decimal value)
	{
	}

	protected override void OnDispose()
	{
		ChartInfo?.PriceChartContainer?.SetCustomBarsSpacing(null);
		ChartInfo?.PriceChartContainer?.SetCustomBarsWidth(ChartInfo.PriceChartContainer.BarsWidth, false);
	}
}