Skip to content

ChartTrendLine

interface cAlgo.API

DesktopCLICloud

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.

Environment behaviour

CLI — works differently. Created and kept with all its properties, but never drawn: the CLI displays no chart.

Cloud — works differently. Created and kept with all its properties, but never drawn: the cloud displays no chart.

Definition

public interface ChartTrendLine

Namespace: cAlgo.API · Group: Drawings · Implements: ChartObject

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use Chart.DrawTrendLine to draw a trend line on chart
    public partial 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)
        {
        }
    }
}
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def initialize(self):
        trendLine = api.Chart.DrawTrendLine("trendLine", api.Chart.FirstVisibleBarIndex, api.Bars.LowPrices[api.Chart.FirstVisibleBarIndex], api.Chart.LastVisibleBarIndex, api.Bars.HighPrices[api.Chart.LastVisibleBarIndex], Color.Red, 2, LineStyle.Dots)
        trendLine.IsInteractive = True
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}

Methods

Name Description
CalculateY 2 overloadsDesktopCLIClouddouble Calculates Y-axis value corresponding the specified bar index.

Properties

Name Description
ColorDesktopCLICloudColor Gets or sets the color of the Trend Line.
ExtendToInfinityDesktopCLICloudbool Defines if the Trend Line extends to infinity.
LineStyleDesktopCLICloudLineStyle Gets or sets the Trend Line style.
ShowAngleDesktopCLICloudbool Defines the trend line angle.
ThicknessDesktopCLICloudint Gets or sets the thickness of the Trend Line.
Time1DesktopCLICloudDateTime Gets or sets the value 1 on the Time line.
Time2DesktopCLICloudDateTime Gets or sets the value 2 on the Time line.
Y1DesktopCLIClouddouble Gets or sets the value 1 on the Y-axis.
Y2DesktopCLIClouddouble Gets or sets the value 2 on the Y-axis.

Inherited members

From ChartObject: Name, Comment, ObjectType, IsInteractive, IsLocked, IsHidden, ZIndex, IsAlive

See also