ChartTriangle


Summary

Represents the Triangle chart object.

Syntax

public interface ChartTriangle : ChartShape, ChartObject

Members

NameTypeSummary
Time1 PropertyGets or sets the value 1 on the Time line.
Time2 PropertyGets or sets the value 2 on the Time line.
Time3 PropertyGets or sets the value 3 on the Time line.
Y1 PropertyGets or sets the value 1 on the Y-axis.
Y2 PropertyGets or sets the value 2 on the Y-axis.
Y3 PropertyGets or sets the value 3 on the Y-axis.

Example 1

using cAlgo.API;
namespace cAlgo
{
    // This sample shows how to draw a triangle on chart with Chart.DrawTriangle method
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ChartTriangleSample : Indicator
    {
        protected override void Initialize()
        {
            var x1 = Chart.FirstVisibleBarIndex;
            var x2 = Chart.FirstVisibleBarIndex + ((Chart.LastVisibleBarIndex - Chart.FirstVisibleBarIndex) / 2);
            var x3 = Chart.LastVisibleBarIndex;
            var y1 = Bars.LowPrices[x1];
            var y2 = Bars.LowPrices.Minimum(Chart.LastVisibleBarIndex - Chart.FirstVisibleBarIndex);
            var y3 = Bars.HighPrices[x3];
            var triangle = Chart.DrawTriangle("triangle_sample", x1, y1, x2, y2, x3, y3, Color.FromArgb(100, Color.Red), 2, LineStyle.Dots);
            triangle.IsInteractive = true;
            triangle.IsFilled = true;
        }
        public override void Calculate(int index)
        {
        }
    }
}
Reference