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

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

Methods

CalculateY (2)

CalculateY (1 of 2)

Summary

Calculates Y-axis value corresponding the specified bar index.

Signature

1
public abstract double CalculateY(int barIndex)

Parameters

Name Type Description
barIndex int Index of the bar.

Return Value

double

CalculateY (2 of 2)

Summary

Calculates Y-axis value corresponding the specified time value.

Signature

1
public abstract double CalculateY(DateTime time)

Parameters

Name Type Description
time DateTime The time.

Return Value

double

Properties

Time1

Summary

Gets or sets the value 1 on the Time line.

Signature

1
public abstract DateTime Time1 {get; set;}

Return Value

DateTime

Time2

Summary

Gets or sets the value 2 on the Time line.

Signature

1
public abstract DateTime Time2 {get; set;}

Return Value

DateTime

Y1

Summary

Gets or sets the value 1 on the Y-axis.

Signature

1
public abstract double Y1 {get; set;}

Return Value

double

Y2

Summary

Gets or sets the value 2 on the Y-axis.

Signature

1
public abstract double Y2 {get; set;}

Return Value

double

Color

Summary

Gets or sets the color of the Trend Line.

Signature

1
public abstract Color Color {get; set;}

Return Value

Color

Thickness

Summary

Gets or sets the thickness of the Trend Line.

Signature

1
public abstract int Thickness {get; set;}

Return Value

int

Related Tutorials

LineStyle

Summary

Gets or sets the Trend Line style.

Signature

1
public abstract LineStyle LineStyle {get; set;}

Return Value

LineStyle

ShowAngle

Summary

Defines the trend line angle.

Signature

1
public abstract bool ShowAngle {get; set;}

Return Value

bool

ExtendToInfinity

Summary

Defines if the Trend Line extends to infinity.

Signature

1
public abstract bool ExtendToInfinity {get; set;}

Return Value

bool