Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.0 kB
2
Indexable
Never
public class SampleChartManaging : Indicator
{
	private decimal _barsSpacing = 1;
	private decimal _barsWidth = 1;
	private ChartVisualModes _modes;

	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();
		}
	}

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

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