Line


Summary

Represents the line shape.

Syntax

public class Line : Shape

Members

NameTypeSummary
Line MethodInitializes a new instance of the Line class.
X1 PropertyGets or sets x-axis point 1 data.
X2 PropertyGets or sets the x-axis point 2 data.
Y1 PropertyGets or sets the y-axis point 2 data.
Y2 PropertyGets or sets the y-axis point 2 data.

Example 1

using cAlgo.API;
namespace cAlgo
{
    // This sample shows how to draw a line shape on your chart
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class LineShapeSample : Indicator
    {
        protected override void Initialize()
        {
            var xCenter = Chart.Width / 2;
            var yCenter = Chart.Height / 2;
            var line = new Line
            {
                X1 = xCenter,
                X2 = xCenter + 100,
                Y1 = yCenter,
                Y2 = yCenter + 100,
                StrokeColor = Color.Red,
                StrokeThickness = 2
            };
            Chart.AddControl(line);
        }
        public override void Calculate(int index)
        {
        }
    }
}
Reference