Skip to content

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.

Signature

1
public abstract interface ChartTrendLine

Namespace

cAlgo.API

Methods

Name Description
CalculateY Calculates Y-axis value corresponding the specified time value.

Properties

Name Description
Time1 { get; set; } Gets or sets the value 1 on the Time line.
Time2 { get; set; } Gets or sets the value 2 on the Time line.
Y1 { get; set; } Gets or sets the value 1 on the Y-axis.
Y2 { get; set; } Gets or sets the value 2 on the Y-axis.
Color { get; set; } Gets or sets the color of the Trend Line.
Thickness { get; set; } Gets or sets the thickness of the Trend Line.
LineStyle { get; set; } Gets or sets the Trend Line style.
ShowAngle { get; set; } Defines the trend line angle.
ExtendToInfinity { get; set; } Defines if the Trend Line extends to infinity.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
 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)
         {
         }
     }
 }

See Also


Last update: December 5, 2022

Comments