ChartTrendLine


Summary

Represents the Trend Line chart object. A straight line that can be drawn from point 1 to the point 2 in any direction to mark the trends on the chart.

Syntax

public interface ChartTrendLine : ChartObject

Members

NameTypeSummary
CalculateY MethodCalculates Y-axis value corresponding the specified bar index.
Color PropertyGets or sets the color of the Trend Line.
ExtendToInfinity PropertyDefines if the Trend Line extends to infinity.
LineStyle PropertyGets or sets the Trend Line style.
ShowAngle PropertyDefines the trend line angle.
Thickness PropertyGets or sets the thickness of the Trend Line.
Time1 PropertyGets or sets the value 1 on the Time line.
Time2 PropertyGets or sets the value 2 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.

Example 1

using cAlgo.API;
namespace cAlgo
{
    // This sample shows how to use Chart.DrawTrendLine to draw a trend line on chart
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ChartTrendLineSample : Indicator
    {
        protected override void Initialize()
        {
            var trendLine = Chart.DrawTrendLine("trendLine", Chart.FirstVisibleBarIndex, Bars.LowPrices[Chart.FirstVisibleBarIndex], Chart.LastVisibleBarIndex, Bars.HighPrices[Chart.LastVisibleBarIndex], Color.Red, 2, LineStyle.Dots);
            trendLine.IsInteractive = true;
        }
        public override void Calculate(int index)
        {
        }
    }
}
Reference